[Xfce4-commits] [xfce/thunar-volman] 10/11: Handle the remaining deprecations

noreply at xfce.org noreply at xfce.org
Sat Sep 9 16:05:00 CEST 2017


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/thunar-volman.

commit c6a72b70d015a28fab00f71e760164893f7c87cf
Author: Andre Miranda <andre42m at gmail.com>
Date:   Fri Sep 8 22:05:57 2017 -0300

    Handle the remaining deprecations
---
 thunar-volman-settings/main.c                   |  4 +-
 thunar-volman-settings/tvm-command-entry.c      | 11 ++--
 thunar-volman-settings/tvm-command-entry.h      |  4 +-
 thunar-volman-settings/tvm-preferences-dialog.c | 71 +++++++++++++++----------
 thunar-volman/tvm-prompt.c                      | 10 ++--
 5 files changed, 58 insertions(+), 42 deletions(-)

diff --git a/thunar-volman-settings/main.c b/thunar-volman-settings/main.c
index dc271ba..f5e85be 100644
--- a/thunar-volman-settings/main.c
+++ b/thunar-volman-settings/main.c
@@ -80,7 +80,9 @@ main (int    argc,
 
   /* display the dialog */
   dialog = tvm_preferences_dialog_new ();
-  gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_show (dialog);
+  gtk_main ();
+
   gtk_widget_destroy (dialog);
 
   /* free xfconf resources */
diff --git a/thunar-volman-settings/tvm-command-entry.c b/thunar-volman-settings/tvm-command-entry.c
index 62ea3ed..519da40 100644
--- a/thunar-volman-settings/tvm-command-entry.c
+++ b/thunar-volman-settings/tvm-command-entry.c
@@ -89,7 +89,7 @@ tvm_command_entry_get_type (void)
         NULL,
       };
 
-      type = g_type_register_static (GTK_TYPE_HBOX, I_("TvmCommandEntry"), &info, 0);
+      type = g_type_register_static (GTK_TYPE_BOX, I_("TvmCommandEntry"), &info, 0);
     }
 
   return type;
@@ -130,16 +130,13 @@ static void
 tvm_command_entry_init (TvmCommandEntry *command_entry)
 {
   GtkWidget *button;
-  GtkWidget *align;
   GtkWidget *image;
 
   gtk_box_set_spacing (GTK_BOX (command_entry), 2);
+  gtk_orientable_set_orientation (GTK_ORIENTABLE (command_entry), GTK_ORIENTATION_HORIZONTAL);
 
-  align = g_object_new (GTK_TYPE_ALIGNMENT, "width-request", 10, NULL);
-  gtk_box_pack_start (GTK_BOX (command_entry), align, FALSE, FALSE, 0);
-  gtk_widget_show (align);
-
-  command_entry->label = g_object_new (GTK_TYPE_LABEL, "use-underline", TRUE, "xalign", 0.0f, NULL);
+  command_entry->label = g_object_new (GTK_TYPE_LABEL, "use-underline", TRUE,
+                                       "xalign", 0.0f, "margin-left", 12, NULL);
   gtk_box_pack_start (GTK_BOX (command_entry), command_entry->label, FALSE, FALSE, 10);
   gtk_widget_show (command_entry->label);
 
diff --git a/thunar-volman-settings/tvm-command-entry.h b/thunar-volman-settings/tvm-command-entry.h
index 7d1be68..ead2c1d 100644
--- a/thunar-volman-settings/tvm-command-entry.h
+++ b/thunar-volman-settings/tvm-command-entry.h
@@ -37,12 +37,12 @@ typedef struct _TvmCommandEntry      TvmCommandEntry;
 
 struct _TvmCommandEntryClass
 {
-  GtkHBoxClass __parent__;
+  GtkBoxClass __parent__;
 };
 
 struct _TvmCommandEntry
 {
-  GtkHBox    __parent__;
+  GtkBox    __parent__;
   GtkWidget *entry;
   GtkWidget *label;
   gchar     *command;
diff --git a/thunar-volman-settings/tvm-preferences-dialog.c b/thunar-volman-settings/tvm-preferences-dialog.c
index f94a8e7..f3bae79 100644
--- a/thunar-volman-settings/tvm-preferences-dialog.c
+++ b/thunar-volman-settings/tvm-preferences-dialog.c
@@ -45,8 +45,8 @@ enum
 
 
 
-static void tvm_preferences_dialog_help_clicked (GtkWidget            *button,
-                                                 TvmPreferencesDialog *dialog);
+static void tvm_preferences_dialog_response (GtkWidget *dialog,
+                                             gint response_id);
 
 
 
@@ -103,20 +103,19 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
                                    _("Configure management of removable drives "
                                      "and media"));
 
+  g_signal_connect (dialog, "response", G_CALLBACK (tvm_preferences_dialog_response), NULL);
+
   /* add "Help" button */
   button = gtk_button_new_from_icon_name ("help-browser", GTK_ICON_SIZE_BUTTON);
-  g_signal_connect (G_OBJECT (button), "clicked", 
-                    G_CALLBACK (tvm_preferences_dialog_help_clicked), dialog);
-  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), button, 
-                      FALSE, FALSE, 0);
-  gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))),
-                                      button, TRUE);
+  gtk_button_set_label (GTK_BUTTON (button), _("Help"));
+  gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_HELP);
   gtk_widget_show (button);
 
   /* add "Close" button */
-  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                          "window-close", GTK_RESPONSE_CLOSE,
-                          NULL);
+  button = gtk_button_new_from_icon_name ("window-close", GTK_ICON_SIZE_BUTTON);
+  gtk_button_set_label (GTK_BUTTON (button), _("Close"));
+  gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CLOSE);
+  gtk_widget_show (button);
 
   notebook = gtk_notebook_new ();
   gtk_container_set_border_width (GTK_CONTAINER (notebook), 6);
@@ -150,7 +149,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("drive-removable-media", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -205,7 +205,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("tvm-burn-cd", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -267,7 +268,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("media-optical", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -303,7 +305,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("drive-optical", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -340,7 +343,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("multimedia-player", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -385,7 +389,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("camera-photo", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -434,7 +439,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("pda", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -471,7 +477,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("tvm-dev-pocketpc", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -517,7 +524,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("printer", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -563,7 +571,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("input-keyboard", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -600,7 +609,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("input-mouse", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -637,7 +647,8 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
   gtk_widget_show (grid);
 
   image = gtk_image_new_from_icon_name ("input-tablet", GTK_ICON_SIZE_DIALOG);
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_START);
   gtk_grid_attach (GTK_GRID (grid), image, 0, 0, 1, 3);
   gtk_widget_show (image);
 
@@ -660,19 +671,23 @@ tvm_preferences_dialog_init (TvmPreferencesDialog *dialog)
 
 
 static void
-tvm_preferences_dialog_help_clicked (GtkWidget            *button,
-                                     TvmPreferencesDialog *dialog)
+tvm_preferences_dialog_response (GtkWidget *dialog,
+                                 gint response_id)
 {
-  g_return_if_fail (GTK_IS_BUTTON (button));
   g_return_if_fail (TVM_IS_PREFERENCES_DIALOG (dialog));
 
+  if (response_id != GTK_RESPONSE_HELP)
+    {
+      gtk_main_quit ();
+      return;
+    }
+
 #if LIBXFCE4UI_CHECK_VERSION(4, 11, 1)
   xfce_dialog_show_help_with_version (GTK_WINDOW (dialog), "thunar",
                                       "using-removable-media", NULL,
                                       TVM_VERSION_HELP);
 #else
-  xfce_dialog_show_help (GTK_WINDOW (dialog), "thunar",
-                         "using-removable-media", NULL);
+  xfce_dialog_show_help (GTK_WINDOW (dialog), "thunar", "using-removable-media", NULL);
 #endif
 }
 
diff --git a/thunar-volman/tvm-prompt.c b/thunar-volman/tvm-prompt.c
index f2d9b00..65b02bd 100644
--- a/thunar-volman/tvm-prompt.c
+++ b/thunar-volman/tvm-prompt.c
@@ -99,7 +99,6 @@ tvm_prompt (TvmContext  *context,
   g_object_set_data_full (G_OBJECT (dialog), "device", g_object_ref (context->device), 
                           g_object_unref);
   gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 6);
-  gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), 12);
 
   /* apply the specified title */
   if (title != NULL && *title != '\0')
@@ -134,7 +133,8 @@ tvm_prompt (TvmContext  *context,
 
       /* setup an image for the icon */
       image = gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_DIALOG);
-      gtk_misc_set_alignment (GTK_MISC (image), 0.0f, 0.0f);
+      gtk_widget_set_halign (image, GTK_ALIGN_START);
+      gtk_widget_set_valign (image, GTK_ALIGN_START);
       gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
       gtk_widget_show (image);
     }
@@ -147,7 +147,8 @@ tvm_prompt (TvmContext  *context,
   /* setup the primary text */
   label = gtk_label_new (primary_text);
   gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
+  gtk_label_set_yalign (GTK_LABEL (label), 0.5f);
   gtk_label_set_attributes (GTK_LABEL (label), tvm_pango_attr_list_big_bold ());
   gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
   gtk_widget_show (label);
@@ -157,7 +158,8 @@ tvm_prompt (TvmContext  *context,
     {
       label = gtk_label_new (secondary_text);
       gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-      gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+      gtk_label_set_xalign (GTK_LABEL (label), 0.0f);
+      gtk_label_set_yalign (GTK_LABEL (label), 0.5f);
       gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
       gtk_widget_show (label);
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list