summaryrefslogtreecommitdiff
path: root/timerapplet/timerapplet.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-11-22 17:47:06 +0300
committermonsta <[email protected]>2016-11-22 17:47:06 +0300
commitf7acf55db3ab4b97d60faae24555a07b6b08d43c (patch)
tree6feb99e63f801161642669b01c9ce0c217e60d0b /timerapplet/timerapplet.c
parent45354a60352e05eba7e66e24a171e713876d71e9 (diff)
downloadmate-applets-f7acf55db3ab4b97d60faae24555a07b6b08d43c.tar.bz2
mate-applets-f7acf55db3ab4b97d60faae24555a07b6b08d43c.tar.xz
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require mate-panel >= 1.17 WARNING: use GTK+3 build of libmateweather for this build. that lib is not migrated to GTK+3 only as we will possibly use libgweather instead of it.
Diffstat (limited to 'timerapplet/timerapplet.c')
-rw-r--r--timerapplet/timerapplet.c78
1 files changed, 1 insertions, 77 deletions
diff --git a/timerapplet/timerapplet.c b/timerapplet/timerapplet.c
index 86e0dbda..ebcb5e36 100644
--- a/timerapplet/timerapplet.c
+++ b/timerapplet/timerapplet.c
@@ -45,10 +45,6 @@
#define SHOW_NOTIFICATION_KEY "show-notification"
#define SHOW_DIALOG_KEY "show-dialog"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
typedef struct
{
MatePanelApplet *applet;
@@ -284,11 +280,7 @@ static void
timer_preferences_callback (GtkAction *action, TimerApplet *applet)
{
GtkDialog *dialog;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkGrid *grid;
-#else
- GtkTable *table;
-#endif
GtkWidget *widget;
gint duration, hours, minutes, seconds;
@@ -303,15 +295,9 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet)
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE,
NULL));
-#if GTK_CHECK_VERSION (3, 0, 0)
grid = GTK_GRID (gtk_grid_new ());
gtk_grid_set_row_spacing (grid, 12);
gtk_grid_set_column_spacing (grid, 12);
-#else
- table = GTK_TABLE (gtk_table_new (6, 2, FALSE));
- gtk_table_set_row_spacings (table, 12);
- gtk_table_set_col_spacings (table, 12);
-#endif
gtk_window_set_default_size (GTK_WINDOW (dialog), 350, 150);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 10);
@@ -323,21 +309,10 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet)
#else
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (grid, widget, 1, 0, 1, 1);
widget = gtk_entry_new ();
gtk_grid_attach (grid, widget, 2, 0, 1, 1);
-#else
- gtk_table_attach (table, widget, 1, 2, 0, 1,
- GTK_FILL, GTK_FILL,
- 0, 0);
-
- widget = gtk_entry_new ();
- gtk_table_attach (table, widget, 2, 3, 0, 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL,
- 0, 0);
-#endif
g_settings_bind (applet->settings, NAME_KEY, widget, "text", G_SETTINGS_BIND_DEFAULT);
widget = gtk_label_new (_("Hours:"));
@@ -347,23 +322,11 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet)
#else
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (grid, widget, 1, 1, 1, 1);
widget = gtk_spin_button_new_with_range (0.0, 100.0, 1.0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), hours);
gtk_grid_attach (grid, widget, 2, 1, 1, 1);
-#else
- gtk_table_attach (table, widget, 1, 2, 1, 2,
- GTK_FILL, GTK_FILL,
- 0, 0);
-
- widget = gtk_spin_button_new_with_range (0.0, 100.0, 1.0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), hours);
- gtk_table_attach (table, widget, 2, 3, 1, 2,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL,
- 0, 0);
-#endif
applet->hours = GTK_SPIN_BUTTON (widget);
g_signal_connect (widget, "value-changed", G_CALLBACK (timer_spin_button_value_changed), applet);
@@ -374,23 +337,11 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet)
#else
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (grid, widget, 1, 2, 1, 1);
widget = gtk_spin_button_new_with_range (0.0, 59.0, 1.0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), minutes);
gtk_grid_attach (grid, widget, 2, 2, 1, 1);;
-#else
- gtk_table_attach (table, widget, 1, 2, 2, 3,
- GTK_FILL, GTK_FILL,
- 0, 0);
-
- widget = gtk_spin_button_new_with_range (0.0, 59.0, 1.0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), minutes);
- gtk_table_attach (table, widget, 2, 3, 2, 3,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL,
- 0, 0);
-#endif
applet->minutes = GTK_SPIN_BUTTON (widget);
g_signal_connect (widget, "value-changed", G_CALLBACK (timer_spin_button_value_changed), applet);
@@ -401,28 +352,15 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet)
#else
gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (grid, widget, 1, 3, 1, 1);
widget = gtk_spin_button_new_with_range (0.0, 59.0, 1.0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), seconds);
gtk_grid_attach (grid, widget, 2, 3, 1, 1);
-#else
- gtk_table_attach (table, widget, 1, 2, 3, 4,
- GTK_FILL, GTK_FILL,
- 0, 0);
-
- widget = gtk_spin_button_new_with_range (0.0, 59.0, 1.0);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), seconds);
- gtk_table_attach (table, widget, 2, 3, 3, 4,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL,
- 0, 0);
-#endif
applet->seconds = GTK_SPIN_BUTTON (widget);
g_signal_connect (widget, "value-changed", G_CALLBACK (timer_spin_button_value_changed), applet);
widget = gtk_check_button_new_with_label (_("Show notification popup"));
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach (grid, widget, 2, 4, 1, 1);
g_settings_bind (applet->settings, SHOW_NOTIFICATION_KEY, widget, "active", G_SETTINGS_BIND_DEFAULT);
@@ -431,20 +369,6 @@ timer_preferences_callback (GtkAction *action, TimerApplet *applet)
g_settings_bind (applet->settings, SHOW_DIALOG_KEY, widget, "active", G_SETTINGS_BIND_DEFAULT);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (grid), TRUE, TRUE, 0);
-#else
- gtk_table_attach (table, widget, 2, 3, 4, 5,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL,
- 0, 0);
- g_settings_bind (applet->settings, SHOW_NOTIFICATION_KEY, widget, "active", G_SETTINGS_BIND_DEFAULT);
-
- widget = gtk_check_button_new_with_label (_("Show dialog"));
- gtk_table_attach (table, widget, 2, 3, 5, 6,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, GTK_FILL,
- 0, 0);
- g_settings_bind (applet->settings, SHOW_DIALOG_KEY, widget, "active", G_SETTINGS_BIND_DEFAULT);
-
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (table), TRUE, TRUE, 0);
-#endif
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
@@ -478,7 +402,7 @@ timer_applet_fill (MatePanelApplet* applet_widget)
applet->active = FALSE;
applet->pause = FALSE;
- applet->box = GTK_BOX (gtk_hbox_new (FALSE, 0));
+ applet->box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
applet->image = GTK_IMAGE (gtk_image_new_from_icon_name (APPLET_ICON, GTK_ICON_SIZE_BUTTON));
applet->pause_image = GTK_IMAGE (gtk_image_new_from_icon_name (GTK_STOCK_MEDIA_PAUSE, GTK_ICON_SIZE_BUTTON));
applet->label = GTK_LABEL (gtk_label_new (""));