[glade] Replaced deprecated functions



commit 58aef70fba7bddef21d4db7b47ab808e57e7f909
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Wed May 7 00:22:41 2014 -0300

    Replaced deprecated functions
    
    gtk_button_new_from_stock()     -> gtk_button_new_from_icon_name()
    gtk_widget_render_icon_pixbuf() -> gtk_icon_theme_load_icon()
    gtk_widget_set_margin_left()    -> gtk_widget_set_margin_start()
    
    Stock images with icon names
    GTK_STOCK_ADD     -> "list-add"
    GTK_STOCK_REMOVE  -> "list-remove"
    GTK_STOCK_OPEN    -> "document-open"
    GTK_STOCK_GO_DOWN -> "go-down"
    GTK_STOCK_DIALOG_WARNING -> "dialog-warning"
    GTK_STOCK_INFO    -> "dialog-information"
    GTK_STOCK_SAVE    -> "document-save"
    GTK_STOCK_REFRESH -> "view-refresh"

 gladeui/glade-base-editor.c                 |    6 ++--
 gladeui/glade-editor-property.c             |   39 +++++++++++++--------------
 gladeui/glade-inspector.c                   |    2 +-
 gladeui/glade-property-class.c              |   14 +--------
 gladeui/glade-signal-editor.c               |    6 ++--
 plugins/gtk+/glade-accels.c                 |    6 ++--
 plugins/gtk+/glade-attributes.c             |    2 +-
 plugins/gtk+/glade-model-data.c             |    4 ++-
 plugins/gtk+/glade-string-list.c            |    2 +-
 plugins/gtk+/glade-tool-item-group-editor.c |    2 +-
 src/glade-window.c                          |    8 +++---
 11 files changed, 41 insertions(+), 50 deletions(-)
---
diff --git a/gladeui/glade-base-editor.c b/gladeui/glade-base-editor.c
index 2a28875..019342e 100644
--- a/gladeui/glade-base-editor.c
+++ b/gladeui/glade-base-editor.c
@@ -1801,14 +1801,14 @@ glade_base_editor_init (GladeBaseEditor *editor)
   gtk_grid_set_column_spacing (GTK_GRID (button_table), 8);
   gtk_box_pack_start (GTK_BOX (tree_vbox), button_table, FALSE, TRUE, 0);
 
-  button = gtk_button_new_from_stock (GTK_STOCK_ADD);
+  button = gtk_button_new_from_icon_name ("list-add", GTK_ICON_SIZE_BUTTON);
   gtk_widget_set_hexpand (button, TRUE);
   gtk_widget_show (button);
   g_signal_connect (button, "clicked",
                     G_CALLBACK (glade_base_editor_add_activate), editor);
   gtk_grid_attach (GTK_GRID (button_table), button, 0, 0, 1, 1);
 
-  e->remove_button = button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
+  e->remove_button = button = gtk_button_new_from_icon_name ("list-remove", GTK_ICON_SIZE_BUTTON);
   gtk_widget_show (button);
   gtk_widget_set_hexpand (button, TRUE);
   g_signal_connect (button, "clicked",
@@ -2243,7 +2243,7 @@ glade_base_editor_pack_new_window (GladeBaseEditor *editor,
   gtk_box_set_spacing (GTK_BOX (buttonbox), 8);
   gtk_box_pack_start (GTK_BOX (editor), buttonbox, FALSE, TRUE, 0);
 
-  button = gtk_button_new_from_stock (GTK_STOCK_HELP);
+  button = gtk_button_new_from_icon_name ("help-browser", GTK_ICON_SIZE_BUTTON);
   gtk_widget_show (button);
   g_signal_connect (button, "clicked",
                     G_CALLBACK (glade_base_editor_help),
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index a598f13..229c8eb 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -1333,9 +1333,9 @@ glade_eprop_flags_create_input (GladeEditorProperty *eprop)
   gtk_widget_set_hexpand (eprop_flags->entry, TRUE);
 
   gtk_editable_set_editable (GTK_EDITABLE (eprop_flags->entry), FALSE);
-  gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_flags->entry), 
-                                 GTK_ENTRY_ICON_SECONDARY,
-                                 GTK_STOCK_EDIT);
+  gtk_entry_set_icon_from_icon_name (GTK_ENTRY (eprop_flags->entry),
+                                     GTK_ENTRY_ICON_SECONDARY,
+                                     "gtk-edit");
 
   g_signal_connect_swapped (eprop_flags->entry, "icon-release",
                             G_CALLBACK (glade_eprop_flags_show_dialog),
@@ -1689,9 +1689,9 @@ glade_eprop_named_icon_create_input (GladeEditorProperty *eprop)
   eprop_named_icon->entry = gtk_entry_new ();
   gtk_widget_set_hexpand (eprop_named_icon->entry, TRUE);
   gtk_widget_set_valign (eprop_named_icon->entry, GTK_ALIGN_CENTER);
-  gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_named_icon->entry), 
-                                 GTK_ENTRY_ICON_SECONDARY,
-                                 GTK_STOCK_EDIT);
+  gtk_entry_set_icon_from_icon_name (GTK_ENTRY (eprop_named_icon->entry),
+                                     GTK_ENTRY_ICON_SECONDARY,
+                                     "gtk-edit");
 
   eprop_named_icon->current_context = NULL;
 
@@ -2423,9 +2423,9 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop)
 
       if (pspec->value_type == GDK_TYPE_PIXBUF)
         {
-          gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_text->text_entry),
-                                         GTK_ENTRY_ICON_SECONDARY,
-                                         GTK_STOCK_OPEN);
+          gtk_entry_set_icon_from_icon_name (GTK_ENTRY (eprop_text->text_entry),
+                                             GTK_ENTRY_ICON_SECONDARY,
+                                             "document-open");
 
           g_signal_connect_swapped (eprop_text->text_entry, "icon-release",
                                     G_CALLBACK (glade_eprop_text_show_resource_dialog),
@@ -2437,9 +2437,9 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop)
     {
       if (GTK_IS_ENTRY (eprop_text->text_entry))
         {
-          gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_text->text_entry), 
-                                         GTK_ENTRY_ICON_SECONDARY,
-                                         GTK_STOCK_EDIT);
+          gtk_entry_set_icon_from_icon_name (GTK_ENTRY (eprop_text->text_entry),
+                                             GTK_ENTRY_ICON_SECONDARY,
+                                             "gtk-edit");
           g_signal_connect_swapped (eprop_text->text_entry, "icon-release",
                                     G_CALLBACK (glade_eprop_text_show_i18n_dialog),
                                     eprop);
@@ -2448,8 +2448,7 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop)
         {
           GtkWidget *button = gtk_button_new ();
           gtk_button_set_image (GTK_BUTTON (button),
-                                gtk_image_new_from_stock (GTK_STOCK_EDIT,
-                                                          GTK_ICON_SIZE_MENU));
+                                gtk_image_new_from_icon_name ("gtk-edit", GTK_ICON_SIZE_MENU));
           gtk_widget_show (button);
           gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
           g_signal_connect_swapped (button, "clicked",
@@ -3462,9 +3461,9 @@ glade_eprop_object_create_input (GladeEditorProperty *eprop)
   gtk_widget_set_hexpand (eprop_object->entry, TRUE);
   gtk_widget_set_valign (eprop_object->entry, GTK_ALIGN_CENTER);
   gtk_editable_set_editable (GTK_EDITABLE (eprop_object->entry), FALSE);
-  gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_object->entry), 
-                                 GTK_ENTRY_ICON_SECONDARY,
-                                 GTK_STOCK_EDIT);
+  gtk_entry_set_icon_from_icon_name (GTK_ENTRY (eprop_object->entry), 
+                                     GTK_ENTRY_ICON_SECONDARY,
+                                     "gtk-edit");
   g_signal_connect_swapped (eprop_object->entry, "icon-release",
                             G_CALLBACK (glade_eprop_object_show_dialog), eprop);
   
@@ -3663,9 +3662,9 @@ glade_eprop_objects_create_input (GladeEditorProperty *eprop)
   gtk_widget_set_hexpand (eprop_objects->entry, TRUE);
   gtk_widget_set_valign (eprop_objects->entry, GTK_ALIGN_CENTER);
   gtk_editable_set_editable (GTK_EDITABLE (eprop_objects->entry), FALSE);
-  gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_objects->entry), 
-                                 GTK_ENTRY_ICON_SECONDARY,
-                                 GTK_STOCK_EDIT);
+  gtk_entry_set_icon_from_icon_name (GTK_ENTRY (eprop_objects->entry),
+                                     GTK_ENTRY_ICON_SECONDARY,
+                                     "gtk-edit");
   g_signal_connect_swapped (eprop_objects->entry, "icon-release",
                             G_CALLBACK (glade_eprop_objects_show_dialog), eprop);
   
diff --git a/gladeui/glade-inspector.c b/gladeui/glade-inspector.c
index 6e81335..1942d60 100644
--- a/gladeui/glade-inspector.c
+++ b/gladeui/glade-inspector.c
@@ -618,7 +618,7 @@ glade_inspector_init (GladeInspector *inspector)
                     G_CALLBACK (selection_changed_cb), inspector);
 
   /* Expand All */
-  gtk_entry_set_icon_from_stock (GTK_ENTRY (priv->entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_GO_DOWN);
+  gtk_entry_set_icon_from_icon_name (GTK_ENTRY (priv->entry), GTK_ENTRY_ICON_SECONDARY, "go-down");
   gtk_entry_set_icon_tooltip_text (GTK_ENTRY (priv->entry), GTK_ENTRY_ICON_SECONDARY, _("Expand all"));
   g_signal_connect_swapped (priv->entry, "icon-press", G_CALLBACK (gtk_tree_view_expand_all), priv->view);
 
diff --git a/gladeui/glade-property-class.c b/gladeui/glade-property-class.c
index a5aed5c..beb9578 100644
--- a/gladeui/glade-property-class.c
+++ b/gladeui/glade-property-class.c
@@ -712,18 +712,8 @@ glade_property_class_make_object_from_string (GladePropertyClass *
 
       if ((pixbuf = gdk_pixbuf_new_from_file (fullpath, NULL)) == NULL)
         {
-          static GdkPixbuf *icon = NULL;
-
-          if (icon == NULL)
-            {
-              GtkWidget *widget = gtk_label_new ("");
-              icon = gtk_widget_render_icon_pixbuf (widget,
-                                                   GTK_STOCK_MISSING_IMAGE,
-                                                   GTK_ICON_SIZE_MENU);
-              gtk_widget_destroy (widget);
-            }
-
-          pixbuf = gdk_pixbuf_copy (icon);
+          pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
+                                             "image-missing", 22, 0, NULL);
         }
 
       if (pixbuf)
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index 9580211..0bec933 100644
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@ -1256,7 +1256,7 @@ glade_signal_editor_init (GladeSignalEditor *self)
   /* version warning */
   renderer = gtk_cell_renderer_pixbuf_new ();
   g_object_set (G_OBJECT (renderer), 
-               "icon-name", GTK_STOCK_DIALOG_WARNING,
+               "icon-name", "dialog-warning",
                "xalign", 0.0,
                 NULL);
   gtk_tree_view_column_set_cell_data_func (priv->column_name, renderer,
@@ -1332,7 +1332,7 @@ glade_signal_editor_init (GladeSignalEditor *self)
                                  NULL);
        
   renderer = glade_cell_renderer_icon_new ();
-  g_object_set (G_OBJECT (renderer), "icon-name", GTK_STOCK_EDIT, NULL);
+  g_object_set (G_OBJECT (renderer), "icon-name", "gtk-edit", NULL);
 
   g_signal_connect (G_OBJECT (renderer), "activate",
                    G_CALLBACK (glade_signal_editor_user_data_activate),
@@ -1397,7 +1397,7 @@ glade_signal_editor_init (GladeSignalEditor *self)
        g_object_set (G_OBJECT (renderer), "icon-name", GLADE_DEVHELP_ICON_NAME,
                      NULL);
       else
-       g_object_set (G_OBJECT (renderer), "icon-name", GTK_STOCK_INFO, NULL);
+       g_object_set (G_OBJECT (renderer), "icon-name", "dialog-information", NULL);
 
       g_signal_connect (G_OBJECT (renderer), "activate",
                        G_CALLBACK (glade_signal_editor_devhelp), self);
diff --git a/plugins/gtk+/glade-accels.c b/plugins/gtk+/glade-accels.c
index 1710bfb..d596701 100644
--- a/plugins/gtk+/glade-accels.c
+++ b/plugins/gtk+/glade-accels.c
@@ -599,9 +599,9 @@ glade_eprop_accel_create_input (GladeEditorProperty * eprop)
   eprop_accel->entry = gtk_entry_new ();
   gtk_widget_set_valign (eprop_accel->entry, GTK_ALIGN_CENTER);
   gtk_editable_set_editable (GTK_EDITABLE (eprop_accel->entry), FALSE);
-  gtk_entry_set_icon_from_stock (GTK_ENTRY (eprop_accel->entry), 
-                                 GTK_ENTRY_ICON_SECONDARY,
-                                 GTK_STOCK_EDIT);
+  gtk_entry_set_icon_from_icon_name (GTK_ENTRY (eprop_accel->entry),
+                                     GTK_ENTRY_ICON_SECONDARY,
+                                     "gtk-edit");
   g_signal_connect_swapped (eprop_accel->entry, "icon-release",
                             G_CALLBACK (glade_eprop_accel_show_dialog), eprop);
 
diff --git a/plugins/gtk+/glade-attributes.c b/plugins/gtk+/glade-attributes.c
index 368cb5b..523cce8 100644
--- a/plugins/gtk+/glade-attributes.c
+++ b/plugins/gtk+/glade-attributes.c
@@ -925,7 +925,7 @@ glade_eprop_attrs_view (GladeEditorProperty *eprop)
 
   /* Icon renderer */
   renderer = glade_cell_renderer_icon_new ();
-  g_object_set (G_OBJECT (renderer), "icon-name", GTK_STOCK_EDIT, NULL);
+  g_object_set (G_OBJECT (renderer), "icon-name", "gtk-edit", NULL);
   gtk_tree_view_column_pack_start (column, renderer, FALSE);
   gtk_tree_view_column_set_attributes (column, renderer,
                                        "activatable", COLUMN_BUTTON_ACTIVE,
diff --git a/plugins/gtk+/glade-model-data.c b/plugins/gtk+/glade-model-data.c
index b493f4c..968b670 100644
--- a/plugins/gtk+/glade-model-data.c
+++ b/plugins/gtk+/glade-model-data.c
@@ -845,7 +845,9 @@ eprop_model_generate_column (GladeEditorProperty * eprop,
           GtkCellRenderer *icon_renderer = glade_cell_renderer_icon_new ();
 
           g_object_set (G_OBJECT (icon_renderer),
-                        "activatable", TRUE, "icon-name", GTK_STOCK_EDIT, NULL);
+                        "activatable", TRUE,
+                        "icon-name", "gtk-edit",
+                        NULL);
 
           gtk_tree_view_column_pack_start (column, icon_renderer, FALSE);
 
diff --git a/plugins/gtk+/glade-string-list.c b/plugins/gtk+/glade-string-list.c
index 81118eb..292dfbc 100644
--- a/plugins/gtk+/glade-string-list.c
+++ b/plugins/gtk+/glade-string-list.c
@@ -706,7 +706,7 @@ glade_eprop_string_list_create_input (GladeEditorProperty * eprop)
 
   /* i18n icon renderer */
   renderer = glade_cell_renderer_icon_new ();
-  g_object_set (G_OBJECT (renderer), "icon-name", GTK_STOCK_EDIT, NULL);
+  g_object_set (G_OBJECT (renderer), "icon-name", "gtk-edit", NULL);
   g_signal_connect (G_OBJECT (renderer), "activate",
                    G_CALLBACK (i18n_icon_activate), eprop);
 
diff --git a/plugins/gtk+/glade-tool-item-group-editor.c b/plugins/gtk+/glade-tool-item-group-editor.c
index 3722b33..588961a 100644
--- a/plugins/gtk+/glade-tool-item-group-editor.c
+++ b/plugins/gtk+/glade-tool-item-group-editor.c
@@ -240,7 +240,7 @@ glade_tool_item_group_editor_new (GladeWidgetAdaptor *adaptor,
 
   table = gtk_grid_new ();
   gtk_widget_set_margin_top (table, 6);
-  gtk_widget_set_margin_left (table, 12);
+  gtk_widget_set_margin_start (table, 12);
   gtk_orientable_set_orientation (GTK_ORIENTABLE (table),
                                   GTK_ORIENTATION_VERTICAL);
   gtk_grid_set_row_spacing (GTK_GRID (table), 4);
diff --git a/src/glade-window.c b/src/glade-window.c
index 702e79f..e42cbfc 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -1241,8 +1241,8 @@ save (GladeWindow *window, GladeProject *project, const gchar *path)
 
          button = gtk_button_new_with_mnemonic (_("_Save Anyway"));
          gtk_button_set_image (GTK_BUTTON (button),
-                               gtk_image_new_from_stock (GTK_STOCK_SAVE,
-                                                         GTK_ICON_SIZE_BUTTON));
+                               gtk_image_new_from_icon_name ("document-save",
+                                                              GTK_ICON_SIZE_BUTTON));
          gtk_widget_show (button);
 
          gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button,
@@ -2643,8 +2643,8 @@ check_reload_project (GladeWindow *window, GladeProject *project)
 
   button = gtk_button_new_with_mnemonic (_("_Reload"));
   gtk_button_set_image (GTK_BUTTON (button),
-                        gtk_image_new_from_stock (GTK_STOCK_REFRESH,
-                                                  GTK_ICON_SIZE_BUTTON));
+                        gtk_image_new_from_icon_name ("view-refresh",
+                                                      GTK_ICON_SIZE_BUTTON));
   gtk_widget_show (button);
 
   gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]