]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkseparatortoolitem.c
Merge branch 'master' into toolpalette
[~andy/gtk] / gtk / gtkseparatortoolitem.c
index e3682114721a07ea69707bf298b4b1a18f04c2d6..4aa4b15697035f3f51c60ed51c861de457942ce8 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#undef GTK_DISABLE_DEPRECATED
-
-#include <config.h>
+#include "config.h"
 #include "gtkseparatormenuitem.h"
 #include "gtkseparatortoolitem.h"
 #include "gtkintl.h"
 #include "gtktoolbar.h"
+#include "gtkprivate.h"
+#include "gtkalias.h"
 
 #define MENU_ID "gtk-separator-tool-item-menu-id"
 
@@ -34,9 +34,6 @@ enum {
   PROP_DRAW
 };
 
-static void     gtk_separator_tool_item_class_init        (GtkSeparatorToolItemClass *class);
-static void    gtk_separator_tool_item_init              (GtkSeparatorToolItem      *separator_item,
-                                                          GtkSeparatorToolItemClass *class);
 static gboolean gtk_separator_tool_item_create_menu_proxy (GtkToolItem               *item);
 static void     gtk_separator_tool_item_set_property      (GObject                   *object,
                                                           guint                      prop_id,
@@ -56,8 +53,6 @@ static gint     get_space_size                            (GtkToolItem
 
 
 
-static GObjectClass *parent_class = NULL;
-
 #define GTK_SEPARATOR_TOOL_ITEM_GET_PRIVATE(obj)(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_SEPARATOR_TOOL_ITEM, GtkSeparatorToolItemPrivate))
 
 struct _GtkSeparatorToolItemPrivate
@@ -65,31 +60,7 @@ struct _GtkSeparatorToolItemPrivate
   guint draw : 1;
 };
 
-GType
-gtk_separator_tool_item_get_type (void)
-{
-  static GType type = 0;
-  
-  if (!type)
-    {
-      static const GTypeInfo type_info =
-       {
-         sizeof (GtkSeparatorToolItemClass),
-         (GBaseInitFunc) 0,
-         (GBaseFinalizeFunc) 0,
-         (GClassInitFunc) gtk_separator_tool_item_class_init,
-         (GClassFinalizeFunc) 0,
-         NULL,
-         sizeof (GtkSeparatorToolItem),
-         0, /* n_preallocs */
-         (GInstanceInitFunc) gtk_separator_tool_item_init,
-       };
-      
-      type = g_type_register_static (GTK_TYPE_TOOL_ITEM,
-                                    "GtkSeparatorToolItem", &type_info, 0);
-    }
-  return type;
-}
+G_DEFINE_TYPE (GtkSeparatorToolItem, gtk_separator_tool_item, GTK_TYPE_TOOL_ITEM)
 
 static gint
 get_space_size (GtkToolItem *tool_item)
@@ -100,7 +71,7 @@ get_space_size (GtkToolItem *tool_item)
   if (GTK_IS_TOOLBAR (parent))
     {
       gtk_widget_style_get (parent,
-                           "space_size", &space_size,
+                           "space-size", &space_size,
                            NULL);
     }
   
@@ -115,7 +86,6 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
   GtkToolItemClass *toolitem_class;
   GtkWidgetClass *widget_class;
   
-  parent_class = g_type_class_peek_parent (class);
   object_class = (GObjectClass *)class;
   container_class = (GtkContainerClass *)class;
   toolitem_class = (GtkToolItemClass *)class;
@@ -135,14 +105,13 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
                                                         P_("Draw"),
                                                         P_("Whether the separator is drawn, or just blank"),
                                                         TRUE,
-                                                        G_PARAM_READWRITE));
+                                                        GTK_PARAM_READWRITE));
   
   g_type_class_add_private (object_class, sizeof (GtkSeparatorToolItemPrivate));
 }
 
 static void
-gtk_separator_tool_item_init (GtkSeparatorToolItem      *separator_item,
-                             GtkSeparatorToolItemClass *class)
+gtk_separator_tool_item_init (GtkSeparatorToolItem      *separator_item)
 {
   separator_item->priv = GTK_SEPARATOR_TOOL_ITEM_GET_PRIVATE (separator_item);
   separator_item->priv->draw = TRUE;
@@ -229,12 +198,17 @@ gtk_separator_tool_item_expose (GtkWidget      *widget,
                                GdkEventExpose *event)
 {
   GtkToolbar *toolbar = NULL;
+  GtkSeparatorToolItemPrivate *priv =
+      GTK_SEPARATOR_TOOL_ITEM_GET_PRIVATE (widget);
 
-  if (widget->parent && GTK_IS_TOOLBAR (widget->parent))
-    toolbar = GTK_TOOLBAR (widget->parent);
+  if (priv->draw)
+    {
+      if (GTK_IS_TOOLBAR (widget->parent))
+       toolbar = GTK_TOOLBAR (widget->parent);
 
-  _gtk_toolbar_paint_space_line (widget, toolbar,
-                                &(event->area), &widget->allocation);
+      _gtk_toolbar_paint_space_line (widget, toolbar,
+                                    &(event->area), &widget->allocation);
+    }
   
   return FALSE;
 }
@@ -247,7 +221,7 @@ gtk_separator_tool_item_expose (GtkWidget      *widget,
  * Return value: the new #GtkSeparatorToolItem
  * 
  * Since: 2.4
- **/
+ */
 GtkToolItem *
 gtk_separator_tool_item_new (void)
 {
@@ -263,13 +237,13 @@ gtk_separator_tool_item_new (void)
  * gtk_separator_tool_item_get_draw:
  * @item: a #GtkSeparatorToolItem 
  * 
- * Returns whether @separator_tool_item is drawn as a
- * line, or just blank. See gtk_separator_tool_item_set_draw().
+ * Returns whether @item is drawn as a line, or just blank. 
+ * See gtk_separator_tool_item_set_draw().
  * 
- * Return value: #TRUE if @separator_tool_item is drawn as a line, or just blank.
+ * Return value: %TRUE if @item is drawn as a line, or just blank.
  * 
  * Since: 2.4
- **/
+ */
 gboolean
 gtk_separator_tool_item_get_draw (GtkSeparatorToolItem *item)
 {
@@ -281,14 +255,14 @@ gtk_separator_tool_item_get_draw (GtkSeparatorToolItem *item)
 /**
  * gtk_separator_tool_item_set_draw:
  * @item: a #GtkSeparatorToolItem
- * @draw: whether @separator_tool_item is drawn as a vertical iln
+ * @draw: whether @item is drawn as a vertical line
  * 
- * When @separator_tool_items is drawn as a vertical line, or just blank.
- * Setting this #FALSE along with gtk_tool_item_set_expand() is useful
+ * Whether @item is drawn as a vertical line, or just blank.
+ * Setting this to %FALSE along with gtk_tool_item_set_expand() is useful
  * to create an item that forces following items to the end of the toolbar.
  * 
  * Since: 2.4
- **/
+ */
 void
 gtk_separator_tool_item_set_draw (GtkSeparatorToolItem *item,
                                  gboolean              draw)
@@ -307,3 +281,5 @@ gtk_separator_tool_item_set_draw (GtkSeparatorToolItem *item,
     }
 }
 
+#define __GTK_SEPARATOR_TOOL_ITEM_C__
+#include "gtkaliasdef.c"