1 diff -ru netspeed_applet-0.15.2/src/netspeed.c netspeed_applet-0.15.2.fontsize/src/netspeed.c
2 --- netspeed_applet-0.15.2/src/netspeed.c 2008-09-13 16:59:52.000000000 -0300
3 +++ netspeed_applet-0.15.2.fontsize/src/netspeed.c 2008-10-23 14:57:41.000000000 -0200
5 gboolean show_sum, show_bits;
6 gboolean change_icon, auto_change_device;
7 GdkColor in_color, out_color;
11 GtkWidget *inbytes_text, *outbytes_text;
14 /* Refresh the text of the labels and tooltip */
15 if (applet->show_sum) {
16 + add_markup_size(&applet->devinfo.sum_rate, applet->font_size);
17 gtk_label_set_markup(GTK_LABEL(applet->sum_label), applet->devinfo.sum_rate);
19 + add_markup_size(&applet->devinfo.rx_rate, applet->font_size);
20 + add_markup_size(&applet->devinfo.tx_rate, applet->font_size);
21 gtk_label_set_markup(GTK_LABEL(applet->in_label), applet->devinfo.rx_rate);
22 gtk_label_set_markup(GTK_LABEL(applet->out_label), applet->devinfo.tx_rate);
27 panel_applet_gconf_set_string(PANEL_APPLET(applet->applet), "device", applet->devinfo.name, NULL);
28 + panel_applet_gconf_set_int(PANEL_APPLET(applet->applet), "font_size", applet->font_size, NULL);
29 panel_applet_gconf_set_bool(PANEL_APPLET(applet->applet), "show_sum", applet->show_sum, NULL);
30 panel_applet_gconf_set_bool(PANEL_APPLET(applet->applet), "show_bits", applet->show_bits, NULL);
31 panel_applet_gconf_set_bool(PANEL_APPLET(applet->applet), "change_icon", applet->change_icon, NULL);
33 applet->settings = NULL;
36 +/* Set the font size to the new value
39 +font_size_adjust_cb(GtkSpinButton *spinbutton, NetspeedApplet *applet)
41 + applet->font_size = gtk_spin_button_get_value_as_int(spinbutton);
45 /* Called when the showsum checkbutton is toggled...
49 GtkWidget *category_header_label;
50 GtkWidget *network_device_hbox;
51 GtkWidget *network_device_label;
52 + GtkWidget *label_font_size_hbox;
53 + GtkWidget *label_font_size_hbox2;
54 + GtkWidget *label_font_size_label;
55 + GtkWidget *label_font_size_spinbutton;
56 GtkWidget *indent_label;
57 + GtkWidget *points_label;
58 GtkWidget *show_sum_checkbutton;
59 GtkWidget *show_bits_checkbutton;
60 GtkWidget *change_icon_checkbutton;
61 @@ -1033,6 +1052,31 @@
62 gtk_combo_box_set_active(GTK_COMBO_BOX(applet->network_device_combo), active);
63 g_object_set_data_full(G_OBJECT(applet->network_device_combo), "devices", devices, (GDestroyNotify)free_devices_list);
65 + label_font_size_hbox = gtk_hbox_new(FALSE, 6);
66 + gtk_box_pack_start(GTK_BOX(controls_vbox), label_font_size_hbox, TRUE, TRUE, 0);
68 + label_font_size_label = gtk_label_new_with_mnemonic(_("Label _font size:"));
69 + gtk_label_set_justify(GTK_LABEL(label_font_size_label), GTK_JUSTIFY_LEFT);
70 + gtk_misc_set_alignment(GTK_MISC(label_font_size_label), 0.0f, 0.5f);
71 + gtk_size_group_add_widget(category_label_size_group, label_font_size_label);
72 + gtk_box_pack_start(GTK_BOX(label_font_size_hbox), label_font_size_label, FALSE, FALSE, 0);
74 + label_font_size_hbox2 = gtk_hbox_new(FALSE, 6);
75 + gtk_box_pack_start(GTK_BOX(label_font_size_hbox), label_font_size_hbox2, TRUE, TRUE, 0);
77 + label_font_size_spinbutton = gtk_spin_button_new_with_range (5.0, 32.0, 1.0);
78 + gtk_spin_button_set_value(GTK_SPIN_BUTTON(label_font_size_spinbutton), (double) applet->font_size);
79 + gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(label_font_size_spinbutton), TRUE);
80 + gtk_spin_button_set_digits(GTK_SPIN_BUTTON (label_font_size_spinbutton), 0);
81 + gtk_label_set_mnemonic_widget(GTK_LABEL(label_font_size_label), label_font_size_spinbutton);
82 + gtk_box_pack_start(GTK_BOX(label_font_size_hbox2), label_font_size_spinbutton, TRUE, TRUE, 0);
84 + points_label = gtk_label_new(_("points"));
85 + gtk_label_set_justify(GTK_LABEL (points_label), GTK_JUSTIFY_LEFT);
86 + gtk_misc_set_alignment(GTK_MISC (points_label), 0.0f, 0.5f);
87 + gtk_size_group_add_widget(category_units_size_group, points_label);
88 + gtk_box_pack_start(GTK_BOX (label_font_size_hbox2), points_label, FALSE, FALSE, 0);
90 show_sum_checkbutton = gtk_check_button_new_with_mnemonic(_("Show _sum instead of in & out"));
91 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_sum_checkbutton), applet->show_sum);
92 gtk_box_pack_start(GTK_BOX(controls_vbox), show_sum_checkbutton, FALSE, FALSE, 0);
94 g_signal_connect(G_OBJECT (applet->network_device_combo), "changed",
95 G_CALLBACK(device_change_cb), (gpointer)applet);
97 + g_signal_connect(G_OBJECT (label_font_size_spinbutton), "value-changed",
98 + G_CALLBACK(font_size_adjust_cb), (gpointer)applet);
100 g_signal_connect(G_OBJECT (show_sum_checkbutton), "toggled",
101 G_CALLBACK(showsum_change_cb), (gpointer)applet);
103 @@ -1343,6 +1390,30 @@
107 +/* Tries to get the desktop font size out of gconf
111 +get_default_font_size(void)
116 + GConfClient *client = NULL;
117 + client = gconf_client_get_default();
120 + buf = gconf_client_get_string(client, "/desktop/gnome/interface/font_name", NULL);
123 + ptr = strrchr(buf, ' ');
125 + sscanf(ptr, "%d", &ret);
132 applet_button_press(GtkWidget *widget, GdkEventButton *event, NetspeedApplet *applet)
134 @@ -1526,6 +1597,7 @@
135 applet->show_sum = FALSE;
136 applet->show_bits = FALSE;
137 applet->change_icon = TRUE;
138 + applet->font_size = -1;
139 applet->auto_change_device = TRUE;
141 /* Set the default colors of the graph
142 @@ -1553,6 +1625,9 @@
143 applet->show_bits = panel_applet_gconf_get_bool(applet_widget, "show_bits", NULL);
144 applet->change_icon = panel_applet_gconf_get_bool(applet_widget, "change_icon", NULL);
145 applet->auto_change_device = panel_applet_gconf_get_bool(applet_widget, "auto_change_device", NULL);
146 + applet->font_size = panel_applet_gconf_get_int(applet_widget, "font_size", NULL);
147 + if (!applet->font_size)
148 + applet->font_size = -1;
150 tmp = panel_applet_gconf_get_string(applet_widget, "device", NULL);
151 if (tmp && strcmp(tmp, ""))
152 @@ -1587,6 +1662,9 @@
156 + if (applet->font_size < 1)
157 + applet->font_size = get_default_font_size();
159 if (!applet->devinfo.name) {
160 GList *ptr, *devices = get_available_devices();