ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00216
lp:~indicator-applet-developers/evolution-indicator/blacklist-support into lp:evolution-indicator
Neil J. Patel has proposed merging lp:~indicator-applet-developers/evolution-indicator/blacklist-support into lp:evolution-indicator.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
Creates/removes the blacklist file when appropriate.
--
https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/blacklist-support/+merge/11887
Your team ayatana-commits is subscribed to branch lp:evolution-indicator.
=== modified file 'src/evolution-indicator.c'
--- src/evolution-indicator.c 2009-09-10 16:44:38 +0000
+++ src/evolution-indicator.c 2009-09-16 14:27:22 +0000
@@ -63,6 +63,9 @@
#define UNREAD_DATA "unread"
+#define USER_BLACKLIST_DIR "indicators/messages/applications-blacklist"
+#define USER_BLACKLIST_FILENAME "evolution"
+
static EShell *evo_shell = NULL;
static GStaticMutex mlock = G_STATIC_MUTEX_INIT;
static GConfClient *client = NULL;
@@ -98,6 +101,9 @@
static void show_evolution (gpointer arg0, gpointer arg1);
+static void show_evolution_in_indicator_applet (void);
+static void hide_evolution_in_indicator_applet (void);
+
typedef struct {
gchar *url;
gchar *name;
@@ -395,9 +401,17 @@
value = entry->value;
show_count = gconf_value_get_bool (value);
-
- show_count ? indicate_server_show (server)
- : indicate_server_hide (server);
+
+ if (show_count)
+ {
+ indicate_server_show (server);
+ show_evolution_in_indicator_applet ();
+ }
+ else
+ {
+ indicate_server_hide (server);
+ hide_evolution_in_indicator_applet ();
+ }
g_debug ("EI: Messages in panel %s",
show_count ? "true" : "false");
@@ -684,7 +698,13 @@
if (show_count)
{
indicate_server_show (server);
+ show_evolution_in_indicator_applet ();
}
+ else
+ {
+ indicate_server_hide (server);
+ hide_evolution_in_indicator_applet ();
+ }
}
else
{
@@ -705,6 +725,9 @@
indicate_server_hide (server);
g_object_unref (server);
server = NULL;
+
+ /* Remove evolution from indicator menu */
+ hide_evolution_in_indicator_applet ();
g_debug ("EI: Disabled");
}
@@ -983,3 +1006,73 @@
}
+/*
+ *
+ * SHOW/HIDE EVOLUTION IN INDICATOR APPLET
+ *
+ */
+
+static void
+show_evolution_in_indicator_applet (void)
+{
+ gchar *bpath;
+
+ bpath = g_build_filename (g_get_user_config_dir (),
+ USER_BLACKLIST_DIR,
+ USER_BLACKLIST_FILENAME,
+ NULL);
+
+ if (g_file_test (bpath, G_FILE_TEST_EXISTS))
+ {
+ GFile *bfile;
+
+ bfile = g_file_new_for_path (bpath);
+
+ if (bfile)
+ {
+ GError *error = NULL;
+
+ g_file_delete (bfile, NULL, &error);
+
+ if (error)
+ {
+ g_warning ("Unable to remove blacklist file: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (bfile);
+ }
+ }
+
+ g_free (bpath);
+}
+
+static void
+hide_evolution_in_indicator_applet (void)
+{
+ gchar *bpath;
+ GError *error = NULL;
+
+ bpath = g_build_filename (g_get_user_config_dir (),
+ USER_BLACKLIST_DIR,
+ USER_BLACKLIST_FILENAME,
+ NULL);
+
+ if (g_file_set_contents (bpath,
+ EVOLUTION_DESKTOP_FILE,
+ -1,
+ &error))
+ {
+ g_debug ("Successfully wrote blacklist file to %s", bpath);
+ }
+ else
+ {
+ g_debug ("Unable to write blacklist file to %s: %s",
+ bpath,
+ error ? error->message : "Unknown");
+ if (error)
+ g_error_free (error);
+ }
+
+ g_free (bpath);
+}
Follow ups