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

This commit is contained in:
Mike Massonnet
2010-05-24 01:49:13 +02:00
parent 0a8e9b2ae5
commit c0eb574089
3 changed files with 14 additions and 0 deletions

View File

@@ -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);

View File

@@ -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"));

View File

@@ -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,