Only in evolution-indicator-0.2.8.mod/src/: .deps diff -rup evolution-indicator-0.2.8/src/evolution-indicator.c evolution-indicator-0.2.8.mod/src/evolution-indicator.c --- evolution-indicator-0.2.8/src/evolution-indicator.c 2010-03-30 14:23:05.000000000 -0400 +++ evolution-indicator-0.2.8.mod/src/evolution-indicator.c 2010-04-09 16:28:04.314108385 -0400 @@ -55,6 +55,7 @@ #define PLAY_SOUND CONF_DIR"/play_sound" #define SHOW_BUBBLE CONF_DIR"/show_bubble" #define SHOW_NEW_IN_PANEL CONF_DIR"/show_new_messages_in_panel" +#define MINIMIZE_TO_APPLET CONF_DIR"/minimize_to_applet" #define ACCOUNT_DIR "/apps/evolution/mail" #define ACCOUNTS ACCOUNT_DIR"/accounts" @@ -84,11 +85,13 @@ static gboolean only_inbox = TRUE; static gboolean play_sound = TRUE; static gboolean show_bubble = TRUE; static gboolean show_count = FALSE; +static gboolean minimize_to_applet = TRUE; static guint only_inbox_id = 0; static guint play_sound_id = 0; static guint show_bubble_id = 0; static guint show_count_id = 0; +static guint minimize_to_applet_id = 0; static guint accounts_id = 0; static gint message_count = 0; @@ -96,10 +99,13 @@ 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 org_gnome_shell_started_done (EPlugin *ep, ESEventTargetShell *t); +void org_gnome_closing_window (EPlugin *ep, ESEventTargetShell *t); int e_plugin_lib_enable (EPluginLib *ep, int enable); GtkWidget * e_plugin_lib_get_configure_widget (EPlugin *epl); +static GtkWidget * get_cfg_widget (void); + static void show_evolution (gpointer arg0, guint timestamp, gpointer arg1); static void show_evolution_in_indicator_applet (void); @@ -123,18 +129,6 @@ enum { REAP_NAME }; -static GtkWidget * -get_cfg_widget (void) -{ - GtkWidget *vbox; - - vbox = gtk_vbox_new (FALSE, 6); - - gtk_widget_show (vbox); - - return vbox; -} - static gboolean evolution_is_focused (void) { @@ -219,7 +213,8 @@ set_indicator_unread_count (IndicateIndi void org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t) { - g_return_if_fail (t != NULL); + + g_return_if_fail (t != NULL); if (!t->new) return; @@ -340,6 +335,14 @@ org_gnome_mail_read_notify (EPlugin *ep, { GSList *i; + /* If we have the minimize_to_applet option active, preparing_to_quit might + * still be 1 from the last closing_window event and needs to be reset. + */ + + if (minimize_to_applet && evo_shell->priv->preparing_to_quit) { + evo_shell->priv->preparing_to_quit=0; + } + g_return_if_fail (t != NULL); g_static_mutex_lock (&mlock); @@ -398,6 +401,21 @@ play_sound_changed (GConfClient *gclient } static void +minimize_to_applet_changed (GConfClient *gclient, + guint id, + GConfEntry *entry, + gpointer data) +{ + GConfValue *value; + + value = entry->value; + + minimize_to_applet = gconf_value_get_bool (value); + + g_debug ("EI: Minimize to applet %s", minimize_to_applet ? "true" : "false"); +} + +static void show_new_in_panel_changed (GConfClient *gclient, guint id, GConfEntry *entry, @@ -764,6 +782,12 @@ e_plugin_lib_enable (EPluginLib *ep, int show_count_id = gconf_client_notify_add (client, SHOW_NEW_IN_PANEL, show_new_in_panel_changed, NULL, NULL, NULL); + minimize_to_applet = gconf_client_get_bool (client, + MINIMIZE_TO_APPLET, + NULL); + minimize_to_applet_id = gconf_client_notify_add (client, MINIMIZE_TO_APPLET, + minimize_to_applet_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, @@ -787,6 +811,7 @@ e_plugin_lib_enable (EPluginLib *ep, int 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, minimize_to_applet_id); gconf_client_notify_remove (client, accounts_id); g_object_unref (client); client = NULL; @@ -838,6 +863,25 @@ org_gnome_shell_started_done (EPlugin *e evo_shell = t->shell; } +void +org_gnome_closing_window (EPlugin *ep, ESEventTargetShell *t) +{ + + GtkWindow *mail_window = NULL; + + /*If its the last window and the option is enabled, hide the window + *instead of deleting it, and tell evolution not to quit + */ + + if (minimize_to_applet && g_list_length (evo_shell->priv->windows) == 1) { + mail_window = evo_shell->priv->windows->data; + gtk_widget_hide_on_delete (GTK_WIDGET(mail_window)); + evo_shell->priv->preparing_to_quit=1; + } + + return; +} + static void on_combo_changed (GtkComboBox *combo, gpointer null) { @@ -868,6 +912,13 @@ on_show_panel_toggled (GtkToggleButton * gtk_toggle_button_get_active (button), NULL); } +static void +on_minimize_to_applet_toggled (GtkToggleButton *button, gpointer null) +{ + gconf_client_set_bool (client, MINIMIZE_TO_APPLET, + gtk_toggle_button_get_active (button), NULL); +} + GtkWidget * org_gnome_get_prefs (EPlugin *epl, EConfigHookItemFactoryData *data) { @@ -968,6 +1019,72 @@ org_gnome_get_prefs (EPlugin *epl, EConf return check; } +static GtkWidget * +get_cfg_widget (void) +{ + GtkWidget *vbox, *box, *check; + GtkWidget *label1, *label2, *label3, *combo; + const gchar *markup = "%s"; + gchar *str1; + gchar *str2; + + vbox = gtk_vbox_new (FALSE, 6); + + box = gtk_hbox_new (FALSE, 0); + + check = gtk_check_button_new_with_mnemonic (_("Keep _Evolution running in the background")); + g_object_set (check, "active", minimize_to_applet, NULL); + gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); + g_signal_connect (check, "toggled", G_CALLBACK (on_minimize_to_applet_toggled), NULL); + + label1 = gtk_label_new (" "); + str1 = g_strdup_printf (markup, _("When new mail arri_ves in")); + gtk_label_set_markup_with_mnemonic (GTK_LABEL (label1), str1); + g_free (str1); + + label2 = gtk_label_new (" "); + + combo = gtk_combo_box_new_text (); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), + n_accounts > 1 ? _("any Inbox") : _("Inbox")); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("any Folder")); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), + only_inbox ? 0 : 1); + g_signal_connect (combo, "changed", G_CALLBACK (on_combo_changed), NULL); + + label3 = gtk_label_new (":"); + /* i18n: ':' is used in the end of the above line (When New Mail Arrives:)*/ + str2 = g_strdup_printf (markup, _(":")); + gtk_label_set_markup (GTK_LABEL (label3), str2); + g_free (str2); + + gtk_box_pack_start (GTK_BOX (box), label1, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (box), label2, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (box), combo, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (box), label3, FALSE, FALSE, 0); + + gtk_box_pack_start (GTK_BOX (vbox), box, FALSE, FALSE, 0); + + check = gtk_check_button_new_with_mnemonic (_("Pla_y a sound")); + g_object_set (check, "active", play_sound, NULL); + gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); + g_signal_connect (check, "toggled", G_CALLBACK (on_sound_toggled), NULL); + + check = gtk_check_button_new_with_mnemonic (_("_Display a notification")); + g_object_set (check, "active", show_bubble, NULL); + gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); + g_signal_connect (check, "toggled", G_CALLBACK (on_bubble_toggled), NULL); + + check = gtk_check_button_new_with_mnemonic (_("_Indicate new messages in the panel")); + g_object_set (check, "active", show_count, NULL); + gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); + g_signal_connect (check, "toggled", G_CALLBACK (on_show_panel_toggled), NULL); + + gtk_widget_show_all (vbox); + + return vbox; +} + /* * * SHOW EVOLUTION CODE @@ -996,7 +1113,12 @@ show_evolution (gpointer arg0, guint tim { if (g_strcmp0 (MAIL_ICON, gtk_window_get_icon_name (window)) == 0) { - mail_window = window; + /* Preferentially show visible windows */ + if (!mail_window) { + mail_window = window; + } else if (gtk_widget_get_visible(GTK_WIDGET(window))) { + mail_window = window; + } } } else @@ -1014,6 +1136,10 @@ show_evolution (gpointer arg0, guint tim return; } + if (minimize_to_applet && evo_shell->priv->preparing_to_quit) { + evo_shell->priv->preparing_to_quit=0; + } + gtk_window_present_with_time (mail_window, timestamp); for (i = indicators; i; i = i->next) Only in evolution-indicator-0.2.8.mod/src/: Makefile diff -rup evolution-indicator-0.2.8/src/org-freedesktop-evolution-indicator.eplug.in evolution-indicator-0.2.8.mod/src/org-freedesktop-evolution-indicator.eplug.in --- evolution-indicator-0.2.8/src/org-freedesktop-evolution-indicator.eplug.in 2010-03-04 12:23:38.000000000 -0500 +++ evolution-indicator-0.2.8.mod/src/org-freedesktop-evolution-indicator.eplug.in 2010-04-09 08:21:47.657255447 -0400 @@ -17,6 +17,7 @@ +