summaryrefslogtreecommitdiff
path: root/netspeed
diff options
context:
space:
mode:
Diffstat (limited to 'netspeed')
-rw-r--r--netspeed/src/Makefile.am28
-rw-r--r--netspeed/src/netspeed-preferences.ui263
-rw-r--r--netspeed/src/netspeed-resources.gresource.xml6
-rw-r--r--netspeed/src/netspeed.c161
4 files changed, 327 insertions, 131 deletions
diff --git a/netspeed/src/Makefile.am b/netspeed/src/Makefile.am
index 27fb82d3..26d5b854 100644
--- a/netspeed/src/Makefile.am
+++ b/netspeed/src/Makefile.am
@@ -1,3 +1,9 @@
+NULL =
+
+builder_files = \
+ netspeed-preferences.ui \
+ $(NULL)
+
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(includedir) \
@@ -9,11 +15,31 @@ AM_CPPFLAGS = \
libexec_PROGRAMS = mate-netspeed-applet
-mate_netspeed_applet_SOURCES = backend.h backend.c netspeed.c
+BUILT_SOURCES = netspeed-resources.c netspeed-resources.h
+nodist_mate_netspeed_applet_SOURCES = $(BUILT_SOURCES)
+mate_netspeed_applet_SOURCES = \
+ backend.h \
+ backend.c \
+ netspeed.c \
+ $(NULL)
mate_netspeed_applet_LDADD = $(GIO_LIBS) $(GTOP_APPLETS_LIBS) \
$(MATE_APPLETS4_LIBS) \
$(IWLIB) $(INTLLIBS) -lm
+netspeed-resources.c: netspeed-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/netspeed-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name netspeed $<
+
+netspeed-resources.h: netspeed-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/netspeed-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name netspeed $<
+
+CLEANFILES = \
+ $(BUILT_SOURCES) \
+ $(NULL)
+
+EXTRA_DIST = \
+ $(builder_files) \
+ netspeed-resources.gresource.xml \
+ $(NULL)
-include $(top_srcdir)/git.mk
diff --git a/netspeed/src/netspeed-preferences.ui b/netspeed/src/netspeed-preferences.ui
new file mode 100644
index 00000000..8497f009
--- /dev/null
+++ b/netspeed/src/netspeed-preferences.ui
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.36.0 -->
+<interface>
+ <requires lib="gtk+" version="3.22"/>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">help-browser</property>
+ </object>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">window-close</property>
+ </object>
+ <object class="GtkDialog" id="preferences_dialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">MATE Netspeed Preferences</property>
+ <property name="icon_name">mate-netspeed-applet</property>
+ <property name="type_hint">dialog</property>
+ <signal name="response" handler="on_preferences_dialog_response" swapped="no"/>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label" translatable="yes">_Help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image1</property>
+ <property name="use_underline">True</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label" translatable="yes">_Close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image2</property>
+ <property name="use_underline">True</property>
+ <property name="always_show_image">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Network _device:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">network_device_combo</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="network_device_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <signal name="changed" handler="on_network_device_combo_changed" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_sum_checkbutton">
+ <property name="label" translatable="yes">Show _sum instead of in &amp; out</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_show_sum_checkbutton_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_bits_checkbutton">
+ <property name="label" translatable="yes">Show _bits instead of bytes</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_show_bits_checkbutton_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="short_unit_checkbutton">
+ <property name="label" translatable="yes">Shorten _unit legend</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_short_unit_checkbutton_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="change_icon_checkbutton">
+ <property name="label" translatable="yes">_Change icon according to the selected device</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_change_icon_checkbutton_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_icon_checkbutton">
+ <property name="label" translatable="yes">Show _icon</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_show_icon_checkbutton_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="show_quality_icon_checkbutton">
+ <property name="label" translatable="yes">Show signal _quality icon for wireless devices</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">start</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_show_quality_icon_checkbutton_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">General Settings</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-11">button1</action-widget>
+ <action-widget response="-3">button2</action-widget>
+ </action-widgets>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
+ </object>
+</interface>
diff --git a/netspeed/src/netspeed-resources.gresource.xml b/netspeed/src/netspeed-resources.gresource.xml
new file mode 100644
index 00000000..8d0f59f5
--- /dev/null
+++ b/netspeed/src/netspeed-resources.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/mate/mate-applets/netspeed">
+ <file compressed="true">netspeed-preferences.ui</file>
+ </gresource>
+</gresources>
diff --git a/netspeed/src/netspeed.c b/netspeed/src/netspeed.c
index 72a4aefe..6831fe94 100644
--- a/netspeed/src/netspeed.c
+++ b/netspeed/src/netspeed.c
@@ -33,6 +33,9 @@
#include "backend.h"
+#define GET_WIDGET(x) (GTK_WIDGET (gtk_builder_get_object (builder, (x))))
+#define GET_DIALOG(x) (GTK_DIALOG (gtk_builder_get_object (builder, (x))))
+
/* Icons for the interfaces */
static const char* const dev_type_icon[DEV_UNKNOWN + 1] = {
/* FIXME: Need an actual loopback icon... */
@@ -869,12 +872,6 @@ pref_response_cb (GtkDialog *dialog, gint id, gpointer data)
}
g_settings_delay (applet->gsettings);
g_settings_set_string (applet->gsettings, "device", applet->devinfo.name);
- g_settings_set_boolean (applet->gsettings, "show-sum", applet->show_sum);
- g_settings_set_boolean (applet->gsettings, "show-bits", applet->show_bits);
- g_settings_set_boolean (applet->gsettings, "short-unit", applet->short_unit);
- g_settings_set_boolean (applet->gsettings, "show-icon", applet->show_icon);
- g_settings_set_boolean (applet->gsettings, "show-quality-icon", applet->show_quality_icon);
- g_settings_set_boolean (applet->gsettings, "change-icon", applet->change_icon);
g_settings_set_boolean (applet->gsettings, "auto-change-device", applet->auto_change_device);
g_settings_apply (applet->gsettings);
@@ -942,24 +939,8 @@ changeicon_change_cb(GtkToggleButton *togglebutton, MateNetspeedApplet *applet)
static void
settings_cb(GtkAction *action, gpointer data)
{
+ GtkBuilder *builder;
MateNetspeedApplet *applet = (MateNetspeedApplet*)data;
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *categories_vbox;
- GtkWidget *category_vbox;
- GtkWidget *controls_vbox;
- GtkWidget *category_header_label;
- GtkWidget *network_device_hbox;
- GtkWidget *network_device_label;
- GtkWidget *indent_label;
- GtkWidget *show_sum_checkbutton;
- GtkWidget *show_bits_checkbutton;
- GtkWidget *short_unit_checkbutton;
- GtkWidget *show_icon_checkbutton;
- GtkWidget *show_quality_icon_checkbutton;
- GtkWidget *change_icon_checkbutton;
- GtkSizeGroup *category_label_size_group;
- gchar *header_str;
GList *ptr, *devices;
int i, active = -1;
@@ -971,62 +952,22 @@ settings_cb(GtkAction *action, gpointer data)
return;
}
- category_label_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+ builder = gtk_builder_new_from_resource ("/org/mate/mate-applets/netspeed/netspeed-preferences.ui");
- applet->settings = GTK_DIALOG(gtk_dialog_new_with_buttons(_("MATE Netspeed Preferences"),
- NULL,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- "gtk-help", GTK_RESPONSE_HELP,
- "gtk-close", GTK_RESPONSE_ACCEPT,
- NULL));
+ applet->settings = GET_DIALOG ("preferences_dialog");
+ applet->network_device_combo = GET_WIDGET ("network_device_combo");
- gtk_window_set_resizable(GTK_WINDOW(applet->settings), FALSE);
gtk_window_set_screen(GTK_WINDOW(applet->settings),
gtk_widget_get_screen(GTK_WIDGET(applet->settings)));
gtk_dialog_set_default_response(GTK_DIALOG(applet->settings), GTK_RESPONSE_CLOSE);
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
-
- categories_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
- gtk_box_pack_start(GTK_BOX (vbox), categories_vbox, TRUE, TRUE, 0);
-
- category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_box_pack_start(GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0);
-
- header_str = g_strconcat("<span weight=\"bold\">", _("General Settings"), "</span>", NULL);
- category_header_label = gtk_label_new(header_str);
- gtk_label_set_use_markup(GTK_LABEL(category_header_label), TRUE);
- gtk_label_set_justify(GTK_LABEL(category_header_label), GTK_JUSTIFY_LEFT);
- gtk_label_set_xalign (GTK_LABEL (category_header_label), 0.0);
- gtk_label_set_yalign (GTK_LABEL (category_header_label), 0.5);
- gtk_box_pack_start(GTK_BOX (category_vbox), category_header_label, FALSE, FALSE, 0);
- g_free(header_str);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start(GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0);
-
- indent_label = gtk_label_new(" ");
- gtk_label_set_justify(GTK_LABEL (indent_label), GTK_JUSTIFY_LEFT);
- gtk_box_pack_start(GTK_BOX (hbox), indent_label, FALSE, FALSE, 0);
-
- controls_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
- gtk_box_pack_start(GTK_BOX(hbox), controls_vbox, TRUE, TRUE, 0);
-
- network_device_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_box_pack_start(GTK_BOX(controls_vbox), network_device_hbox, TRUE, TRUE, 0);
-
- network_device_label = gtk_label_new_with_mnemonic(_("Network _device:"));
- gtk_label_set_justify(GTK_LABEL(network_device_label), GTK_JUSTIFY_LEFT);
- gtk_label_set_xalign (GTK_LABEL (network_device_label), 0.0f);
- gtk_label_set_yalign (GTK_LABEL (network_device_label), 0.5f);
- gtk_size_group_add_widget(category_label_size_group, network_device_label);
- gtk_box_pack_start(GTK_BOX (network_device_hbox), network_device_label, FALSE, FALSE, 0);
-
- applet->network_device_combo = gtk_combo_box_text_new();
- gtk_label_set_mnemonic_widget(GTK_LABEL(network_device_label), applet->network_device_combo);
- gtk_box_pack_start (GTK_BOX (network_device_hbox), applet->network_device_combo, TRUE, TRUE, 0);
+ g_settings_bind (applet->gsettings, "show-sum", gtk_builder_get_object (builder, "show_sum_checkbutton"), "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (applet->gsettings, "show-bits", gtk_builder_get_object (builder, "show_bits_checkbutton"), "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (applet->gsettings, "short-unit", gtk_builder_get_object (builder, "short_unit_checkbutton"), "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (applet->gsettings, "show-icon", gtk_builder_get_object (builder, "show_icon_checkbutton"), "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (applet->gsettings, "show-quality-icon", gtk_builder_get_object (builder, "show_quality_icon_checkbutton"), "active", G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (applet->gsettings, "change-icon", gtk_builder_get_object (builder, "change_icon_checkbutton"), "active", G_SETTINGS_BIND_DEFAULT);
/* Default means device with default route set */
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(applet->network_device_combo), _("Default"));
@@ -1042,55 +983,20 @@ settings_cb(GtkAction *action, gpointer data)
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);
- 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);
-
- show_bits_checkbutton = gtk_check_button_new_with_mnemonic(_("Show _bits instead of bytes"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_bits_checkbutton), applet->show_bits);
- gtk_box_pack_start(GTK_BOX(controls_vbox), show_bits_checkbutton, FALSE, FALSE, 0);
-
- short_unit_checkbutton = gtk_check_button_new_with_mnemonic(_("Shorten _unit legend"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(short_unit_checkbutton), applet->short_unit);
- gtk_box_pack_start(GTK_BOX(controls_vbox), short_unit_checkbutton, FALSE, FALSE, 0);
-
- change_icon_checkbutton = gtk_check_button_new_with_mnemonic(_("_Change icon according to the selected device"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(change_icon_checkbutton), applet->change_icon);
- gtk_box_pack_start(GTK_BOX(controls_vbox), change_icon_checkbutton, FALSE, FALSE, 0);
-
- show_icon_checkbutton = gtk_check_button_new_with_mnemonic(_("Show _icon"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_icon_checkbutton), applet->show_icon);
- gtk_box_pack_start(GTK_BOX(controls_vbox), show_icon_checkbutton, FALSE, FALSE, 0);
-
- show_quality_icon_checkbutton = gtk_check_button_new_with_mnemonic(_("Show signal _quality icon for wireless devices"));
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(show_quality_icon_checkbutton), applet->show_quality_icon);
- gtk_box_pack_start(GTK_BOX(controls_vbox), show_quality_icon_checkbutton, FALSE, FALSE, 0);
-
- g_signal_connect(G_OBJECT (applet->network_device_combo), "changed",
- G_CALLBACK(device_change_cb), (gpointer)applet);
-
- g_signal_connect(G_OBJECT (show_sum_checkbutton), "toggled",
- G_CALLBACK(showsum_change_cb), (gpointer)applet);
-
- g_signal_connect(G_OBJECT (show_bits_checkbutton), "toggled",
- G_CALLBACK(showbits_change_cb), (gpointer)applet);
-
- g_signal_connect(G_OBJECT (short_unit_checkbutton), "toggled",
- G_CALLBACK(shortunit_change_cb), (gpointer)applet);
-
- g_signal_connect(G_OBJECT (show_icon_checkbutton), "toggled",
- G_CALLBACK(showicon_change_cb), (gpointer)applet);
-
- g_signal_connect(G_OBJECT (show_quality_icon_checkbutton), "toggled",
- G_CALLBACK(showqualityicon_change_cb), (gpointer)applet);
-
- g_signal_connect(G_OBJECT (change_icon_checkbutton), "toggled",
- G_CALLBACK(changeicon_change_cb), (gpointer)applet);
-
- g_signal_connect(G_OBJECT (applet->settings), "response",
- G_CALLBACK(pref_response_cb), (gpointer)applet);
-
- gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area (applet->settings)), vbox);
+ /* signals */
+ gtk_builder_add_callback_symbols (builder,
+ "on_network_device_combo_changed", G_CALLBACK (device_change_cb),
+ "on_show_sum_checkbutton_toggled", G_CALLBACK (showsum_change_cb),
+ "on_show_bits_checkbutton_toggled", G_CALLBACK(showbits_change_cb),
+ "on_short_unit_checkbutton_toggled", G_CALLBACK(shortunit_change_cb),
+ "on_change_icon_checkbutton_toggled", G_CALLBACK (changeicon_change_cb),
+ "on_show_icon_checkbutton_toggled", G_CALLBACK (showicon_change_cb),
+ "on_show_quality_icon_checkbutton_toggled", G_CALLBACK (showqualityicon_change_cb),
+ "on_preferences_dialog_response", G_CALLBACK(pref_response_cb),
+ NULL);
+ gtk_builder_connect_signals (builder, applet);
+
+ g_object_unref (builder);
gtk_widget_show_all(GTK_WIDGET(applet->settings));
}
@@ -1580,13 +1486,6 @@ mate_netspeed_applet_factory(MatePanelApplet *applet_widget, const gchar *iid, g
applet->applet = applet_widget;
memset(&applet->devinfo, 0, sizeof(DevInfo));
applet->refresh_time = 1000.0;
- applet->show_sum = FALSE;
- applet->show_bits = FALSE;
- applet->short_unit = FALSE;
- applet->show_icon = TRUE;
- applet->show_quality_icon = TRUE;
- applet->change_icon = TRUE;
- applet->auto_change_device = TRUE;
/* Set the default colors of the graph
*/
@@ -1607,8 +1506,6 @@ mate_netspeed_applet_factory(MatePanelApplet *applet_widget, const gchar *iid, g
/* Get stored settings from gsettings
*/
- char *tmp = NULL;
-
applet->show_sum = g_settings_get_boolean (applet->gsettings, "show-sum");
applet->show_bits = g_settings_get_boolean (applet->gsettings, "show-bits");
applet->short_unit = g_settings_get_boolean (applet->gsettings, "short-unit");
@@ -1617,18 +1514,21 @@ mate_netspeed_applet_factory(MatePanelApplet *applet_widget, const gchar *iid, g
applet->change_icon = g_settings_get_boolean (applet->gsettings, "change-icon");
applet->auto_change_device = g_settings_get_boolean (applet->gsettings, "auto-change-device");
+ char *tmp = NULL;
tmp = g_settings_get_string (applet->gsettings, "device");
if (tmp && strcmp(tmp, ""))
{
get_device_info(tmp, &applet->devinfo);
g_free(tmp);
}
+
tmp = g_settings_get_string (applet->gsettings, "up-command");
if (tmp && strcmp(tmp, ""))
{
applet->up_cmd = g_strdup(tmp);
g_free(tmp);
}
+
tmp = g_settings_get_string (applet->gsettings, "down-command");
if (tmp && strcmp(tmp, ""))
{
@@ -1642,6 +1542,7 @@ mate_netspeed_applet_factory(MatePanelApplet *applet_widget, const gchar *iid, g
gdk_rgba_parse (&applet->in_color, tmp);
g_free(tmp);
}
+
tmp = g_settings_get_string (applet->gsettings, "out-color");
if (tmp)
{