From 955bed1861fe77c4490a949bd20225e4f3d6efa4 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Fri, 2 Jul 2010 11:31:11 -0400 Subject: [PATCH] [#2833] gconf: Icon in the system tray --- .../src/config/preferencesdialog.c | 12 ++++---- sflphone-client-gnome/src/dbus/dbus.c | 29 ------------------- sflphone-client-gnome/src/dbus/dbus.h | 3 -- sflphone-client-gnome/src/main.c | 8 ++--- sflphone-client-gnome/src/mainwindow.c | 2 +- sflphone-client-gnome/src/sflphone_const.h | 1 + sflphone-client-gnome/src/uimanager.c | 2 +- 7 files changed, 11 insertions(+), 46 deletions(-) diff --git a/sflphone-client-gnome/src/config/preferencesdialog.c b/sflphone-client-gnome/src/config/preferencesdialog.c index b4295eea0c..2302202db5 100644 --- a/sflphone-client-gnome/src/config/preferencesdialog.c +++ b/sflphone-client-gnome/src/config/preferencesdialog.c @@ -136,8 +136,8 @@ void showstatusicon_cb (GtkWidget *widget, gpointer data) { currentstatus ? show_status_icon () : hide_status_icon (); - // Update through D-Bus - dbus_enable_status_icon (currentstatus ? "true" : "false"); + // Update through D-Bus + eel_gconf_set_integer (SHOW_STATUSICON, currentstatus); } @@ -146,7 +146,7 @@ create_general_settings () { GtkWidget *ret, *notifAll, *trayItem, *frame, *checkBoxWidget, *label, *table; - gboolean statusicon = FALSE; + gboolean statusicon; // Load history configuration history_load_configuration (); @@ -172,10 +172,8 @@ create_general_settings () 1); gtk_box_pack_start (GTK_BOX(ret), frame, FALSE, FALSE, 0); - if (g_strcasecmp (dbus_is_status_icon_enabled (), "true") == 0) - statusicon = TRUE; - else - statusicon = FALSE; + // Whether or not displaying an icon in the system tray + statusicon = eel_gconf_get_integer (SHOW_STATUSICON); showstatusicon = gtk_check_button_new_with_mnemonic ( _("Show SFLphone in the system tray")); diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index a14d089e5a..a953d06141 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -2615,32 +2615,3 @@ dbus_set_shortcuts(GHashTable * shortcuts) } } - -void dbus_enable_status_icon (const gchar *value) { - - GError *error = NULL; - - org_sflphone_SFLphone_ConfigurationManager_enable_status_icon (configurationManagerProxy, value, &error); - - if (error != NULL) { - ERROR ("Failed to call enable_status_icon on ConfigurationManager: %s", - error->message); - g_error_free (error); - } -} - -gchar* dbus_is_status_icon_enabled (void) { - - GError *error = NULL; - gchar *value = NULL; - - org_sflphone_SFLphone_ConfigurationManager_is_status_icon_enabled (configurationManagerProxy, &value, &error); - - if (error != NULL) { - ERROR ("Failed to call is_status_icon_enabled on ConfigurationManager: %s", - error->message); - g_error_free (error); - } - return value; -} - diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index 2ebdceae5e..5c81b6a9b1 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -615,7 +615,4 @@ void dbus_set_window_position_y (const guint posy); GHashTable* dbus_get_shortcuts(void); void dbus_set_shortcuts(GHashTable * shortcuts); -void dbus_enable_status_icon (const gchar*); -gchar* dbus_is_status_icon_enabled (void); - #endif diff --git a/sflphone-client-gnome/src/main.c b/sflphone-client-gnome/src/main.c index 6ab9d8c832..f534eda00d 100644 --- a/sflphone-client-gnome/src/main.c +++ b/sflphone-client-gnome/src/main.c @@ -72,7 +72,6 @@ main (int argc, char *argv[]) { // Handle logging int i; - gboolean statusicon = FALSE; // Startup logging startup_logging (); @@ -117,13 +116,12 @@ main (int argc, char *argv[]) if (sflphone_init ()) { - if (g_strcasecmp (dbus_is_status_icon_enabled (), "true") == 0) - statusicon = TRUE; + if (eel_gconf_get_integer (SHOW_STATUSICON)) + show_status_icon (); - if (statusicon) show_status_icon (); create_main_window (); - if (statusicon && dbus_is_start_hidden ()) + if (eel_gconf_get_integer (SHOW_STATUSICON) && dbus_is_start_hidden ()) { gtk_widget_hide (GTK_WIDGET( get_main_window() )); set_minimized (TRUE); diff --git a/sflphone-client-gnome/src/mainwindow.c b/sflphone-client-gnome/src/mainwindow.c index 147526c143..cf3ca81757 100644 --- a/sflphone-client-gnome/src/mainwindow.c +++ b/sflphone-client-gnome/src/mainwindow.c @@ -84,7 +84,7 @@ static gboolean window_configure_cb (GtkWidget *win, GdkEventConfigure *event) { on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED) { - if (g_strcasecmp (dbus_is_status_icon_enabled (), "true") == 0) { + if (eel_gconf_get_integer (SHOW_STATUSICON)) { gtk_widget_hide (GTK_WIDGET( get_main_window() )); set_minimized (TRUE); } diff --git a/sflphone-client-gnome/src/sflphone_const.h b/sflphone-client-gnome/src/sflphone_const.h index c675713d2a..58fb9f7675 100644 --- a/sflphone-client-gnome/src/sflphone_const.h +++ b/sflphone-client-gnome/src/sflphone_const.h @@ -188,6 +188,7 @@ log4c_category_t* log4c_sfl_gtk_category; /** Show/Hide the dialpad */ #define CONF_SHOW_DIALPAD CONF_PREFIX "/state/dialpad" #define SHOW_VOLUME_CONTROLS CONF_PREFIX "/state/volume_controls" +#define SHOW_STATUSICON CONF_PREFIX "/state/statusicon" #define NOTIFY_ALL CONF_PREFIX "/state/notify_all" #endif diff --git a/sflphone-client-gnome/src/uimanager.c b/sflphone-client-gnome/src/uimanager.c index d5ed013e54..1b185e2d80 100644 --- a/sflphone-client-gnome/src/uimanager.c +++ b/sflphone-client-gnome/src/uimanager.c @@ -430,7 +430,7 @@ static void call_minimize(void * foo UNUSED) { - if (g_strcasecmp (dbus_is_status_icon_enabled (), "true") == 0) { + if (eel_gconf_get_integer (SHOW_STATUSICON)) { gtk_widget_hide(GTK_WIDGET( get_main_window() )); set_minimized(TRUE); } -- GitLab