]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkinfobar.c
filechooserbutton: In SELECT_FOLDER, when the selection is empty, show (None) in...
[~andy/gtk] / gtk / gtkinfobar.c
index bc0f9318488bb3ef81e7e1831ee5a811768c6abc..a3a877da23b9f36321f402626085d7002c65d727 100644 (file)
@@ -145,6 +145,10 @@ enum
 
 static guint signals[LAST_SIGNAL];
 
+#define ACTION_AREA_DEFAULT_BORDER 5
+#define ACTION_AREA_DEFAULT_SPACING 6
+#define CONTENT_AREA_DEFAULT_BORDER 8
+#define CONTENT_AREA_DEFAULT_SPACING 16
 
 static void     gtk_info_bar_set_property (GObject        *object,
                                            guint           prop_id,
@@ -154,7 +158,6 @@ static void     gtk_info_bar_get_property (GObject        *object,
                                            guint           prop_id,
                                            GValue         *value,
                                            GParamSpec     *pspec);
-static void     gtk_info_bar_style_updated (GtkWidget      *widget);
 static void     gtk_info_bar_get_preferred_width          (GtkWidget *widget,
                                                            gint      *minimum_width,
                                                            gint      *natural_width);
@@ -380,7 +383,6 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
   object_class->set_property = gtk_info_bar_set_property;
   object_class->finalize = gtk_info_bar_finalize;
 
-  widget_class->style_updated = gtk_info_bar_style_updated;
   widget_class->get_preferred_width = gtk_info_bar_get_preferred_width;
   widget_class->get_preferred_height = gtk_info_bar_get_preferred_height;
   widget_class->draw = gtk_info_bar_draw;
@@ -461,6 +463,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
    * content area of the info bar.
    *
    * Since: 2.18
+   * Deprecated: 3.6: Use gtk_container_set_border_width()
    */
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_int ("content-area-border",
@@ -468,7 +471,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
                                                              P_("Width of border around the content area"),
                                                              0,
                                                              G_MAXINT,
-                                                             8,
+                                                             CONTENT_AREA_DEFAULT_BORDER,
                                                              GTK_PARAM_READABLE));
 
   /**
@@ -478,6 +481,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
    * content area of the info bar.
    *
    * Since: 2.18
+   * Deprecated: 3.6: Use gtk_box_set_spacing()
    */
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_int ("content-area-spacing",
@@ -485,7 +489,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
                                                              P_("Spacing between elements of the area"),
                                                              0,
                                                              G_MAXINT,
-                                                             16,
+                                                             CONTENT_AREA_DEFAULT_SPACING,
                                                              GTK_PARAM_READABLE));
 
   /**
@@ -494,6 +498,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
    * Spacing between buttons in the action area of the info bar.
    *
    * Since: 2.18
+   * Deprecated: 3.6: Use gtk_box_set_spacing()
    */
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_int ("button-spacing",
@@ -501,7 +506,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
                                                              P_("Spacing between buttons"),
                                                              0,
                                                              G_MAXINT,
-                                                             6,
+                                                             ACTION_AREA_DEFAULT_SPACING,
                                                              GTK_PARAM_READABLE));
 
   /**
@@ -510,6 +515,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
    * Width of the border around the action area of the info bar.
    *
    * Since: 2.18
+   * Deprecated: 3.6: Use gtk_container_set_border_width()
    */
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_int ("action-area-border",
@@ -517,7 +523,7 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
                                                              P_("Width of border around the action area"),
                                                              0,
                                                              G_MAXINT,
-                                                             5,
+                                                             ACTION_AREA_DEFAULT_BORDER,
                                                              GTK_PARAM_READABLE));
 
   binding_set = gtk_binding_set_by_class (klass);
@@ -527,32 +533,6 @@ gtk_info_bar_class_init (GtkInfoBarClass *klass)
   g_type_class_add_private (object_class, sizeof (GtkInfoBarPrivate));
 }
 
-static void
-gtk_info_bar_style_updated (GtkWidget *widget)
-{
-  GtkInfoBar *info_bar = GTK_INFO_BAR (widget);
-  gint button_spacing;
-  gint action_area_border;
-  gint content_area_spacing;
-  gint content_area_border;
-
-  GTK_WIDGET_CLASS (gtk_info_bar_parent_class)->style_updated (widget);
-
-  gtk_widget_style_get (widget,
-                        "button-spacing", &button_spacing,
-                        "action-area-border", &action_area_border,
-                        "content-area-spacing", &content_area_spacing,
-                        "content-area-border", &content_area_border,
-                        NULL);
-
-  gtk_box_set_spacing (GTK_BOX (info_bar->priv->action_area), button_spacing);
-  gtk_container_set_border_width (GTK_CONTAINER (info_bar->priv->action_area),
-                                  action_area_border);
-  gtk_box_set_spacing (GTK_BOX (info_bar->priv->content_area), content_area_spacing);
-  gtk_container_set_border_width (GTK_CONTAINER (info_bar->priv->content_area),
-                                  content_area_border);
-}
-
 static void
 gtk_info_bar_init (GtkInfoBar *info_bar)
 {
@@ -581,14 +561,18 @@ gtk_info_bar_init (GtkInfoBar *info_bar)
   info_bar->priv->content_area = content_area;
   info_bar->priv->action_area = action_area;
 
+  /* set default spacings */
+  gtk_box_set_spacing (GTK_BOX (info_bar->priv->action_area), ACTION_AREA_DEFAULT_SPACING);
+  gtk_container_set_border_width (GTK_CONTAINER (info_bar->priv->action_area), ACTION_AREA_DEFAULT_BORDER);
+  gtk_box_set_spacing (GTK_BOX (info_bar->priv->content_area), CONTENT_AREA_DEFAULT_SPACING);
+  gtk_container_set_border_width (GTK_CONTAINER (info_bar->priv->content_area), CONTENT_AREA_DEFAULT_BORDER);
+
   /* message-type is a CONSTRUCT property, so we init to a value
    * different from its default to trigger its property setter
    * during construction */
   info_bar->priv->message_type = GTK_MESSAGE_OTHER;
 
   gtk_widget_pop_composite_child ();
-
-  gtk_info_bar_style_updated (widget);
 }
 
 static GtkBuildableIface *parent_buildable_iface;
@@ -1028,10 +1012,11 @@ gtk_info_bar_buildable_custom_tag_start (GtkBuildable  *buildable,
 {
   ActionWidgetsSubParserData *parser_data;
 
-  if (child)
-    return FALSE;
+  if (parent_buildable_iface->custom_tag_start (buildable, builder, child,
+                                                tagname, parser, data))
+    return TRUE;
 
-  if (strcmp (tagname, "action-widgets") == 0)
+  if (!child && strcmp (tagname, "action-widgets") == 0)
     {
       parser_data = g_slice_new0 (ActionWidgetsSubParserData);
       parser_data->info_bar = GTK_INFO_BAR (buildable);
@@ -1042,8 +1027,7 @@ gtk_info_bar_buildable_custom_tag_start (GtkBuildable  *buildable,
       return TRUE;
     }
 
-  return parent_buildable_iface->custom_tag_start (buildable, builder, child,
-                                                   tagname, parser, data);
+  return FALSE;
 }
 
 static void