Package: xfce4-cpufreq-plugin Version: 0.2-1 Severity: wishlist Tags: patch
*** Please type your report below this line *** Hi, my CPUs frequency is scaled between 800MHz and 1,6GHz. This causes the cpufreq plugin to change width on the panel (it uses smaller font to show MHz values so "800 MHz" is smaller than "1,6 GHz"), moving everything next to it.. this is quite annoying, so I'd like it to show 800 MHz as 0.8 GHz. I wrote a small patch which enforces this behaviour and allows me to change it in the plugins properties. I'm sending it to you because the author doesn't mention the plugin on his homepage anymore, which makes debian the primary source to get it. Cheers, - Daniel -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages xfce4-cpufreq-plugin depends on: ii libatk1.0-0 1.20.0-1 The ATK accessibility toolkit ii libc6 2.7-6 GNU C Library: Shared libraries ii libcairo2 1.4.14-1 The Cairo 2D vector graphics libra ii libcpufreq0 002-7.2 shared library to deal with the cp ii libglib2.0-0 2.16.1-2 The GLib library of C routines ii libgtk2.0-0 2.12.9-2 The GTK+ graphical user interface ii libpango1.0-0 1.20.0-1 Layout and rendering of internatio ii libxfce4util4 4.4.2-2 Utility functions library for Xfce ii libxfcegui4-4 4.4.2-2 Basic GUI C functions for Xfce4 ii libxml2 2.6.31.dfsg-2 GNOME XML library ii xfce4-panel 4.4.2-3 The Xfce4 desktop environment pane xfce4-cpufreq-plugin recommends no packages. -- no debconf information
--- xfce4-cpufreq-plugin-0.2/cpufreq.c 2006-06-16 02:21:54.000000000 +0200 +++ xfce4-cpufreq-plugin-0.2.patched/cpufreq.c 2008-04-05 01:24:44.914728734 +0200 @@ -64,6 +64,7 @@ gboolean invert_colors; gboolean showed_warning; + gboolean always_GHz; GdkColor colorLow; GdkColor colorHi; @@ -178,9 +179,9 @@ } } - if (cur < 1000000) + if ((cur < 1000000) && !c->always_GHz) snprintf(buf, 256, "<span size=\"x-small\">%d</span><span size=\"small\"> </span><span size=\"x-small\">MHz</span>", cur / 1000); - else + else snprintf(buf, 256, "<span size=\"small\">%.1f GHz</span>", (gdouble)cur / 1000000); if ((cur < c->max && !c->invert_colors) || @@ -291,6 +292,7 @@ { c->cpu = 0; c->invert_colors = FALSE; + c->always_GHz = FALSE; return; } @@ -302,11 +304,13 @@ { c->cpu = 0; c->invert_colors = FALSE; + c->always_GHz = FALSE; return; } c->cpu = atoi(str); c->invert_colors = xfce_rc_read_bool_entry(rc, "InvColors", FALSE); + c->always_GHz = xfce_rc_read_bool_entry(rc, "AlwaysGHz", FALSE); xfce_rc_close (rc); } @@ -329,6 +333,7 @@ snprintf(buf, 32, "%d", c->cpu); xfce_rc_write_entry(rc, "NumCPUs", buf); xfce_rc_write_bool_entry(rc, "InvColors", c->invert_colors); + xfce_rc_write_bool_entry(rc, "AlwaysGHz", c->always_GHz); xfce_rc_close (rc); } @@ -351,6 +356,15 @@ } static void +always_GHz_toggled (GtkToggleButton *button, gpointer data) +{ + struct cpufreq_monitor *c = (struct cpufreq_monitor *)data; + c->always_GHz = gtk_toggle_button_get_active (button); + + update_cpufreq_status (c); +} + +static void combo_changed_cb (GtkComboBox *cb, gpointer data) { struct cpufreq_monitor *c = (struct cpufreq_monitor *)data; @@ -410,16 +424,30 @@ GtkWidget *options_label = gtk_label_new (_("Options")); gtk_widget_show (options_label); gtk_frame_set_label_widget (GTK_FRAME (options), options_label); - + + GtkWidget *options_list = gtk_vbox_new(TRUE, 0); + gtk_widget_show(options_list); + GtkWidget *invert = gtk_check_button_new_with_mnemonic (_("Invert colors")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(invert), c->invert_colors); gtk_widget_show(invert); - gtk_container_add (GTK_CONTAINER (options), invert); + gtk_container_add (GTK_CONTAINER (options_list), invert); g_signal_connect(invert, "toggled", G_CALLBACK (invert_colors_toggled), c); + GtkWidget *alwaysGHz = gtk_check_button_new_with_mnemonic + (_("Always show Frequency as GHz")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(alwaysGHz), c->always_GHz); + gtk_widget_show(alwaysGHz); + gtk_container_add (GTK_CONTAINER (options_list), alwaysGHz); + + g_signal_connect(alwaysGHz, "toggled", + G_CALLBACK (always_GHz_toggled), c); + + gtk_container_add(GTK_CONTAINER (options), options_list); + gtk_box_pack_start(GTK_BOX(vbox), header, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), cpucombo, FALSE, FALSE, 0); @@ -445,6 +473,7 @@ c->nr_cpus = get_nr_cpus(); c->showed_warning = FALSE; c->invert_colors = FALSE; + c->always_GHz = FALSE; /* determine min/max */ cpufreq_get_hardware_limits(c->cpu, &c->min, &c->max);