@@ -103,9 +103,6 @@ static gboolean cpufreq_applet_key_press (GtkWidget *widget,
103
103
GdkEventKey * event );
104
104
static void cpufreq_applet_size_allocate (GtkWidget * widget ,
105
105
GtkAllocation * allocation );
106
- static void cpufreq_applet_get_preferred_width (GtkWidget * widget ,
107
- gint * minimum_width ,
108
- gint * natural_width );
109
106
static void cpufreq_applet_change_orient (MatePanelApplet * pa ,
110
107
MatePanelAppletOrient orient );
111
108
static void cpufreq_applet_style_updated (GtkWidget * widget );
@@ -224,7 +221,6 @@ cpufreq_applet_class_init (CPUFreqAppletClass *klass)
224
221
225
222
widget_class -> size_allocate = cpufreq_applet_size_allocate ;
226
223
widget_class -> style_updated = cpufreq_applet_style_updated ;
227
- widget_class -> get_preferred_width = cpufreq_applet_get_preferred_width ;
228
224
widget_class -> button_press_event = cpufreq_applet_button_press ;
229
225
widget_class -> key_press_event = cpufreq_applet_key_press ;
230
226
@@ -366,46 +362,6 @@ cpufreq_applet_get_max_unit_width (CPUFreqApplet *applet)
366
362
return applet -> max_unit_width ;
367
363
}
368
364
369
- static void
370
- cpufreq_applet_get_preferred_width (GtkWidget * widget , gint * minimum_width , gint * natural_width )
371
- {
372
- CPUFreqApplet * applet ;
373
- gint labels_width = 0 ;
374
- gint width ;
375
- gint scale ;
376
-
377
- applet = CPUFREQ_APPLET (widget );
378
- scale = gtk_widget_get_scale_factor (widget );
379
-
380
- if (applet -> orient == MATE_PANEL_APPLET_ORIENT_LEFT ||
381
- applet -> orient == MATE_PANEL_APPLET_ORIENT_RIGHT )
382
- return ;
383
-
384
-
385
- if (applet -> show_freq ) {
386
- labels_width += cpufreq_applet_get_max_label_width (applet ) + 2 ;
387
- }
388
-
389
- if (applet -> show_perc ) {
390
- labels_width += cpufreq_applet_get_max_perc_width (applet );
391
- }
392
-
393
- if (applet -> show_unit ) {
394
- labels_width += cpufreq_applet_get_max_unit_width (applet );
395
- }
396
-
397
- if (applet -> show_icon ) {
398
- gint icon_width ;
399
-
400
- gtk_widget_get_preferred_width (applet -> icon , & icon_width , NULL );
401
- width = (labels_width + icon_width + 2 );
402
- } else {
403
- width = labels_width ;
404
- }
405
-
406
- * minimum_width = * natural_width = width / scale ;
407
- }
408
-
409
365
static void
410
366
cpufreq_applet_popup_position_menu (GtkMenu * menu ,
411
367
int * x ,
@@ -579,6 +535,10 @@ cpufreq_applet_style_updated (GtkWidget *widget)
579
535
applet -> max_perc_width = 0 ;
580
536
581
537
cpufreq_applet_refresh (applet );
538
+
539
+ /*Reset label sizes to zero that have been held to maximum reached width*/
540
+ gtk_widget_set_size_request (GTK_WIDGET (applet -> label ), 0 , 0 );
541
+ gtk_widget_set_size_request (GTK_WIDGET (applet -> unit_label ), 0 , 0 );
582
542
}
583
543
584
544
static void
@@ -809,6 +769,9 @@ cpufreq_applet_update (CPUFreqApplet *applet, CPUFreqMonitor *monitor)
809
769
810
770
if (applet -> show_unit ) {
811
771
gtk_label_set_text (GTK_LABEL (applet -> unit_label ), unit_label );
772
+ /*Hold the largest size set by MHZ or GHZ to prevent jumping */
773
+ gtk_widget_get_preferred_size (GTK_WIDGET (applet -> unit_label ),& req , NULL );
774
+ gtk_widget_set_size_request (GTK_WIDGET (applet -> unit_label ),req .width , req .height );
812
775
}
813
776
814
777
if (applet -> show_icon ) {
0 commit comments