Lars Uebernickel has proposed merging lp:~larsu/evolution-indicator/messaging-menu-fixes into lp:evolution-indicator.
Requested reviews: Mathieu Trudel-Lapierre (mathieu-tl) For more details, see: https://code.launchpad.net/~larsu/evolution-indicator/messaging-menu-fixes/+merge/154833 A couple of minor fixes to lp:~twolife/evolution-indicator/eds-3.6_messaging-menu that I found while testing. -- https://code.launchpad.net/~larsu/evolution-indicator/messaging-menu-fixes/+merge/154833 Your team ayatana-commits is subscribed to branch lp:evolution-indicator.
=== modified file 'configure.ac' --- configure.ac 2012-05-25 21:05:11 +0000 +++ configure.ac 2013-03-21 23:25:27 +0000 @@ -70,7 +70,6 @@ AC_SUBST(GCC_FLAGS) PKG_CHECK_MODULES(DEPS, - indicate-0.7 >= 0.6.90 $EVOLUTION_PLUGIN dbus-1 dbus-glib-1 @@ -81,6 +80,7 @@ libebackend-1.2 libsoup-2.4 gconf-2.0 + messaging-menu ) AC_SUBST(DEPS_CFLAGS) AC_SUBST(DEPS_LIBS) === modified file 'src/evolution-indicator.c' --- src/evolution-indicator.c 2012-05-25 21:05:11 +0000 +++ src/evolution-indicator.c 2013-03-21 23:25:27 +0000 @@ -28,6 +28,7 @@ #include <glib/gprintf.h> #include <gconf/gconf.h> +#include <gconf/gconf-client.h> #include <canberra.h> #include <libnotify/notify.h> @@ -44,9 +45,7 @@ #include <camel/camel.h> -#include <libindicate/server.h> -#include <libindicate/indicator.h> -#include <libindicate/indicator-messages.h> +#include <messaging-menu.h> #include <unity.h> @@ -58,22 +57,15 @@ #define SHOW_BUBBLE CONF_DIR"/show_bubble" #define SHOW_NEW_IN_PANEL CONF_DIR"/show_new_messages_in_panel" -#define ACCOUNT_DIR "/apps/evolution/mail" -#define ACCOUNTS ACCOUNT_DIR"/accounts" - #define EVOLUTION_DESKTOP_FILE "/usr/share/applications/evolution.desktop" #define UNREAD_DATA "unread" -#define USER_BLACKLIST_DIR "indicators/messages/applications-blacklist" -#define USER_BLACKLIST_FILENAME "evolution" - -static GStaticMutex mlock = G_STATIC_MUTEX_INIT; +static GMutex mlock; static GConfClient *client = NULL; -static IndicateServer *server = NULL; -static GSList *indicators = NULL; -static gint n_accounts = 0; +static MessagingMenuApp *mmapp = NULL; +static GSList *accounts = NULL; static UnityLauncherEntry *launcher = NULL; @@ -91,50 +83,25 @@ static guint play_sound_id = 0; static guint show_bubble_id = 0; static guint show_count_id = 0; -static guint accounts_id = 0; static gint message_count = 0; void org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t); void org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t); +void update_unity_launcher_count (); int e_plugin_lib_enable (EPlugin *ep, int enable); GtkWidget * e_plugin_lib_get_configure_widget (EPlugin *ep); -static void show_evolution (gpointer arg0, guint timestamp, gpointer arg1); - -static void show_evolution_in_indicator_applet (void); -static void hide_evolution_in_indicator_applet (void); +static void show_evolution (MessagingMenuApp *mmapp, const gchar *uid, gpointer user_data); typedef struct { - gchar *url; - gchar *name; - gchar *parent; - gchar *last_parent; - - gint reap_type; - - gboolean enabled; - -} ParserData; - -enum { - REAP_NONE = 0, - REAP_URL, - REAP_NAME -}; - -static GtkWidget * -get_cfg_widget (void) -{ - GtkWidget *vbox; - - vbox = gtk_vbox_new (FALSE, 6); - - gtk_widget_show (vbox); - - return vbox; -} + gchar *name; + gchar *uid; + gint n_count; +} MessagingMailAccount; +MessagingMailAccount * find_account_for_uid(GSList*, const gchar*); +static MessagingMailAccount * ensure_account_for_uid(const gchar*); static gboolean evolution_is_focused (void) @@ -195,95 +162,57 @@ return FALSE; } -static gint -get_indicator_unread_count (IndicateIndicator *indicator) -{ - return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (indicator), - UNREAD_DATA)); -} - -static void -set_indicator_unread_count (IndicateIndicator *indicator, gint count) -{ - gchar *count_str; - - count_str = g_strdup_printf ("%d", count); - indicate_indicator_set_property (indicator, - INDICATE_INDICATOR_MESSAGES_PROP_COUNT, - count_str); - g_object_set_data (G_OBJECT (indicator), - UNREAD_DATA, - GINT_TO_POINTER (count)); - - g_free (count_str); -} - void org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t) { - gchar *url; - CamelURL *service_url; + MessagingMailAccount *account; + const gchar *uid; g_return_if_fail (t != NULL); - service_url = camel_service_new_camel_url (CAMEL_SERVICE (t->store)); - url = camel_url_to_string (service_url, 0); - camel_url_free (service_url); + uid = camel_service_get_uid (CAMEL_SERVICE (t->store)); if (!t->new) - return; + return; if (only_inbox && !(t->is_inbox)) { - g_debug ("EI: %s is not an inbox", url); + g_debug ("EI: %s is not an inbox", t->folder_name); return; } if (evolution_is_focused ()) -{ + { g_debug ("EI: Evolution is focused"); return; } - g_static_mutex_lock (&mlock); - - g_debug ("EI:mail_new_notify: %s", url); - - message_count += t->new; - - if (show_count) - { - IndicateIndicator *indicator = NULL; - GSList *i; - - for (i = indicators; i; i = i->next) - { - IndicateIndicator *indi = i->data; - - if (g_strstr_len (url, - -1, - indicate_indicator_get_property (indi, "url"))) + g_mutex_lock (&mlock); + + g_debug ("EI:mail_new_notify: %s/%s", uid, t->folder_name); + + account = ensure_account_for_uid (uid); + if(account) { + account->n_count += t->new; + message_count += t->new; + + if (show_count) + { + if (messaging_menu_app_has_source(MESSAGING_MENU_APP (mmapp), uid)) { - indicator = indi; - break; - } - } - if (indicator) - { - gint count; - - count = get_indicator_unread_count (indicator); - set_indicator_unread_count (indicator, count + t->new); + messaging_menu_app_set_source_count (MESSAGING_MENU_APP (mmapp), uid, account->n_count); + } + else { + gchar *name = account->name; + messaging_menu_app_append_source_with_count (MESSAGING_MENU_APP (mmapp), uid, NULL, name, account->n_count); + } + messaging_menu_app_draw_attention (MESSAGING_MENU_APP (mmapp), uid); + } - indicate_indicator_set_property (indicator, - INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, - "true"); - } - else - { - g_warning ("EI: Unable to find account that matches %s", url); - } - } + } + else { + g_warning ("EI: Unable to find account that matches %s", uid); + } update_unity_launcher_count (); @@ -340,59 +269,47 @@ g_warning ("EI: Unable to play sound: %s\n", ca_strerror (ret)); } - g_static_mutex_unlock (&mlock); + g_mutex_unlock (&mlock); } void org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t) { + MessagingMailAccount *account; + const gchar *uid; + g_return_if_fail (t != NULL); - GSList *i; + uid = camel_service_get_uid (CAMEL_SERVICE (camel_folder_get_parent_store (t->folder))); - g_static_mutex_lock (&mlock); + g_mutex_lock (&mlock); g_debug ("EI: mail_read_notify"); - for (i = indicators; i; i = i->next) - { - IndicateIndicator *indicator = i->data; - - set_indicator_unread_count (indicator, 0); - indicate_indicator_set_property (indicator, - INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, - "false"); - - g_debug ("EI: Setting %s to 0 unread messages", - indicate_indicator_get_property (indicator, "name")); - - } - message_count = 0; + account = ensure_account_for_uid (uid); + if(account) + { + messaging_menu_app_remove_source (MESSAGING_MENU_APP (mmapp), uid); + message_count -= account->n_count; + account->n_count = 0; + g_debug ("EI: Setting %s to 0 unread messages", uid); + } + else { + g_warning ("EI: Unable to find account that matches %s", uid); + } update_unity_launcher_count (); - g_static_mutex_unlock (&mlock); + g_mutex_unlock (&mlock); } void update_unity_launcher_count () { - GSList *i; - int count = 0; - g_debug ("EI: update_unity_launcher_count"); - for (i = indicators; i; i = i->next) - { - IndicateIndicator *indicator = i->data; - - count = count + get_indicator_unread_count (indicator); - - g_debug ("EI: Setting count to %d unread messages", count); - - } - unity_launcher_entry_set_count (launcher, count); - if (count > 0) + unity_launcher_entry_set_count (launcher, message_count); + if (message_count > 0) { unity_launcher_entry_set_count_visible (launcher, TRUE); } else { @@ -444,17 +361,11 @@ value = entry->value; show_count = gconf_value_get_bool (value); - + if (show_count) - { - indicate_server_show (server); - show_evolution_in_indicator_applet (); - } + messaging_menu_app_register (mmapp); else - { - indicate_server_hide (server); - hide_evolution_in_indicator_applet (); - } + messaging_menu_app_unregister (mmapp); g_debug ("EI: Messages in panel %s", show_count ? "true" : "false"); @@ -475,246 +386,103 @@ g_debug ("EI: Show Bubbles %s", show_bubble ? "true" : "false"); } -static IndicateIndicator * -find_indicator_for_url (GSList *indicator_list, const gchar *url) +MessagingMailAccount * +find_account_for_uid (GSList *accounts_list, const gchar *uid) { GSList *i; - for (i = indicator_list; i; i = i->next) + for (i = accounts_list; i; i = i->next) { - IndicateIndicator *indicator = i->data; + MessagingMailAccount *a = i->data; - if (g_strcmp0 (indicate_indicator_get_property (indicator, "url"), url) + if (g_strcmp0 (a->uid, uid) == 0) - return indicator; + return a; } return NULL; } -static IndicateIndicator * -create_indicator (const gchar *url, const gchar *name) +void +unref_account(MessagingMailAccount *m) { - IndicateIndicator *indicator; - - indicator = indicate_indicator_new (); - indicate_indicator_set_property (indicator, - INDICATE_INDICATOR_MESSAGES_PROP_NAME, - name); - indicate_indicator_set_property (indicator, - "url", - url); - set_indicator_unread_count (indicator, 0); - indicate_indicator_show (indicator); - - /* FIXME: I need to find a way to show a mailbox individually */ - g_signal_connect (indicator, "user-display", - G_CALLBACK (show_evolution), NULL); - - g_debug ("EI: New Indicator: %s %s", name, url); - - return indicator; + g_free(m->name); + g_free(m->uid); + g_free(m); } -static void -start_element_handler (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) +static ESource * +mail_source_from_uid (const gchar *uid) { - ParserData *data = (ParserData *)user_data; - - if (g_strcmp0 (element_name, "account") == 0) - { - gint i = 0; - - while (attribute_names[i] != NULL) + ESourceRegistry *registry; + GError *error = NULL; + GList *sources; + GList *it; + ESource *source = NULL; + + registry = e_source_registry_new_sync (NULL, &error); + if (!registry) + { + g_warning ("Failed to get access to source registry: %s\n", error->message); + g_error_free (error); + return NULL; + } + + sources = e_source_registry_list_sources (registry, E_SOURCE_EXTENSION_MAIL_ACCOUNT); + for (it = sources; it; it = it->next) + { + if (g_str_equal (uid, e_source_get_uid (it->data))) { - if (g_strcmp0 (attribute_names[i], "name") == 0) - { - data->name = g_strdup (attribute_values[i]); - } - else if (g_strcmp0 (attribute_names[i], "enabled") == 0) - { - if (g_strcmp0 (attribute_values[i], "false") == 0) - data->enabled = FALSE; - } - i++; + source = g_object_ref (it->data); + break; } } - else if (g_strcmp0 (element_name, "url") == 0) - data->reap_type = REAP_URL; - else - data->reap_type = REAP_NONE; - - if (data->last_parent) - g_free (data->last_parent); - - data->last_parent = data->parent; - data->parent = g_strdup (element_name); -} - -static void -text_handler (GMarkupParseContext *context, - const gchar *text, - gsize text_len, - gpointer user_data, - GError **error) -{ - ParserData *data = (ParserData *)user_data; - - if (!data->url - && data->reap_type == REAP_URL - && g_strcmp0(data->last_parent, "source") == 0) - { - gchar **tokens; - - tokens = g_strsplit (text, ";", 2); - - data->url = g_strdup (tokens[0]); - - /* Accounts with no configured way to receive mail will not have a URL */ - if (!data->url) - data->enabled = FALSE; - - g_strfreev (tokens); - } -} - -static void -update_accounts (void) -{ - GSList *accounts; - GError *error = NULL; - gint i = 1; - GTimeVal timeval = { 0 }; - - g_get_current_time (&timeval); - accounts = gconf_client_get_list (client, - ACCOUNTS, - GCONF_VALUE_STRING, - &error); - if (accounts == NULL || error) - { - g_warning ("EI: Unable to determine number of accounts, " - "defaulting to '1' (%s)", - error ? error->message : "unknown"); - if (error) - g_error_free (error); - - /* We could have this as 0 too, as it won't effect anything. It just - * seems to make more sense to have it default at 1 - */ - n_accounts = 1; - } - else - { - GSList *old_list; - GSList *a; - static GMarkupParser parser = { - start_element_handler, - NULL, - text_handler, - NULL, - NULL - }; - - old_list = indicators; - indicators = NULL; - - for (a = accounts; a; a = a->next) + + g_list_free_full (sources, g_object_unref); + g_object_unref (registry); + return source; +} + +static MessagingMailAccount * +ensure_account_for_uid (const gchar *uid) +{ + MessagingMailAccount *account; + ESource *source; + + if ((account = find_account_for_uid (accounts, uid))) + return account; + + if ((source = mail_source_from_uid (uid))) + { + if (e_source_get_removable(source) && e_source_get_enabled(source)) { - gchar *account_info = a->data; - GMarkupParseContext *context; - ParserData data = { NULL, NULL, NULL, NULL, 0, TRUE }; - IndicateIndicator *indicator; - - /* Parse account XML to get some useful details about the account */ - context = g_markup_parse_context_new (&parser, 0, &data, NULL); - g_markup_parse_context_parse (context, - account_info, - strlen (account_info), - NULL); - - /* Check to see account already exists and, if not, create it */ - indicator = find_indicator_for_url (indicators, data.url); - if (indicator) - { - old_list = g_slist_remove (old_list, indicator); - indicators = g_slist_append (indicators, indicator); - } + ESourceExtension *extension; + const gchar *protocol; + + extension = e_source_get_extension (source, E_SOURCE_EXTENSION_MAIL_ACCOUNT); + protocol = e_source_backend_get_backend_name (E_SOURCE_BACKEND (extension)); + + account = g_new(MessagingMailAccount, 1); + account->uid = g_strdup (uid); + account->n_count = 0; + + if (g_str_has_prefix (protocol, "pop")) + account->name = g_strdup (g_dgettext (EVO_I18N_DOMAIN, "Inbox")); else - { - if (data.url && g_str_has_prefix (data.url, "pop:")) - { - indicator = create_indicator ("pop:", - g_dgettext (EVO_I18N_DOMAIN, - "Inbox")); - } - else - { - indicator = create_indicator (data.url, data.name); - } - indicators = g_slist_append (indicators, indicator); - - g_debug ("EI: New account: %s (%s)", data.name, data.url); - } - - if (!data.enabled) - indicate_indicator_hide (indicator); - - /* Fake a time */ - g_time_val_add (&timeval, -1000000 * 60 * i); - indicate_indicator_set_property_time (indicator, - INDICATE_INDICATOR_MESSAGES_PROP_TIME, - &timeval); - - i++; - - /* Clean up */ - g_free (data.url); - g_free (data.name); - g_free (data.parent); - g_free (data.last_parent); - data.reap_type = REAP_NONE; - data.enabled = TRUE; - - g_markup_parse_context_free (context); + account->name = e_source_dup_display_name (source); + + accounts = g_slist_append (accounts, account); + g_debug ("EI: New account: %s (%s)", account->name, account->uid); } - g_slist_foreach (old_list, (GFunc)g_object_unref, NULL); - g_slist_free (old_list); - - n_accounts = g_slist_length (accounts); - g_slist_free (accounts); + g_object_unref (source); } - g_debug ("EI: Number of email accounts: %d", n_accounts); -} - -static void -on_accounts_changed (GConfClient *gclient, - guint id, - GConfEntry *entry, - gpointer data) -{ - update_accounts (); + return account; } #define EVO_CONTACTS_CMD "evolution -c contacts" #define EVO_COMPOSE_CMD "evolution mailto:" -static void -command_item_activate (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) -{ - gchar * command = (gchar *)user_data; - if (!g_spawn_command_line_async(command, NULL)) { - g_warning("EI: Unable to execute command '%s'", command); - } - return; -} - int e_plugin_lib_enable (EPlugin *ep, int enable) { @@ -748,27 +516,10 @@ } } - server = indicate_server_ref_default (); - indicate_server_set_type (server, "message"); - indicate_server_set_desktop_file (server, EVOLUTION_DESKTOP_FILE); - g_signal_connect (server, "server-display", - G_CALLBACK (show_evolution), NULL); - - DbusmenuServer * menu_server = dbusmenu_server_new("/messaging/commands"); - DbusmenuMenuitem * root = dbusmenu_menuitem_new(); - - DbusmenuMenuitem * mi = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Compose New Message")); - g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(command_item_activate), EVO_COMPOSE_CMD); - dbusmenu_menuitem_child_append(root, mi); - - mi = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Contacts")); - g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(command_item_activate), EVO_CONTACTS_CMD); - dbusmenu_menuitem_child_append(root, mi); - - dbusmenu_server_set_root(menu_server, root); - indicate_server_set_menu(server, menu_server); + if (mmapp == NULL) + mmapp = messaging_menu_app_new ("evolution.desktop"); + + g_signal_connect (mmapp, "activate-source", G_CALLBACK (show_evolution), NULL); launcher = unity_launcher_entry_get_for_desktop_file (EVOLUTION_DESKTOP_FILE); @@ -797,22 +548,10 @@ show_count_id = gconf_client_notify_add (client, SHOW_NEW_IN_PANEL, show_new_in_panel_changed, NULL, NULL, NULL); - gconf_client_add_dir (client, ACCOUNT_DIR,GCONF_CLIENT_PRELOAD_NONE, NULL); - update_accounts (); - accounts_id = gconf_client_notify_add (client, ACCOUNTS, - on_accounts_changed, NULL, - NULL, NULL); - if (show_count) - { - indicate_server_show (server); - show_evolution_in_indicator_applet (); - } + messaging_menu_app_register (mmapp); else - { - indicate_server_hide (server); - hide_evolution_in_indicator_applet (); - } + messaging_menu_app_unregister (mmapp); } else { @@ -820,35 +559,28 @@ gconf_client_notify_remove (client, play_sound_id); gconf_client_notify_remove (client, show_bubble_id); gconf_client_notify_remove (client, show_count_id); - gconf_client_notify_remove (client, accounts_id); g_object_unref (client); client = NULL; - + /* Free indicators */ - g_slist_foreach (indicators, (GFunc)g_object_unref, NULL); - g_slist_free (indicators); - indicators = NULL; - - /* Free server */ - indicate_server_hide (server); - g_object_unref (server); - server = NULL; - - /* Remove evolution from indicator menu */ - hide_evolution_in_indicator_applet (); - + g_slist_foreach (accounts, (GFunc)unref_account, NULL); + g_slist_free (accounts); + accounts = NULL; + + messaging_menu_app_unregister (mmapp); + g_debug ("EI: Disabled"); } - return 0; + return 0; } GtkWidget * e_plugin_lib_get_configure_widget (EPlugin *ep) { g_debug ("EI: Get Configure Widget"); - return get_cfg_widget (); + return NULL; } static void @@ -911,7 +643,7 @@ gtk_box_reorder_child (GTK_BOX (gtk_widget_get_parent (frame)), frame, 0); - box = gtk_hbox_new (FALSE, 0); + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_frame_set_label_widget (GTK_FRAME (frame), box); gtk_widget_show (frame); @@ -925,12 +657,12 @@ #if GTK_CHECK_VERSION(2, 91, 0) combo = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), - n_accounts > 1 ? _("any Inbox") : _("Inbox")); + g_slist_length (accounts) > 1 ? _("any Inbox") : _("Inbox")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("any Folder")); #else combo = gtk_combo_box_new_text (); gtk_combo_box_append_text (GTK_COMBO_BOX (combo), - n_accounts > 1 ? _("any Inbox") : _("Inbox")); + g_slist_length (accounts) > 1 ? _("any Inbox") : _("Inbox")); gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("any Folder")); #endif gtk_combo_box_set_active (GTK_COMBO_BOX (combo), @@ -965,7 +697,7 @@ g_debug ("EI: Woops, couldn't find the GtkFrame in the widget hierarchy"); } - vbox = gtk_vbox_new (FALSE, 8); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); gtk_table_attach((GtkTable *)data->parent, vbox, 0, 1, 0, 1, 0, 0, 0, 0); check = gtk_check_button_new_with_mnemonic (_("Pla_y a sound")); @@ -995,7 +727,7 @@ */ static void -show_evolution (gpointer arg0, guint timestamp, gpointer arg1) +show_evolution (MessagingMenuApp *mmapp, const gchar *uid, gpointer user_data) { #define MAIL_ICON "evolution-mail" EShell *shell = e_shell_get_default (); @@ -1004,7 +736,7 @@ if (shell) { - GSList *i; + MessagingMailAccount *account; EShellWindow *shell_window; EShellView *shell_view; GtkAction *action; @@ -1014,7 +746,7 @@ shell_window = E_SHELL_WINDOW (e_shell_get_active_window (shell)); if (!evolution_is_focused ()) { - gtk_window_present_with_time (GTK_WINDOW (shell_window), timestamp); + gtk_window_present (GTK_WINDOW (shell_window)); } /* Switch to the mail view. */ @@ -1023,20 +755,19 @@ gtk_action_activate (action); /* Setup the indicators */ - for (i = indicators; i; i = i->next) + account = ensure_account_for_uid (uid); + if(account) { - IndicateIndicator *indicator = i->data; - - set_indicator_unread_count (indicator, 0); - indicate_indicator_set_property (indicator, - INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, - "false"); - - g_debug ("EI: Setting %s to 0 unread messages", - indicate_indicator_get_property (indicator, "name")); - - } - message_count = 0; + gchar *uid = account->uid; + + message_count -= account->n_count; + account->n_count = 0; + g_debug ("EI: Setting %s to 0 unread messages", uid); + } + else { + g_warning ("EI: Unable to find account that matches %s", uid); + } + update_unity_launcher_count (); } else @@ -1045,113 +776,3 @@ return; } } - - -/* - * - * 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 ("EI: 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 ("EI: 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 ("EI: 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 ("EI: Successfully wrote blacklist file to %s", bpath); - } - else - { - g_debug ("EI: Unable to write blacklist file to %s: %s", - bpath, - error ? error->message : "Unknown"); - if (error) - g_error_free (error); - } - - g_free (bpath); -} === modified file 'src/org-freedesktop-evolution-indicator.eplug.xml' --- src/org-freedesktop-evolution-indicator.eplug.xml 2011-07-10 13:45:32 +0000 +++ src/org-freedesktop-evolution-indicator.eplug.xml 2013-03-21 23:25:27 +0000 @@ -5,7 +5,8 @@ location="@PLUGINDIR@/liborg-freedesktop-evolution-indicator.so" id="org.freedesktop.evolution_indicator" domain="@GETTEXT_PACKAGE@" - _name="Evolution Indicator"> + _name="Evolution Indicator" + load-on-startup="true"> <_description>Shows new mail count in a message indicator.</_description> <author name="Neil Jagdish Patel" email="neil.pa...@canonical.com"/>
_______________________________________________ Mailing list: https://launchpad.net/~ayatana-commits Post to : ayatana-commits@lists.launchpad.net Unsubscribe : https://launchpad.net/~ayatana-commits More help : https://help.launchpad.net/ListHelp