[gnome-panel] clock: don't use deprecated GtkAlignment



commit 5580bf9fb773da207ae8c029ee68c7017848e327
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Nov 3 22:27:47 2014 +0200

    clock: don't use deprecated GtkAlignment

 applets/clock/calendar-window.c     |    7 ++-----
 applets/clock/clock-location-tile.c |   26 +++++++++++---------------
 applets/clock/clock.c               |   15 ++++++---------
 3 files changed, 19 insertions(+), 29 deletions(-)
---
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index 2cdbf4d..e2dd233 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -1499,7 +1499,6 @@ create_hig_frame (CalendarWindow *calwin,
                  gboolean    bind_to_locked_down)
 {
         GtkWidget *vbox;
-        GtkWidget *alignment;
         GtkWidget *label;
         GtkWidget *hbox;
         GtkWidget *button;
@@ -1538,11 +1537,9 @@ 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);
-                gtk_container_add (GTK_CONTAINER (alignment), button);
-               gtk_widget_show_all (alignment);
+                gtk_widget_show_all (button);
 
-                gtk_box_pack_end (GTK_BOX (hbox), alignment, TRUE, TRUE, 0);
+                gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
 
                 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 eade1de..294fc76 100644
--- a/applets/clock/clock-location-tile.c
+++ b/applets/clock/clock-location-tile.c
@@ -260,10 +260,8 @@ static void
 clock_location_tile_fill (ClockLocationTile *this)
 {
         ClockLocationTilePrivate *priv = PRIVATE (this);
-       GtkWidget *align;
         GtkWidget *strut;
         GtkWidget *box;
-        GtkWidget *alignment;
         GtkWidget *tile;
         GtkWidget *head_section;
 
@@ -277,30 +275,29 @@ clock_location_tile_fill (ClockLocationTile *this)
         g_signal_connect (priv->box, "leave-notify-event",
                           G_CALLBACK (enter_or_leave_tile), this);
 
-        alignment = gtk_alignment_new (0, 0, 1, 0);
-        gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 3, 3, 3, 0);
-
         tile = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+        gtk_widget_set_margin_top (tile, 3);
+        gtk_widget_set_margin_bottom (tile, 3);
+        gtk_widget_set_margin_start (tile, 3);
+
         head_section = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
 
         priv->city_label = gtk_label_new (NULL);
+        gtk_widget_set_margin_end (priv->city_label, 3);
         gtk_misc_set_alignment (GTK_MISC (priv->city_label), 0, 0);
 
-        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);
+        gtk_box_pack_start (GTK_BOX (head_section), priv->city_label, FALSE, FALSE, 0);
 
         priv->time_label = gtk_label_new (NULL);
+        gtk_widget_set_margin_end (priv->time_label, 3);
         gtk_misc_set_alignment (GTK_MISC (priv->time_label), 0, 0);
 
         priv->weather_icon = gtk_image_new ();
-        align = gtk_alignment_new (0, 0, 0, 0);
-        gtk_container_add (GTK_CONTAINER (align), priv->weather_icon);
+        gtk_widget_set_valign (priv->weather_icon, GTK_ALIGN_START);
 
         box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
         gtk_box_pack_start (GTK_BOX (head_section), box, FALSE, FALSE, 0);
-        gtk_box_pack_start (GTK_BOX (box), align, FALSE, FALSE, 0);
+        gtk_box_pack_start (GTK_BOX (box), priv->weather_icon, FALSE, FALSE, 0);
         gtk_box_pack_start (GTK_BOX (box), priv->time_label, FALSE, FALSE, 0);
 
         priv->current_button = gtk_button_new ();
@@ -357,8 +354,7 @@ 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);
 
-        gtk_container_add (GTK_CONTAINER (alignment), tile);
-        gtk_container_add (GTK_CONTAINER (priv->box), alignment);
+        gtk_container_add (GTK_CONTAINER (priv->box), tile);
         gtk_container_add (GTK_CONTAINER (this), priv->box);
 }
 
@@ -702,7 +698,7 @@ update_weather_icon (ClockLocation *loc, GWeatherInfo *info, gpointer data)
 
         if (pixbuf) {
                 gtk_image_set_from_pixbuf (GTK_IMAGE (priv->weather_icon), pixbuf);
-                gtk_alignment_set_padding (GTK_ALIGNMENT (gtk_widget_get_parent (priv->weather_icon)), 0, 0, 
0, 6);
+                gtk_widget_set_margin_end (priv->weather_icon, 6);
         }
 }
 
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index b34df24..5840499 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -112,7 +112,6 @@ struct _ClockData {
 
        GtkListStore *cities_store;
         GtkWidget *cities_section;
-        GtkWidget *map_section;
         GtkWidget *map_widget;
 
        /* preferences */
@@ -729,7 +728,7 @@ create_map_section (ClockData *cd)
         ClockMap *map;
 
         if (cd->map_widget) {
-                gtk_widget_destroy (GTK_WIDGET (cd->map_section));
+                gtk_widget_destroy (cd->map_widget);
                 cd->map_widget = NULL;
         }
 
@@ -737,16 +736,15 @@ create_map_section (ClockData *cd)
         g_signal_connect (map, "need-locations",
                           G_CALLBACK (map_need_locations_cb), cd);
 
-        cd->map_section = gtk_alignment_new (0, 0, 1, 1);
         cd->map_widget = GTK_WIDGET (map);
 
-        gtk_container_add (GTK_CONTAINER (cd->map_section), cd->map_widget);
+        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_alignment_set_padding (GTK_ALIGNMENT (cd->map_section), 1, 1, 1, 1);
-
-        gtk_box_pack_start (GTK_BOX (cd->clock_vbox), cd->map_section, FALSE, FALSE, 0);
+        gtk_box_pack_start (GTK_BOX (cd->clock_vbox), cd->map_widget, TRUE, TRUE, 0);
         gtk_widget_show (cd->map_widget);
-        gtk_widget_show (cd->map_section);
 }
 
 static void
@@ -757,7 +755,6 @@ update_calendar_popup (ClockData *cd)
                         gtk_widget_destroy (cd->calendar_popup);
                         cd->calendar_popup = NULL;
                         cd->cities_section = NULL;
-                        cd->map_section = NULL;
                         cd->map_widget = NULL;
                        cd->clock_vbox = NULL;
                        


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]