]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkseparatormenuitem.c
Revert "combobox: Don't special-case RTL child positions anymore"
[~andy/gtk] / gtk / gtkseparatormenuitem.c
index 77b6b06d20815393b97ba2341212eebdab39ed16..da721297067eac0f0572bc7c821fdedf2e9c58d2 100644 (file)
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  * file for a list of people on the GTK+ Team.  See the ChangeLog
  * files for a list of changes.  These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  */
 
-#include "gtkseparatormenuitem.h"
+#include "config.h"
 
-static void gtk_separator_menu_item_class_init (GtkSeparatorMenuItemClass *klass);
+#include "gtkseparatormenuitem.h"
 
-static GtkMenuItemClass *parent_class;
+#include "gtkstylecontext.h"
 
-GtkType
-gtk_separator_menu_item_get_type (void)
-{
-  static GtkType separator_menu_item_type = 0;
+/**
+ * SECTION:gtkseparatormenuitem
+ * @Short_description: A separator used in menus
+ * @Title: GtkSeparatorMenuItem
+ *
+ * The #GtkSeparatorMenuItem is a separator used to group
+ * items within a menu. It displays a horizontal line with a shadow to
+ * make it appear sunken into the interface.
+ */
 
-  if (!separator_menu_item_type)
-    {
-      static const GTypeInfo separator_menu_item_info =
-      {
-       sizeof (GtkSeparatorMenuItemClass),
-       NULL,           /* base_init */
-       NULL,           /* base_finalize */
-       (GClassInitFunc) gtk_separator_menu_item_class_init,
-       NULL,           /* class_finalize */
-       NULL,           /* class_data */
-       sizeof (GtkSeparatorMenuItem),
-       16,             /* n_preallocs */
-       (GInstanceInitFunc) NULL,
-      };
+G_DEFINE_TYPE (GtkSeparatorMenuItem, gtk_separator_menu_item, GTK_TYPE_MENU_ITEM)
 
-      separator_menu_item_type = g_type_register_static (GTK_TYPE_MENU_ITEM, "GtkSeparatorMenuItem", &separator_menu_item_info, 0);
-    }
+static void
+gtk_separator_menu_item_class_init (GtkSeparatorMenuItemClass *class)
+{
+  GTK_CONTAINER_CLASS (class)->child_type = NULL;
 
-  return separator_menu_item_type;
+  gtk_widget_class_set_accessible_role (GTK_WIDGET_CLASS (class), ATK_ROLE_SEPARATOR);
 }
 
-static void
-gtk_separator_menu_item_class_init (GtkSeparatorMenuItemClass *klass)
+static void 
+gtk_separator_menu_item_init (GtkSeparatorMenuItem *item)
 {
-  parent_class = gtk_type_class (gtk_menu_item_get_type ());
+  GtkStyleContext *context;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (item));
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
 }
 
-GtkWidget*
+/**
+ * gtk_separator_menu_item_new:
+ *
+ * Creates a new #GtkSeparatorMenuItem.
+ *
+ * Returns: a new #GtkSeparatorMenuItem.
+ */
+GtkWidget *
 gtk_separator_menu_item_new (void)
 {
-  return GTK_WIDGET (gtk_type_new (gtk_separator_menu_item_get_type ()));
+  return g_object_new (GTK_TYPE_SEPARATOR_MENU_ITEM, NULL);
 }