summaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-02-11 07:44:06 +0100
committerWolfgang Ulbrich <[email protected]>2016-02-12 07:04:31 +0100
commit9fbaadf2b1d3cbc1a3c752f099e10fde1e086b02 (patch)
tree63476a8669e9400e1833fd875c78c318e14d9411 /applets
parent2ce33ca53bc8b56f4cab9160197df44cc36082d4 (diff)
downloadmate-panel-9fbaadf2b1d3cbc1a3c752f099e10fde1e086b02.tar.bz2
mate-panel-9fbaadf2b1d3cbc1a3c752f099e10fde1e086b02.tar.xz
GTK+3 clock: clock: don't use deprecated GtkAlignment
taken from: https://git.gnome.org/browse/gnome-panel/commit/?id=5580bf9
Diffstat (limited to 'applets')
-rw-r--r--applets/clock/calendar-window.c12
-rw-r--r--applets/clock/clock-location-tile.c39
-rw-r--r--applets/clock/clock.c27
3 files changed, 68 insertions, 10 deletions
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index 09449b44..e800f272 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -156,7 +156,9 @@ create_hig_frame (CalendarWindow *calwin,
GCallback callback)
{
GtkWidget *vbox;
+#if !GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *alignment;
+#endif
GtkWidget *label;
GtkWidget *hbox;
GtkWidget *button;
@@ -195,11 +197,17 @@ create_hig_frame (CalendarWindow *calwin,
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_container_add (GTK_CONTAINER (button), label);
- alignment = gtk_alignment_new (1, 0, 0, 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_show_all (button);
+
+ gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+#else
+ alignment = gtk_alignment_new (1, 0, 0, 0);
gtk_container_add (GTK_CONTAINER (alignment), button);
- gtk_widget_show_all (alignment);
+ gtk_widget_show_all (alignment);
gtk_container_add (GTK_CONTAINER (hbox), alignment);
+#endif
g_signal_connect_swapped (button, "clicked", callback, calwin);
}
diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c
index f759596c..48d57494 100644
--- a/applets/clock/clock-location-tile.c
+++ b/applets/clock/clock-location-tile.c
@@ -264,10 +264,14 @@ static void
clock_location_tile_fill (ClockLocationTile *this)
{
ClockLocationTilePrivate *priv = PRIVATE (this);
- GtkWidget *align;
+#if !GTK_CHECK_VERSION (3, 0, 0)
+ GtkWidget *align;
+#endif
GtkWidget *strut;
GtkWidget *box;
+#if !GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *alignment;
+#endif
GtkWidget *tile;
GtkWidget *head_section;
@@ -281,13 +285,23 @@ clock_location_tile_fill (ClockLocationTile *this)
g_signal_connect (priv->box, "leave-notify-event",
G_CALLBACK (enter_or_leave_tile), this);
+#if !GTK_CHECK_VERSION (3, 0, 0)
alignment = gtk_alignment_new (0, 0, 1, 0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 3, 3, 3, 0);
+#endif
tile = gtk_hbox_new (FALSE, 6);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_margin_top (tile, 3);
+ gtk_widget_set_margin_bottom (tile, 3);
+ gtk_widget_set_margin_start (tile, 3);
+#endif
head_section = gtk_vbox_new (FALSE, 0);
priv->city_label = gtk_label_new (NULL);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_margin_end (priv->city_label, 3);
+#endif
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (priv->city_label), 0.0);
gtk_label_set_yalign (GTK_LABEL (priv->city_label), 0.0);
@@ -295,12 +309,19 @@ clock_location_tile_fill (ClockLocationTile *this)
gtk_misc_set_alignment (GTK_MISC (priv->city_label), 0, 0);
#endif
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_box_pack_start (GTK_BOX (head_section), priv->city_label, FALSE, FALSE, 0);
+#else
align = gtk_alignment_new (0, 0, 0, 0);
gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 0, 3);
gtk_container_add (GTK_CONTAINER (align), priv->city_label);
gtk_box_pack_start (GTK_BOX (head_section), align, FALSE, FALSE, 0);
+#endif
priv->time_label = gtk_label_new (NULL);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_margin_end (priv->time_label, 3);
+#endif
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (priv->time_label), 0.0);
gtk_label_set_yalign (GTK_LABEL (priv->time_label), 0.0);
@@ -309,12 +330,20 @@ clock_location_tile_fill (ClockLocationTile *this)
#endif
priv->weather_icon = gtk_image_new ();
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_valign (priv->weather_icon, GTK_ALIGN_START);
+#else
align = gtk_alignment_new (0, 0, 0, 0);
gtk_container_add (GTK_CONTAINER (align), priv->weather_icon);
+#endif
box = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (head_section), box, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_box_pack_start (GTK_BOX (box), priv->weather_icon, FALSE, FALSE, 0);
+#else
gtk_box_pack_start (GTK_BOX (box), align, FALSE, FALSE, 0);
+#endif
gtk_box_pack_start (GTK_BOX (box), priv->time_label, FALSE, FALSE, 0);
priv->current_button = gtk_button_new ();
@@ -376,8 +405,12 @@ clock_location_tile_fill (ClockLocationTile *this)
gtk_box_pack_start (GTK_BOX (tile), priv->clock_face, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (tile), head_section, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_container_add (GTK_CONTAINER (priv->box), tile);
+#else
gtk_container_add (GTK_CONTAINER (alignment), tile);
gtk_container_add (GTK_CONTAINER (priv->box), alignment);
+#endif
gtk_container_add (GTK_CONTAINER (this), priv->box);
}
@@ -722,7 +755,11 @@ update_weather_icon (ClockLocation *loc, WeatherInfo *info, gpointer data)
if (pixbuf) {
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->weather_icon), pixbuf);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_margin_end (priv->weather_icon, 6);
+#else
gtk_alignment_set_padding (GTK_ALIGNMENT (gtk_widget_get_parent (priv->weather_icon)), 0, 0, 0, 6);
+#endif
}
}
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index cfdd29a4..4cda6089 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -140,7 +140,9 @@ struct _ClockData {
GtkListStore *cities_store;
GtkWidget *cities_section;
+#if !GTK_CHECK_VERSION (3, 0, 0)
GtkWidget *map_section;
+#endif
GtkWidget *map_widget;
/* Window to set the time */
@@ -240,13 +242,6 @@ clock_box_init (ClockBox *box)
static void
clock_box_class_init (ClockBoxClass *klass)
{
-#if GTK_CHECK_VERSION (3, 19, 0)
- GtkWidgetClass *widget_class;
-
- widget_class = GTK_WIDGET_CLASS (klass);
-
- gtk_widget_class_set_css_name (widget_class, "clock-box");
-#endif
}
/* Clock */
@@ -1224,7 +1219,11 @@ create_map_section (ClockData *cd)
ClockMap *map;
if (cd->map_widget) {
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_destroy (cd->map_widget);
+#else
gtk_widget_destroy (GTK_WIDGET (cd->map_section));
+#endif
cd->map_widget = NULL;
}
@@ -1232,9 +1231,20 @@ create_map_section (ClockData *cd)
g_signal_connect (map, "need-locations",
G_CALLBACK (map_need_locations_cb), cd);
+#if !GTK_CHECK_VERSION (3, 0, 0)
cd->map_section = gtk_alignment_new (0, 0, 1, 1);
+#endif
cd->map_widget = GTK_WIDGET (map);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_set_margin_top (cd->map_widget, 1);
+ gtk_widget_set_margin_bottom (cd->map_widget, 1);
+ gtk_widget_set_margin_start (cd->map_widget, 1);
+ gtk_widget_set_margin_end (cd->map_widget, 1);
+
+ gtk_box_pack_start (GTK_BOX (cd->clock_vbox), cd->map_widget, TRUE, TRUE, 0);
+ gtk_widget_show (cd->map_widget);
+#else
gtk_container_add (GTK_CONTAINER (cd->map_section), cd->map_widget);
gtk_alignment_set_padding (GTK_ALIGNMENT (cd->map_section), 1, 1, 1, 1);
@@ -1242,6 +1252,7 @@ create_map_section (ClockData *cd)
gtk_box_pack_start (GTK_BOX (cd->clock_vbox), cd->map_section, FALSE, FALSE, 0);
gtk_widget_show (cd->map_widget);
gtk_widget_show (cd->map_section);
+#endif
}
static void
@@ -1252,7 +1263,9 @@ update_calendar_popup (ClockData *cd)
gtk_widget_destroy (cd->calendar_popup);
cd->calendar_popup = NULL;
cd->cities_section = NULL;
+#if !GTK_CHECK_VERSION (3, 0, 0)
cd->map_section = NULL;
+#endif
cd->map_widget = NULL;
cd->clock_vbox = NULL;