[libpeas] Fix various deprecation warning from GTK+



commit 97faa9e3ee5c5b69a101ab9c39d3a92f701cbad2
Author: Garrett Regier <garrettregier gmail com>
Date:   Sat Jun 28 14:19:33 2014 -0700

    Fix various deprecation warning from GTK+

 configure.ac                                  |    2 +-
 libpeas-gtk/peas-gtk-disable-plugins-dialog.c |    2 +-
 libpeas-gtk/peas-gtk-plugin-manager-store.c   |    2 ++
 libpeas-gtk/peas-gtk-plugin-manager-view.c    |    1 -
 libpeas-gtk/peas-gtk-plugin-manager.c         |   25 +++++++++----------------
 peas-demo/peas-demo.c                         |    4 +---
 tests/libpeas-gtk/plugin-manager.c            |   24 +++++-------------------
 tests/libpeas-gtk/testing/testing.c           |    2 --
 8 files changed, 19 insertions(+), 43 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d81f8b9..69823e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,7 +84,7 @@ dnl ================================================================
 PKG_PROG_PKG_CONFIG
 
 GLIB_REQUIRED=2.30.0
-GIO_REQUIRED=2.31.2
+GIO_REQUIRED=2.32.0
 INTROSPECTION_REQUIRED=1.39.0
 
 PKG_CHECK_MODULES(PEAS, [
diff --git a/libpeas-gtk/peas-gtk-disable-plugins-dialog.c b/libpeas-gtk/peas-gtk-disable-plugins-dialog.c
index d8afab4..4040394 100644
--- a/libpeas-gtk/peas-gtk-disable-plugins-dialog.c
+++ b/libpeas-gtk/peas-gtk-disable-plugins-dialog.c
@@ -178,7 +178,7 @@ peas_gtk_disable_plugins_dialog_init (PeasGtkDisablePluginsDialog *dialog)
   gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 
   gtk_dialog_add_button (GTK_DIALOG (dialog),
-                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+                         _("_Cancel"), GTK_RESPONSE_CANCEL);
   gtk_dialog_add_button (GTK_DIALOG (dialog),
                          _("Disable Plugins"), GTK_RESPONSE_OK);
 }
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-store.c b/libpeas-gtk/peas-gtk-plugin-manager-store.c
index cd88c44..1a91cdc 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-store.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-store.c
@@ -136,6 +136,7 @@ update_plugin (PeasGtkPluginManagerStore *store,
 
               g_clear_object (&icon_gicon);
 
+              G_GNUC_BEGIN_IGNORE_DEPRECATIONS
               if (gtk_stock_lookup (icon_name, &stock_item))
                 {
                   icon_stock_id = icon_name;
@@ -144,6 +145,7 @@ update_plugin (PeasGtkPluginManagerStore *store,
                 {
                   icon_gicon = g_themed_icon_new ("libpeas-plugin");
                 }
+              G_GNUC_END_IGNORE_DEPRECATIONS
             }
         }
 
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-view.c b/libpeas-gtk/peas-gtk-plugin-manager-view.c
index 94f82bd..988a0ba 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-view.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-view.c
@@ -502,7 +502,6 @@ peas_gtk_plugin_manager_view_init (PeasGtkPluginManagerView *view)
 
   gtk_widget_set_has_tooltip (GTK_WIDGET (view), TRUE);
 
-  gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
   gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
 
   /* first column */
diff --git a/libpeas-gtk/peas-gtk-plugin-manager.c b/libpeas-gtk/peas-gtk-plugin-manager.c
index 36221f1..f6df5f1 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager.c
@@ -180,7 +180,8 @@ help_button_cb (GtkWidget      *button,
 
   toplevel = GTK_WINDOW (gtk_widget_get_toplevel (button));
   error_dlg = gtk_message_dialog_new (toplevel,
-                                      0,
+                                      GTK_DIALOG_MODAL |
+                                      GTK_DIALOG_DESTROY_WITH_PARENT,
                                       GTK_MESSAGE_ERROR,
                                       GTK_BUTTONS_CLOSE,
                                       _("There was an error displaying the help."));
@@ -203,8 +204,6 @@ help_button_cb (GtkWidget      *button,
     }
 
   gtk_window_group_add_window (wg, GTK_WINDOW (error_dlg));
-
-  gtk_window_set_modal (GTK_WINDOW (error_dlg), TRUE);
   gtk_widget_show_all (error_dlg);
 
   g_error_free (error);
@@ -240,8 +239,9 @@ show_configure_cb (GtkWidget            *widget,
 
   conf_dlg = gtk_dialog_new_with_buttons (peas_plugin_info_get_name (info),
                                           toplevel,
-                                          0,
-                                          GTK_STOCK_CLOSE,
+                                          GTK_DIALOG_MODAL |
+                                          GTK_DIALOG_DESTROY_WITH_PARENT,
+                                          _("_Close"),
                                           GTK_RESPONSE_CLOSE,
                                           NULL);
 
@@ -250,14 +250,10 @@ show_configure_cb (GtkWidget            *widget,
 
   if (peas_plugin_info_get_help_uri (info) != NULL)
     {
-      GtkWidget *hbuttonbox;
       GtkWidget *help_button;
 
-      hbuttonbox = gtk_dialog_get_action_area (GTK_DIALOG (conf_dlg));
-      help_button = gtk_button_new_from_stock (GTK_STOCK_HELP);
-      gtk_container_add (GTK_CONTAINER (hbuttonbox), help_button);
-      gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (hbuttonbox),
-                                          help_button, TRUE);
+      help_button = gtk_dialog_add_button (GTK_DIALOG (conf_dlg),
+                                           _("_Help"), GTK_RESPONSE_HELP);
 
       g_signal_connect (help_button,
                         "clicked",
@@ -276,9 +272,6 @@ show_configure_cb (GtkWidget            *widget,
     }
 
   gtk_window_group_add_window (wg, GTK_WINDOW (conf_dlg));
-
-  gtk_window_set_transient_for (GTK_WINDOW (conf_dlg), toplevel);
-  gtk_window_set_modal (GTK_WINDOW (conf_dlg), TRUE);
   gtk_widget_show_all (conf_dlg);
 
   g_signal_connect (conf_dlg,
@@ -327,12 +320,12 @@ populate_popup_cb (PeasGtkPluginManagerView *view,
   if (info == NULL)
     return;
 
-  item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PREFERENCES, NULL);
+  item = gtk_check_menu_item_new_with_mnemonic (_("Pr_eferences"));
   g_signal_connect (item, "activate", G_CALLBACK (show_configure_cb), pm);
   gtk_widget_set_sensitive (item, plugin_is_configurable (pm, info));
   gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
 
-  item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ABOUT, NULL);
+  item = gtk_check_menu_item_new_with_mnemonic (_("_About"));
   g_signal_connect (item, "activate", G_CALLBACK (show_about_cb), pm);
   gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item);
 }
diff --git a/peas-demo/peas-demo.c b/peas-demo/peas-demo.c
index c0c0bca..7220fa7 100644
--- a/peas-demo/peas-demo.c
+++ b/peas-demo/peas-demo.c
@@ -65,8 +65,6 @@ create_main_window (void)
   gtk_container_set_border_width (GTK_CONTAINER (window), 6);
   gtk_window_set_title (GTK_WINDOW (window), "Peas Demo");
 
-  gtk_window_set_has_resize_grip (GTK_WINDOW (window), FALSE);
-
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_container_add (GTK_CONTAINER (window), box);
 
@@ -82,7 +80,7 @@ create_main_window (void)
   g_signal_connect (button, "clicked", G_CALLBACK (create_new_window), NULL);
   gtk_container_add (GTK_CONTAINER (button_box), button);
 
-  button = gtk_button_new_from_stock (GTK_STOCK_QUIT);
+  button = gtk_button_new_with_mnemonic (_("_Quit"));
   g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL);
   gtk_container_add (GTK_CONTAINER (button_box), button);
 
diff --git a/tests/libpeas-gtk/plugin-manager.c b/tests/libpeas-gtk/plugin-manager.c
index 77c35e1..d3188ac 100644
--- a/tests/libpeas-gtk/plugin-manager.c
+++ b/tests/libpeas-gtk/plugin-manager.c
@@ -363,7 +363,6 @@ test_gtk_plugin_manager_configure_dialog (TestFixture *fixture)
   GList *list_it;
   GtkWidget *content;
   GtkWidget *label = NULL;
-  GtkWidget *button_box;
   GtkWidget *close_button = NULL;
   GtkWidget *help_button = NULL;
 
@@ -399,26 +398,13 @@ test_gtk_plugin_manager_configure_dialog (TestFixture *fixture)
   g_list_free (list);
 
 
-  button_box = gtk_dialog_get_action_area (GTK_DIALOG (window));
-  list = gtk_container_get_children (GTK_CONTAINER (button_box));
-
-  for (list_it = list; list_it != NULL; list_it = list_it->next)
-    {
-      if (GTK_IS_BUTTON (list_it->data))
-        {
-          const gchar *text = gtk_button_get_label (GTK_BUTTON (list_it->data));
-
-          if (g_strcmp0 (text, GTK_STOCK_CLOSE) == 0)
-            close_button = GTK_WIDGET (list_it->data);
-          else if (g_strcmp0 (text, GTK_STOCK_HELP) == 0)
-            help_button = GTK_WIDGET (list_it->data);
-        }
-    }
-
+  close_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (window),
+                                                     GTK_RESPONSE_CLOSE);
   g_assert (close_button != NULL);
-  g_assert (help_button != NULL);
 
-  g_list_free (list);
+  help_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (window),
+                                                    GTK_RESPONSE_HELP);
+  g_assert (help_button != NULL);
 
   gtk_widget_destroy (window);
 }
diff --git a/tests/libpeas-gtk/testing/testing.c b/tests/libpeas-gtk/testing/testing.c
index a3a070e..8f40ead 100644
--- a/tests/libpeas-gtk/testing/testing.c
+++ b/tests/libpeas-gtk/testing/testing.c
@@ -152,8 +152,6 @@ testing_show_widget (gpointer widget)
 
   gtk_window_set_default_size (GTK_WINDOW (window), 200, 100);
 
-  gtk_window_set_has_resize_grip (GTK_WINDOW (window), FALSE);
-
   gtk_widget_show_all (window);
 
   g_signal_connect (window,


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