[gnome-panel] clock: remove no longer needed code



commit 0820ebd64a6e3928c47a24bf3f0edf78418436e5
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Nov 18 21:57:05 2013 +0200

    clock: remove no longer needed code
    
    1) size_request is not valid signal anymore.
    2) Removed code was added in 2003-08-19 to fix bugs - #110005
    and #120188. I think these bugs are not valid anymore as I could
    not reproduce any jumping. Tried with different fonts.
    3) size variable was completely unneded.

 applets/clock/clock.c |   55 +------------------------------------------------
 1 files changed, 1 insertions(+), 54 deletions(-)
---
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 6b62daa..a0b0630 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -131,14 +131,10 @@ struct _ClockData {
         time_t             current_time;
         GnomeWallClock    *wall_clock;
        PanelAppletOrient  orient;
-       int                size;
        GtkAllocation      old_allocation;
 
        SystemTimezone *systz;
 
-       int fixed_width;
-       int fixed_height;
-
         GtkWidget *showseconds_check;
         GtkWidget *showdate_check;
         GtkWidget *custom_hbox;
@@ -199,14 +195,6 @@ _clock_get_widget (ClockData  *cd,
        return GTK_WIDGET (gtk_builder_get_object (cd->builder, name));
 }
 
-static void
-unfix_size (ClockData *cd)
-{
-       cd->fixed_width = -1;
-       cd->fixed_height = -1;
-       gtk_widget_queue_resize (cd->panel_button);
-}
-
 static int
 calculate_minimum_width (GtkWidget   *widget,
                         const gchar *text)
@@ -820,23 +808,6 @@ do_not_eat_button_press (GtkWidget      *widget,
        return FALSE;
 }
 
-/* Don't request smaller size then the last one we did, this avoids
-   jumping when proportional fonts are used.  We must take care to
-   call "unfix_size" whenever options are changed or such where
-   we'd want to forget the fixed size */
-static void
-clock_size_request (GtkWidget *clock, GtkRequisition *req, gpointer data)
-{
-       ClockData *cd = data;
-
-       if (req->width > cd->fixed_width)
-               cd->fixed_width = req->width;
-       if (req->height > cd->fixed_height)
-               cd->fixed_height = req->height;
-       req->width = cd->fixed_width;
-       req->height = cd->fixed_height;
-}
-
 static void
 clock_update_text_gravity (GtkWidget *label)
 {
@@ -892,12 +863,6 @@ create_main_clock_label (ClockData *cd)
         GtkWidget *label;
 
         label = gtk_label_new (NULL);
-       g_signal_connect (label, "size_request",
-                         G_CALLBACK (clock_size_request),
-                         cd);
-       g_signal_connect_swapped (label, "style_set",
-                                 G_CALLBACK (unfix_size),
-                                 cd);
        gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
        clock_update_text_gravity (label);
        g_signal_connect (label, "screen-changed",
@@ -995,7 +960,6 @@ create_clock_widget (ClockData *cd)
 
        cd->props = NULL;
        cd->orient = -1;
-       cd->size = panel_applet_get_size (PANEL_APPLET (cd->applet));
 
        update_panel_weather (cd);
 
@@ -1030,7 +994,6 @@ update_orient (ClockData *cd)
 
        angle = gtk_label_get_angle (GTK_LABEL (cd->clockw));
        if (angle != new_angle) {
-               unfix_size (cd);
                gtk_label_set_angle (GTK_LABEL (cd->clockw), new_angle);
                 gtk_label_set_angle (GTK_LABEL (cd->panel_temperature_label), new_angle);
        }
@@ -1070,7 +1033,6 @@ applet_change_orient (PanelApplet       *applet,
         gtk_orientable_set_orientation (GTK_ORIENTABLE (cd->main_obox), o);
         gtk_orientable_set_orientation (GTK_ORIENTABLE (cd->weather_obox), o);
 
-        unfix_size (cd);
         update_clock (NULL, NULL, cd);
         update_calendar_popup (cd);
 }
@@ -1081,24 +1043,12 @@ panel_button_change_pixel_size (GtkWidget     *widget,
                                 GtkAllocation *allocation,
                                 ClockData      *cd)
 {
-       int new_size;
-
        if (cd->old_allocation.width  == allocation->width &&
            cd->old_allocation.height == allocation->height)
                return;
 
-       cd->old_allocation.width  = allocation->width;
-       cd->old_allocation.height = allocation->height;
+       cd->old_allocation = *allocation;
 
-       if (cd->orient == PANEL_APPLET_ORIENT_LEFT ||
-           cd->orient == PANEL_APPLET_ORIENT_RIGHT)
-               new_size = allocation->width;
-       else
-               new_size = allocation->height;
-
-       cd->size = new_size;
-
-        unfix_size (cd);
        update_clock (NULL, NULL, cd);
 }
 
@@ -1375,9 +1325,6 @@ fill_clock_applet (PanelApplet *applet)
         g_signal_connect (cd->applet_settings, "changed::cities",
                           G_CALLBACK (locations_changed), cd);
 
-       cd->fixed_width = -1;
-       cd->fixed_height = -1;
-
        cd->applet = GTK_WIDGET (applet);
 
         cd->world = gweather_location_new_world (FALSE);


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