[Xfce4-commits] [panel-plugins/xfce4-time-out-plugin] 05/15: Replace deprecated stuff

noreply at xfce.org noreply at xfce.org
Fri Oct 4 05:13:40 CEST 2019


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 panel-plugins/xfce4-time-out-plugin.

commit 5d8d85f6f0eedc2dce211cd96e89a2fb922aa520
Author: Andre Miranda <andreldm at xfce.org>
Date:   Sat Sep 28 16:36:30 2019 -0300

    Replace deprecated stuff
---
 panel-plugin/time-out-lock-screen.c | 16 +++++----
 panel-plugin/time-out.c             | 67 +++++++++++++++++++++----------------
 2 files changed, 48 insertions(+), 35 deletions(-)

diff --git a/panel-plugin/time-out-lock-screen.c b/panel-plugin/time-out-lock-screen.c
index 36dbe7f..739c43e 100644
--- a/panel-plugin/time-out-lock-screen.c
+++ b/panel-plugin/time-out-lock-screen.c
@@ -189,7 +189,7 @@ time_out_lock_screen_init (TimeOutLockScreen *lock_screen)
   gtk_widget_show (box);
 
   /* Create layout box */
-  vbox = gtk_vbox_new (FALSE, 6);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
   gtk_container_add (GTK_CONTAINER (box), vbox);
   gtk_widget_show (vbox);
@@ -199,7 +199,8 @@ time_out_lock_screen_init (TimeOutLockScreen *lock_screen)
   image = gtk_image_new_from_pixbuf (pixbuf);
   if (G_LIKELY (pixbuf != NULL))
     g_object_unref (G_OBJECT (pixbuf));
-  gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.5);
+  gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
+  gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
   gtk_container_add (GTK_CONTAINER (vbox), image);
   gtk_widget_show (image);
 
@@ -256,19 +257,22 @@ void
 time_out_lock_screen_show (TimeOutLockScreen *lock_screen, gint max_sec)
 {
   GdkScreen *screen;
+  GdkDisplay *display;
 
   g_return_if_fail (IS_TIME_OUT_LOCK_SCREEN (lock_screen));
 
   /* Handle pending events before locking the screen */
   while (gtk_events_pending())
     gtk_main_iteration ();
-  gdk_flush ();
+
+  display = gdk_display_get_default ();
+  gdk_display_flush (display);
 
   /* Create fadeout */
-  lock_screen->fadeout = time_out_fadeout_new (gdk_display_get_default ());
+  lock_screen->fadeout = time_out_fadeout_new (display);
 
   /* Push out changes */
-  gdk_flush ();
+  gdk_display_flush (display);
 
   /* Center window on target monitor */
   xfce_gtk_window_center_on_active_screen (GTK_WINDOW (lock_screen->window));
@@ -294,7 +298,7 @@ time_out_lock_screen_hide (TimeOutLockScreen *lock_screen)
   lock_screen->fadeout = NULL;
 
   /* Push out changes */
-  gdk_flush ();
+  gdk_display_flush (gdk_display_get_default ());
 
   /* Hide information window */
   gtk_widget_hide (lock_screen->window);
diff --git a/panel-plugin/time-out.c b/panel-plugin/time-out.c
index 0446fb2..f25d441 100644
--- a/panel-plugin/time-out.c
+++ b/panel-plugin/time-out.c
@@ -213,7 +213,8 @@ time_out_new (XfcePanelPlugin *plugin)
 
   /* Create label for displaying the remaining time until the next break */
   time_out->time_label = gtk_label_new (_("Inactive"));
-  gtk_misc_set_alignment (GTK_MISC (time_out->time_label), 0.5, 0.5);
+  gtk_label_set_xalign (GTK_LABEL (time_out->time_label), 0.5);
+  gtk_label_set_yalign (GTK_LABEL (time_out->time_label), 0.5);
   gtk_box_pack_start (GTK_BOX (time_out->hvbox), time_out->time_label, TRUE, TRUE, 0);
   gtk_widget_show (time_out->time_label);
 
@@ -453,7 +454,7 @@ time_out_configure (XfcePanelPlugin *plugin,
   GtkWidget *timebin;
   GtkWidget *behaviourbin;
   GtkWidget *appearancebin;
-  GtkWidget *table;
+  GtkWidget *grid;
   GtkWidget *vbox;
   GtkWidget *label;
   GtkWidget *spin;
@@ -489,37 +490,38 @@ time_out_configure (XfcePanelPlugin *plugin,
   /* Create time settings section */
   framebox = xfce_gtk_frame_box_new (_("Time settings"), &timebin);
   gtk_container_set_border_width (GTK_CONTAINER (framebox), 6);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), framebox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), framebox, TRUE, TRUE, 0);
   gtk_widget_show (framebox);
 
-  /* Create time settings table */
-  table = gtk_table_new (3, 3, FALSE);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 6);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 12);
-  gtk_container_add (GTK_CONTAINER (timebin), table);
-  gtk_widget_show (table);
+  /* Create time settings grid */
+  grid = gtk_grid_new ();
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
+  gtk_container_add (GTK_CONTAINER (timebin), grid);
+  gtk_widget_show (grid);
 
   /* Create the labels for the minutes and seconds spins */
   label = gtk_label_new (_("Minutes"));
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_SHRINK, GTK_FILL, 1.0, 0.5);
+  gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+  gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
   gtk_widget_show (label);
 
   label = gtk_label_new (_("Seconds"));
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, GTK_SHRINK, GTK_FILL, 1.0, 0.5);
+  gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+  gtk_grid_attach (GTK_GRID (grid), label, 2, 0, 1, 1);
   gtk_widget_show (label);
 
   /* Create break countdown time label */
   label = gtk_label_new (_("Time between breaks:"));
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 1.0, 0.5);
+  gtk_label_set_xalign (GTK_LABEL (label), 0);
+  gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
   gtk_widget_show (label);
 
   /* Create break countdown time minute spin */
   spin = gtk_spin_button_new_with_range (1, 24 * 60, 1);
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time_out->break_countdown_seconds / 60);
-  gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0.0, 0.5);
+  gtk_grid_attach (GTK_GRID (grid), spin, 1, 1, 1, 1);
+  gtk_widget_set_hexpand (spin, TRUE);
   gtk_widget_show (spin);
 
   /* Store reference on the spin button in the plugin */
@@ -528,7 +530,8 @@ time_out_configure (XfcePanelPlugin *plugin,
   /* Create break countdown time minute spin */
   spin = gtk_spin_button_new_with_range (0, 59, 1);
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time_out->break_countdown_seconds % 60);
-  gtk_table_attach (GTK_TABLE (table), spin, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0.0, 0.5);
+  gtk_grid_attach (GTK_GRID (grid), spin, 2, 1, 1, 1);
+  gtk_widget_set_hexpand (spin, TRUE);
   gtk_widget_show (spin);
 
   /* Store reference on the spin button in the plugin */
@@ -536,48 +539,54 @@ time_out_configure (XfcePanelPlugin *plugin,
 
   /* Create lock countdown time label */
   label = gtk_label_new (_("Break length:"));
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 1.0, 0.5);
+  gtk_label_set_xalign (GTK_LABEL (label), 0);
+  gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
   gtk_widget_show (label);
 
   /* Create lock countdown time spins */
   spin = gtk_spin_button_new_with_range (0, 24 * 60, 1);
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time_out->lock_countdown_seconds / 60);
   g_signal_connect (spin, "value-changed", G_CALLBACK (time_out_lock_countdown_minutes_changed), time_out);
-  gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0.0, 0.5);
+  gtk_grid_attach (GTK_GRID (grid), spin, 1, 2, 1, 1);
+  gtk_widget_set_hexpand (spin, TRUE);
   gtk_widget_show (spin);
+
   spin = gtk_spin_button_new_with_range (0, 59, 1);
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time_out->lock_countdown_seconds % 60);
   g_signal_connect (spin, "value-changed", G_CALLBACK (time_out_lock_countdown_seconds_changed), time_out);
-  gtk_table_attach (GTK_TABLE (table), spin, 2, 3, 2, 3, GTK_EXPAND | GTK_FILL, GTK_FILL, 0.0, 0.5);
+  gtk_grid_attach (GTK_GRID (grid), spin, 2, 2, 1, 1);
+  gtk_widget_set_hexpand (spin, TRUE);
   gtk_widget_show (spin);
 
   /* Create postpone countdown time label */
   label = gtk_label_new (_("Postpone length:"));
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 1.0, 0.5);
+  gtk_label_set_xalign (GTK_LABEL (label), 0);
+  gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
   gtk_widget_show (label);
 
   /* Create postpone countdown time spins */
   spin = gtk_spin_button_new_with_range (0, 24 * 60, 1);
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time_out->postpone_countdown_seconds / 60);
   g_signal_connect (spin, "value-changed", G_CALLBACK (time_out_postpone_countdown_minutes_changed), time_out);
-  gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0.0, 0.5);
+  gtk_grid_attach (GTK_GRID (grid), spin, 1, 3, 1, 1);
+  gtk_widget_set_hexpand (spin, TRUE);
   gtk_widget_show (spin);
+
   spin = gtk_spin_button_new_with_range (0, 59, 1);
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time_out->postpone_countdown_seconds % 60);
   g_signal_connect (spin, "value-changed", G_CALLBACK (time_out_postpone_countdown_seconds_changed), time_out);
-  gtk_table_attach (GTK_TABLE (table), spin, 2, 3, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0.0, 0.5);
+  gtk_grid_attach (GTK_GRID (grid), spin, 2, 3, 1, 1);
+  gtk_widget_set_hexpand (spin, TRUE);
   gtk_widget_show (spin);
 
   /* Create behaviour section */
   framebox = xfce_gtk_frame_box_new (_("Behaviour"), &behaviourbin);
   gtk_container_set_border_width (GTK_CONTAINER (framebox), 6);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), framebox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), framebox, TRUE, TRUE, 0);
   gtk_widget_show (framebox);
 
   /* Create behaviour box */
-  vbox = gtk_vbox_new (FALSE, 6);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_container_add (GTK_CONTAINER (behaviourbin), vbox);
   gtk_widget_show (vbox);
 
@@ -598,11 +607,11 @@ time_out_configure (XfcePanelPlugin *plugin,
   /* Create appearance section */
   framebox = xfce_gtk_frame_box_new (_("Appearance"), &appearancebin);
   gtk_container_set_border_width (GTK_CONTAINER (framebox), 6);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), framebox, TRUE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), framebox, TRUE, TRUE, 0);
   gtk_widget_show (framebox);
 
   /* Create appearance box */
-  vbox = gtk_vbox_new (FALSE, 6);
+  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
   gtk_container_add (GTK_CONTAINER (appearancebin), vbox);
   gtk_widget_show (vbox);
 

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


More information about the Xfce4-commits mailing list