Quem usa o netspeed-applet do gnome e atualizou ele para versão 0.15, descobriu que esta versão não permite mais modificar o tamanho da fonte. Para mim isso é essencial (as fontes que vem pode padrão são muito grandes), por isso decidi fazer um patch para dar suporte a isso.
Para quem usa ArchLinux, o PKGBUILD já está no AUR
.
Para quem não usa ele, esse é o patch:
netspeed-applet with editable font size option
diff -ru netspeed_applet-0.15.2/src/netspeed.c netspeed_applet-0.15.2.fontsize/src/netspeed.c
--- netspeed_applet-0.15.2/src/netspeed.c 2008-09-13 16:59:52.000000000 -0300
+++ netspeed_applet-0.15.2.fontsize/src/netspeed.c 2008-10-23 14:57:41.000000000 -0200
@@ -85,6 +85,7 @@
gboolean show_sum, show_bits;
gboolean change_icon, auto_change_device;
GdkColor in_color, out_color;
+ int font_size;
int width;
GtkWidget *inbytes_text, *outbytes_text;
@@ -664,8 +665,11 @@
/* Refresh the text of the labels and tooltip */
if (applet->show_sum) {
+ add_markup_size(&applet->devinfo.sum_rate, applet->font_size);
gtk_label_set_markup(GTK_LABEL(applet->sum_label), applet->devinfo.sum_rate);
} else {
+ add_markup_size(&applet->devinfo.rx_rate, applet->font_size);
+ add_markup_size(&applet->devinfo.tx_rate, applet->font_size);
gtk_label_set_markup(GTK_LABEL(applet->in_label), applet->devinfo.rx_rate);
gtk_label_set_markup(GTK_LABEL(applet->out_label), applet->devinfo.tx_rate);
}
@@ -891,6 +895,7 @@
return;
}
panel_applet_gconf_set_string(PANEL_APPLET(applet->applet), "device", applet->devinfo.name, NULL);
+ panel_applet_gconf_set_int(PANEL_APPLET(applet->applet), "font_size", applet->font_size, NULL);
panel_applet_gconf_set_bool(PANEL_APPLET(applet->applet), "show_sum", applet->show_sum, NULL);
panel_applet_gconf_set_bool(PANEL_APPLET(applet->applet), "show_bits", applet->show_bits, NULL);
panel_applet_gconf_set_bool(PANEL_APPLET(applet->applet), "change_icon", applet->change_icon, NULL);
@@ -901,6 +906,15 @@
applet->settings = NULL;
}
+/* Set the font size to the new value
+ */
+static void
+font_size_adjust_cb(GtkSpinButton *spinbutton, NetspeedApplet *applet)
+{
+ applet->font_size = gtk_spin_button_get_value_as_int(spinbutton);
+ applet->width = 0;
+}
+
/* Called when the showsum checkbutton is toggled...
*/
static void
@@ -944,7 +958,12 @@
GtkWidget *category_header_label;
GtkWidget *network_device_hbox;
GtkWidget *network_device_label;
+ GtkWidget *label_font_size_hbox;
+ GtkWidget *label_font_size_hbox2;
+ GtkWidget *label_font_size_label;
+ GtkWidget *label_font_size_spinbutton;
GtkWidget *indent_label;
+ GtkWidget *points_label;
GtkWidget *show_sum_checkbutton;
GtkWidget *show_bits_checkbutton;
GtkWidget *change_icon_checkbutton;
@@ -1033,6 +1052,31 @@
gtk_combo_box_set_active(GTK_COMBO_BOX(applet->network_device_combo), active);
g_object_set_data_full(G_OBJECT(applet->network_device_combo), "devices", devices, (GDestroyNotify)free_devices_list);
+ label_font_size_hbox = gtk_hbox_new(FALSE, 6);
+ gtk_box_pack_start(GTK_BOX(controls_vbox), label_font_size_hbox, TRUE, TRUE, 0);
+
+ label_font_size_label = gtk_label_new_with_mnemonic(_("Label _font size:"));
+ gtk_label_set_justify(GTK_LABEL(label_font_size_label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC(label_font_size_label), 0.0f, 0.5f);
+ gtk_size_group_add_widget(category_label_size_group, label_font_size_label);
+ gtk_box_pack_start(GTK_BOX(label_font_size_hbox), label_font_size_label, FALSE, FALSE, 0);
+
+ label_font_size_hbox2 = gtk_hbox_new(FALSE, 6);
+ gtk_box_pack_start(GTK_BOX(label_font_size_hbox), label_font_size_hbox2, TRUE, TRUE, 0);
+
+ label_font_size_spinbutton = gtk_spin_button_new_with_range (5.0, 32.0, 1.0);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(label_font_size_spinbutton), (double) applet->font_size);
+ gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(label_font_size_spinbutton), TRUE);
+ gtk_spin_button_set_digits(GTK_SPIN_BUTTON (label_font_size_spinbutton), 0);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label_font_size_label), label_font_size_spinbutton);
+ gtk_box_pack_start(GTK_BOX(label_font_size_hbox2), label_font_size_spinbutton, TRUE, TRUE, 0);
+
+ points_label = gtk_label_new(_("points"));
+ gtk_label_set_justify(GTK_LABEL (points_label), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment(GTK_MISC (points_label), 0.0f, 0.5f);
+ gtk_size_group_add_widget(category_units_size_group, points_label);
+ gtk_box_pack_start(GTK_BOX (label_font_size_hbox2), points_label, FALSE, FALSE, 0);
+
show_sum_checkbutton = gtk_check_button_new_with_mnemonic(_("Show _sum instead of in & out"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_sum_checkbutton), applet->show_sum);
gtk_box_pack_start(GTK_BOX(controls_vbox), show_sum_checkbutton, FALSE, FALSE, 0);
@@ -1048,6 +1092,9 @@
g_signal_connect(G_OBJECT (applet->network_device_combo), "changed",
G_CALLBACK(device_change_cb), (gpointer)applet);
+ g_signal_connect(G_OBJECT (label_font_size_spinbutton), "value-changed",
+ G_CALLBACK(font_size_adjust_cb), (gpointer)applet);
+
g_signal_connect(G_OBJECT (show_sum_checkbutton), "toggled",
G_CALLBACK(showsum_change_cb), (gpointer)applet);
@@ -1343,6 +1390,30 @@
}
}
+/* Tries to get the desktop font size out of gconf
+ * database
+ */
+static int
+get_default_font_size(void)
+{
+ int ret = 12;
+ char *buf, *ptr;
+
+ GConfClient *client = NULL;
+ client = gconf_client_get_default();
+ if (!client)
+ return 12;
+ buf = gconf_client_get_string(client, "/desktop/gnome/interface/font_name", NULL);
+ if (!buf)
+ return 12;
+ ptr = strrchr(buf, ' ');
+ if (ptr)
+ sscanf(ptr, "%d", &ret);
+ g_free(buf);
+
+ return ret;
+}
+
static gboolean
applet_button_press(GtkWidget *widget, GdkEventButton *event, NetspeedApplet *applet)
{
@@ -1526,6 +1597,7 @@
applet->show_sum = FALSE;
applet->show_bits = FALSE;
applet->change_icon = TRUE;
+ applet->font_size = -1;
applet->auto_change_device = TRUE;
/* Set the default colors of the graph
@@ -1553,6 +1625,9 @@
applet->show_bits = panel_applet_gconf_get_bool(applet_widget, "show_bits", NULL);
applet->change_icon = panel_applet_gconf_get_bool(applet_widget, "change_icon", NULL);
applet->auto_change_device = panel_applet_gconf_get_bool(applet_widget, "auto_change_device", NULL);
+ applet->font_size = panel_applet_gconf_get_int(applet_widget, "font_size", NULL);
+ if (!applet->font_size)
+ applet->font_size = -1;
tmp = panel_applet_gconf_get_string(applet_widget, "device", NULL);
if (tmp && strcmp(tmp, ""))
@@ -1587,6 +1662,9 @@
}
}
+ if (applet->font_size < 1)
+ applet->font_size = get_default_font_size();
+
if (!applet->devinfo.name) {
GList *ptr, *devices = get_available_devices();
ptr = devices;













