[Xfce4-commits] [apps/xfce4-screenshooter] 08/38: Stop poking at widget internals, use accessors

noreply at xfce.org noreply at xfce.org
Fri Apr 28 03:07:04 CEST 2017


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

andre pushed a commit to branch master
in repository apps/xfce4-screenshooter.

commit ababb76548bfea22611f48ca8d9b7a49361e6559
Author: Andre Miranda <andre42m at gmail.com>
Date:   Sun Feb 12 16:17:29 2017 -0300

    Stop poking at widget internals, use accessors
---
 lib/screenshooter-capture.c         | 10 +++++-----
 lib/screenshooter-dialogs.c         | 16 ++++++++--------
 lib/screenshooter-job-callbacks.c   | 20 ++++++++++----------
 panel-plugin/screenshooter-plugin.c |  4 ++--
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/lib/screenshooter-capture.c b/lib/screenshooter-capture.c
index 0bc5ad0..475ebf2 100644
--- a/lib/screenshooter-capture.c
+++ b/lib/screenshooter-capture.c
@@ -728,20 +728,20 @@ static GdkPixbuf
   /* This window is not managed by the window manager, we have to set everything
    * ourselves */
   gtk_widget_realize (window);
-  gdk_window_set_cursor (window->window, xhair_cursor);
-  gdk_window_set_override_redirect (window->window, TRUE);
+  gdk_window_set_cursor (gtk_widget_get_window (window), xhair_cursor);
+  gdk_window_set_override_redirect (gtk_widget_get_window (window), TRUE);
   gtk_widget_set_size_request (window,
                                gdk_screen_get_width (gdk_screen_get_default ()),
                                gdk_screen_get_height (gdk_screen_get_default ()));
-  gdk_window_raise (window->window);
+  gdk_window_raise (gtk_widget_get_window (window));
   gtk_widget_show_now (window);
   gtk_widget_grab_focus (window);
   gdk_flush ();
 
   /* Grab the mouse and the keyboard to prevent any interaction with other
    * applications */
-  gdk_keyboard_grab (window->window, FALSE, GDK_CURRENT_TIME);
-  gdk_pointer_grab (window->window, TRUE, 0, NULL,
+  gdk_keyboard_grab (gtk_widget_get_window (window), FALSE, GDK_CURRENT_TIME);
+  gdk_pointer_grab (gtk_widget_get_window (window), TRUE, 0, NULL,
                     NULL, GDK_CURRENT_TIME);
 
   gtk_dialog_run (GTK_DIALOG (window));
diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index 4b9ba1d..827d4ff 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -567,27 +567,27 @@ save_screenshot_to_remote_location (GdkPixbuf *screenshot, GFile *save_file)
   gtk_window_set_deletable (GTK_WINDOW (dialog), FALSE);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 20);
   gtk_window_set_icon_name (GTK_WINDOW (dialog), "document-save");
-  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG(dialog)->vbox), 12);
+  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 12);
 
   gtk_label_set_markup (GTK_LABEL (label1),
                         _("<span weight=\"bold\" stretch=\"semiexpanded\">The screenshot "
                           "is being transferred to:</span>"));
   gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox),
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                       label1,
                       FALSE,
                       FALSE,
                       0);
   gtk_widget_show (label1);
 
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox),
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                       label2,
                       FALSE,
                       FALSE,
                       0);
   gtk_widget_show (label2);
 
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox),
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                       progress_bar,
                       FALSE,
                       FALSE,
@@ -730,7 +730,7 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin)
   /* Create the main alignment for the dialog */
   main_alignment = gtk_alignment_new (0, 0, 1, 1);
   gtk_alignment_set_padding (GTK_ALIGNMENT (main_alignment), 6, 0, 12, 12);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), main_alignment, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), main_alignment, TRUE, TRUE, 0);
 
   /* Create the main box for the dialog */
   vbox = gtk_vbox_new (FALSE, 10);
@@ -865,7 +865,7 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin)
   g_signal_connect (G_OBJECT (delay_spinner), "value-changed",
                     G_CALLBACK (cb_delay_spinner_changed), sd);
 
-  gtk_widget_show_all (GTK_DIALOG (dlg)->vbox);
+  gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dlg)));
 
   return dlg;
 }
@@ -915,7 +915,7 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
   /* Create the main alignment for the dialog */
   main_alignment = gtk_alignment_new (0, 0, 1, 1);
   gtk_alignment_set_padding (GTK_ALIGNMENT (main_alignment), 6, 0, 12, 12);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), main_alignment, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), main_alignment, TRUE, TRUE, 0);
 
   /* Create the main box for the dialog */
   vbox = gtk_vbox_new (FALSE, 10);
@@ -1066,7 +1066,7 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
   g_signal_connect (preview_ebox, "drag-data-get", G_CALLBACK (preview_drag_data_get), sd->screenshot);
   g_signal_connect (preview_ebox, "drag-end", G_CALLBACK (preview_drag_end), dlg);
 
-  gtk_widget_show_all (GTK_DIALOG (dlg)->vbox);
+  gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dlg)));
 
   return dlg;
 }
diff --git a/lib/screenshooter-job-callbacks.c b/lib/screenshooter-job-callbacks.c
index 7b88377..89be627 100644
--- a/lib/screenshooter-job-callbacks.c
+++ b/lib/screenshooter-job-callbacks.c
@@ -38,14 +38,14 @@ create_throbber_dialog             (const gchar        *title,
                                  NULL);
 
   gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 0);
+  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 0);
   gtk_window_set_deletable (GTK_WINDOW (dialog), FALSE);
   gtk_window_set_icon_name (GTK_WINDOW (dialog), "gtk-info");
 
   /* Create the main alignment for the dialog */
   main_alignment = gtk_alignment_new (0, 0, 1, 1);
   gtk_alignment_set_padding (GTK_ALIGNMENT (main_alignment), 0, 0, 6, 6);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_alignment, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_alignment, TRUE, TRUE, 0);
 
   /* Create the main box for the dialog */
   main_box = gtk_vbox_new (FALSE, 10);
@@ -75,7 +75,7 @@ create_throbber_dialog             (const gchar        *title,
   *label = gtk_label_new ("");
   gtk_container_add (GTK_CONTAINER (main_box), *label);
 
-  gtk_widget_show_all (GTK_DIALOG(dialog)->vbox);
+  gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
   return dialog;
 }
 
@@ -171,7 +171,7 @@ cb_ask_for_information (ScreenshooterJob *job,
                                          NULL);
 
   gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG(dialog)->vbox), 12);
+  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 12);
 
   gtk_window_set_icon_name (GTK_WINDOW (dialog), "gtk-info");
   gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
@@ -181,7 +181,7 @@ cb_ask_for_information (ScreenshooterJob *job,
   /* Create the main alignment for the dialog */
   main_alignment = gtk_alignment_new (0, 0, 1, 1);
   gtk_alignment_set_padding (GTK_ALIGNMENT (main_alignment), 6, 0, 12, 12);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_alignment, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_alignment, TRUE, TRUE, 0);
 
   /* Create the main box for the dialog */
   vbox = gtk_vbox_new (FALSE, 10);
@@ -300,7 +300,7 @@ cb_ask_for_information (ScreenshooterJob *job,
     }
   while (gtk_tree_model_iter_next (GTK_TREE_MODEL (liststore), &iter));
 
-  gtk_widget_show_all (GTK_DIALOG(dialog)->vbox);
+  gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
   response = gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_hide (dialog);
 
@@ -419,15 +419,15 @@ void cb_image_uploaded (ScreenshooterJob  *job,
                                          NULL);
 
   gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-  gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
-  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 12);
+  gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 0);
+  gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 12);
   gtk_window_set_icon_name (GTK_WINDOW (dialog), "applications-internet");
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 
   /* Create the main alignment for the dialog */
   main_alignment = gtk_alignment_new (0, 0, 1, 1);
   gtk_alignment_set_padding (GTK_ALIGNMENT (main_alignment), 6, 0, 10, 10);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_alignment, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), main_alignment, TRUE, TRUE, 0);
 
   /* Create the main box for the dialog */
   vbox = gtk_vbox_new (FALSE, 10);
@@ -536,7 +536,7 @@ void cb_image_uploaded (ScreenshooterJob  *job,
   gtk_container_add (GTK_CONTAINER (bb_frame), bb_code_view);
 
   /* Show the dialog and run it */
-  gtk_widget_show_all (GTK_DIALOG(dialog)->vbox);
+  gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
   gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_destroy (dialog);
 
diff --git a/panel-plugin/screenshooter-plugin.c b/panel-plugin/screenshooter-plugin.c
index bb08dc4..af2726f 100644
--- a/panel-plugin/screenshooter-plugin.c
+++ b/panel-plugin/screenshooter-plugin.c
@@ -122,8 +122,8 @@ cb_set_size (XfcePanelPlugin *plugin, int size, PluginData *pd)
   size /= xfce_panel_plugin_get_nrows (plugin);
 #endif
 
-  width = size - 2 - 2 * MAX (pd->button->style->xthickness,
-                                    pd->button->style->ythickness);
+  width = size - 2 - 2 * MAX (gtk_widget_get_style(pd->button)->xthickness,
+                              gtk_widget_get_style(pd->button)->ythickness);
 
   TRACE ("Get the icon from the theme");
   pb = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),

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


More information about the Xfce4-commits mailing list