<xfce4-taskmanager:master> Make status icon optional with the new setting “Show status icon”

Mike Massonnet noreply at xfce.org
Mon May 24 01:50:01 CEST 2010


Updating branch refs/heads/master
         to c0eb5740896eef86aee1c40061ed443179a08f6a (commit)
       from 0a8e9b2ae529bafe4c35089e2aa841f5fefa3215 (commit)

commit c0eb5740896eef86aee1c40061ed443179a08f6a
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Mon May 24 01:49:13 2010 +0200

    Make status icon optional with the new setting “Show status icon”

 src/main.c           |   10 ++++++++++
 src/process-window.c |    1 +
 src/settings.c       |    3 +++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/main.c b/src/main.c
index f4dfb91..73edbca 100644
--- a/src/main.c
+++ b/src/main.c
@@ -34,6 +34,14 @@ status_icon_activated ()
 		gtk_widget_hide (window);
 }
 
+static void
+show_hide_status_icon ()
+{
+	gboolean show_status_icon;
+	g_object_get (settings, "show-status-icon", &show_status_icon, NULL);
+	gtk_status_icon_set_visible (status_icon, show_status_icon);
+}
+
 static gboolean
 init_timeout (void)
 {
@@ -90,6 +98,7 @@ int main (int argc, char *argv[])
 	settings = xtm_settings_get_default ();
 
 	status_icon = gtk_status_icon_new_from_icon_name ("utilities-system-monitor");
+	show_hide_status_icon ();
 	g_signal_connect (status_icon, "activate", G_CALLBACK (status_icon_activated), NULL);
 
 	window = xtm_process_window_new ();
@@ -102,6 +111,7 @@ int main (int argc, char *argv[])
 	g_signal_connect (settings, "notify::refresh-rate", G_CALLBACK (refresh_rate_changed), NULL);
 	g_signal_connect_after (settings, "notify::more-precision", G_CALLBACK (force_timeout_update), NULL);
 	g_signal_connect_after (settings, "notify::full-command-line", G_CALLBACK (force_timeout_update), NULL);
+	g_signal_connect (settings, "notify::show-status-icon", G_CALLBACK (show_hide_status_icon), NULL);
 
 	g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
 
diff --git a/src/process-window.c b/src/process-window.c
index 7e11da8..f1e7687 100644
--- a/src/process-window.c
+++ b/src/process-window.c
@@ -294,6 +294,7 @@ show_menu_preferences (XtmProcessWindow *window)
 	menu_preferences_append_item (GTK_MENU (menu), _("Show all processes"), "show-all-processes", window->priv->settings);
 	menu_preferences_append_item (GTK_MENU (menu), _("More precision"), "more-precision", window->priv->settings);
 	menu_preferences_append_item (GTK_MENU (menu), _("Full command line"), "full-command-line", window->priv->settings);
+	menu_preferences_append_item (GTK_MENU (menu), _("Show status icon"), "show-status-icon", window->priv->settings);
 
 	refresh_rate_menu = build_refresh_rate_menu (window->priv->settings);
 	mi = gtk_menu_item_new_with_label (_("Refresh rate"));
diff --git a/src/settings.c b/src/settings.c
index 2c6d36f..35914f7 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -34,6 +34,7 @@ enum
 	PROP_SHOW_ALL_PROCESSES = 1,
 	PROP_MORE_PRECISION,
 	PROP_FULL_COMMAND_LINE,
+	PROP_SHOW_STATUS_ICON,
 	PROP_REFRESH_RATE,
 	PROP_COLUMN_UID,
 	PROP_COLUMN_PID,
@@ -84,6 +85,8 @@ xtm_settings_class_init (XtmSettingsClass *klass)
 		g_param_spec_boolean ("more-precision", "MorePrecision", "More precision", TRUE, G_PARAM_READWRITE));
 	g_object_class_install_property (class, PROP_FULL_COMMAND_LINE,
 		g_param_spec_boolean ("full-command-line", "FullCommandLine", "Full command line", TRUE, G_PARAM_READWRITE));
+	g_object_class_install_property (class, PROP_SHOW_STATUS_ICON,
+		g_param_spec_boolean ("show-status-icon", "ShowStatusIcon", "Show/hide the status icon", TRUE, G_PARAM_READWRITE));
 	g_object_class_install_property (class, PROP_REFRESH_RATE,
 		g_param_spec_uint ("refresh-rate", "RefreshRate", "Refresh rate in milliseconds", 0, G_MAXUINT, 1000, G_PARAM_READWRITE));
 	g_object_class_install_property (class, PROP_COLUMN_UID,



More information about the Xfce4-commits mailing list