ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00254
[Branch ~indicator-applet-developers/evolution-indicator/trunk] Rev 53: modified:
Merge authors:
Neil J. Patel (njpatel)
Related merge proposals:
https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/blacklist-support/+merge/11887
proposed by: Neil J. Patel (njpatel)
review: Approve - Ted Gould (ted)
------------------------------------------------------------
revno: 53 [merge]
committer: Neil Jagdish Patel <neil.patel@xxxxxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2009-09-17 10:25:05 +0100
message:
modified:
src/evolution-indicator.c
pending merges:
Neil Jagdish Patel 2009-09-16 modified:
Neil Jagdish Patel 2009-09-16 modified:
Neil Jagdish Patel 2009-09-16 modified:
modified:
src/evolution-indicator.c
--
lp:evolution-indicator
https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/trunk
Your team ayatana-commits is subscribed to branch lp:evolution-indicator.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/trunk/+edit-subscription.
=== modified file 'src/evolution-indicator.c'
--- src/evolution-indicator.c 2009-09-16 14:33:18 +0000
+++ src/evolution-indicator.c 2009-09-17 09:25:05 +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;
@@ -398,9 +404,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");
@@ -710,7 +724,13 @@
if (show_count)
{
indicate_server_show (server);
+ show_evolution_in_indicator_applet ();
}
+ else
+ {
+ indicate_server_hide (server);
+ hide_evolution_in_indicator_applet ();
+ }
}
else
{
@@ -731,6 +751,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");
}
@@ -1010,3 +1033,111 @@
}
+/*
+ *
+ * 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 *bdir;
+ gchar *bpath;
+ GError *error = NULL;
+
+ bdir = g_build_filename (g_get_user_config_dir (),
+ USER_BLACKLIST_DIR,
+ NULL);
+ if (!g_file_test (bdir, G_FILE_TEST_IS_DIR))
+ {
+ GFile *dirfile;
+
+ dirfile = g_file_new_for_path (bdir);
+ if (dirfile)
+ {
+ g_file_make_directory_with_parents (dirfile,
+ NULL,
+ &error);
+ if (error)
+ {
+ g_warning ("Unable to create blacklist directory: %s",
+ error->message);
+ g_error_free (error);
+ g_object_unref (dirfile);
+ g_free (bdir);
+ g_free (bpath);
+ return;
+ }
+ }
+ else
+ {
+ g_warning ("Unable to create blacklist directory: Unable to create "
+ "GFile for path %s", bdir);
+ g_free (bdir);
+ g_free (bpath);
+ return;
+ }
+
+ g_object_unref (dirfile);
+ }
+ g_free (bdir);
+
+ 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);
+}