Re: [evolution-patches] Mailer bug #127516 Panel notification applet for new mail (bounties)
- From: Jeffrey Stedfast <fejj ximian com>
- To: Miguel Angel Lopez Hernandez <miguel gulev org mx>
- Cc: evolution-patches ximian com
- Subject: Re: [evolution-patches] Mailer bug #127516 Panel notification applet for new mail (bounties)
- Date: Mon, 12 Jan 2004 12:43:44 -0500
On Sun, 2004-01-11 at 06:38, Miguel Angel Lopez Hernandez wrote:
> Hi all,
>
> I've finished the panel notification applet, you can setup it by means
> of the "New Mail Notification" tab I've added to the Mailer Preferences.
> The notification types includes:
>
> + None
> - Do not notify when new mail arrives.
>
> + All Folders
> - Notify when new mail arrives to any folder.
> - You can setup the sound to play and image to blink in the panel
> notification area when new mail arrives.
>
> + Selected Folders
> - Notify when new mail arrives to any of the selected folders.
> - You can setup the sound to play and image to blink in the panel
> notification area for every selected folder
>
> I attach the following files:
> e-util.diff: diff file for the e-util directory.
> mail.diff: diff file for the mail directory.
> eggmarshalers.c/h: Needed to run eggtraymanager (put into e-util
> directory).
> eggtraymanager.c/h: put into e-util directory.
> em-panel-applet.c/h : The notification applet (put into mail directory)
>
> Well, this is not only my first evolution patch but my very first gnome
> patch so, I hope this is good enough :)
>
> P.D. I almost forget it... the Screenshots are in:
> http://www.gulev.org.mx/~miguel/ScreenshotsBountie/
>
> Greetings,
> Miguel
[snip]
I'm going to assume the libegg code is correct, but it needs to be
formatted the same as the rest of the evo code (use 8spc tabs, not 2
spaces)
________________________________________________________________________
> ? em-panel-applet.c
> ? em-panel-applet.h
whoops, these files are missing....
> ? evolution-mail-1.5.schemas
> Index: Makefile.am
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/Makefile.am,v
> retrieving revision 1.237
> diff -u -r1.237 Makefile.am
> --- Makefile.am 11 Dec 2003 21:00:06 -0000 1.237
> +++ Makefile.am 11 Jan 2004 10:28:24 -0000
> @@ -120,6 +120,8 @@
> em-junk-plugin.h \
> em-html-stream.c \
> em-html-stream.h \
> + em-panel-applet.c \
> + em-panel-applet.h \
> mail-account-editor.c \
> mail-account-editor.h \
> mail-account-gui.c \
> Index: em-mailer-prefs.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/em-mailer-prefs.c,v
> retrieving revision 1.4
> diff -u -r1.4 em-mailer-prefs.c
> --- em-mailer-prefs.c 11 Dec 2003 19:24:10 -0000 1.4
> +++ em-mailer-prefs.c 11 Jan 2004 10:28:24 -0000
> @@ -37,6 +37,7 @@
>
> #include "mail-config.h"
>
> +#include "em-panel-applet.h"
>
> static void em_mailer_prefs_class_init (EMMailerPrefsClass *class);
> static void em_mailer_prefs_init (EMMailerPrefs *dialog);
> @@ -387,15 +388,200 @@
> }
>
> static void
> +settings_notify_changed (GtkWidget *widget, gpointer user_data)
> +{
> + EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
> + gboolean bool;
> +
> + prefs->notify_type = gtk_option_menu_get_history (prefs->notify_menu);
> +
> + gtk_label_set_text (prefs->notify_desc, MailNotifyType[prefs->notify_type].description);
> +
> +
> + if (prefs->notify_type == MAIL_CONFIG_NOTIFY_NONE) {
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_folders), FALSE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_image), FALSE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_sound), FALSE);
> + } else if (prefs->notify_type == MAIL_CONFIG_NOTIFY_ALL) {
> + bool = gnome_icon_entry_set_filename (prefs->img_notify, prefs->image_file->str);
> + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)),
> + prefs->sound_file->str);
> + gtk_toggle_button_set_active (prefs->notify_beep, prefs->play_beep);
> + gtk_toggle_button_set_active (prefs->notify_play_sound, !prefs->play_beep);
> +
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_folders), FALSE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_image), TRUE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_sound), TRUE);
> + } else if (prefs->notify_type == MAIL_CONFIG_NOTIFY_SELECTED) {
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_folders), TRUE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_image), FALSE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_sound), FALSE);
> + }
> +}
> +
> +static void
> +notify_folder_selected (GtkTreeSelection *selection, gpointer user_data)
> +{
> + GtkTreeIter iter;
> + EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
> + gchar *name, *sound, *id, *image, *beep;
> + gboolean bool;
> +
> + if (gtk_tree_selection_get_selected (selection, NULL, &iter)) {
> + gtk_tree_model_get ((GtkTreeModel *) prefs->notify_folders_store, &iter,
> + NOTIFY_NAME_COLUMN, &name,
> + NOTIFY_SOUND_COLUMN, &sound,
> + NOTIFY_ID_COLUMN, &id,
> + NOTIFY_IMAGE_COLUMN, &image,
> + NOTIFY_BEEP_COLUMN, &beep,
> + -1);
> +
> + bool = gnome_icon_entry_set_filename (prefs->img_notify, image ? image : "");
> + bool = !strcmp("yes", beep);
> + gtk_toggle_button_set_active (prefs->notify_beep, bool);
> + gtk_toggle_button_set_active (prefs->notify_play_sound, !bool);
oops? you set bool and then overwrite it.
> + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)),
> + sound);
> +
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->del_folder), TRUE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_image), TRUE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_sound), TRUE);
> + } else {
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->del_folder), FALSE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_image), FALSE);
> + gtk_widget_set_sensitive (GTK_WIDGET (prefs->frame_sound), FALSE);
> + }
> +}
> +
> +static void
> +notify_beep_changed (GtkWidget *widget, gpointer user_data)
> +{
> + EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
> + gboolean beep = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
> + GtkTreeIter iter;
> + GtkTreeSelection *selection = gtk_tree_view_get_selection (prefs->notify_folders);
> + gchar *snd_file;
> +
> + if (prefs->notify_type == MAIL_CONFIG_NOTIFY_SELECTED) {
> + if (gtk_tree_selection_get_selected (selection, NULL, &iter)) {
> + gtk_list_store_set (GTK_LIST_STORE (prefs->notify_folders_store), &iter,
> + NOTIFY_BEEP_COLUMN, beep ? "yes" : "no",
> + -1);
> +
> + gtk_tree_model_get (GTK_TREE_MODEL (prefs->notify_folders_store), &iter,
> + NOTIFY_SOUND_COLUMN, &snd_file,
> + -1);
> +
> + if (!beep) {
> + snd_file = strcmp (snd_file, "") ? snd_file : DEFAULT_SOUND_NOTIFY;
> + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)),
> + snd_file);
> + } else {
> + snd_file = strcmp (snd_file, "") ? snd_file : "";
> + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)),
> + snd_file);
> + }
> + }
> + gtk_list_store_set (GTK_LIST_STORE (prefs->notify_folders_store), &iter,
> + NOTIFY_SOUND_COLUMN, snd_file,
> + -1);
> + } else if (prefs->notify_type == MAIL_CONFIG_NOTIFY_ALL) {
> + prefs->play_beep = beep;
> +
> + if (!beep) {
> + snd_file = strcmp (prefs->sound_file->str, "") ? prefs->sound_file->str : DEFAULT_SOUND_NOTIFY;
> + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)),
> + snd_file);
> + } else {
> + snd_file = strcmp (prefs->sound_file->str, "") ? prefs->sound_file->str : "";
> + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)),
> + snd_file);
> + }
> + }
> +
> + if (prefs->control)
> + evolution_config_control_changed (prefs->control);
> +}
> +
> +static void
> +notify_sound_changed (GtkWidget *widget, gpointer user_data)
> +{
> + EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
> + GtkWidget *entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (prefs->notify_sound_file));
> + GtkTreeIter iter;
> + GtkTreeSelection *selection = gtk_tree_view_get_selection (prefs->notify_folders);
> + char *snd_file;
> +
> + snd_file = gtk_entry_get_text (GTK_ENTRY (entry));
> +
> + if (prefs->notify_type == MAIL_CONFIG_NOTIFY_SELECTED)
> + if (gtk_tree_selection_get_selected (selection, NULL, &iter))
> + gtk_list_store_set (GTK_LIST_STORE (prefs->notify_folders_store), &iter,
> + NOTIFY_SOUND_COLUMN, snd_file,
> + -1);
> + else if (prefs->notify_type == MAIL_CONFIG_NOTIFY_ALL)
> + prefs->sound_file = g_string_assign (prefs->sound_file, snd_file);
> +
> + if (prefs->control)
> + evolution_config_control_changed (prefs->control);
> +}
> +
> +static void
> +notify_image_changed (GtkWidget *widget, gpointer user_data)
> +{
> + EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
> + GtkTreeIter iter;
> + GtkTreeSelection *selection = gtk_tree_view_get_selection (prefs->notify_folders);
> + gchar *img_file;
> + GdkPixbuf *pixbuf;
> +
> + if (prefs->notify_type == MAIL_CONFIG_NOTIFY_SELECTED) {
> + if (gtk_tree_selection_get_selected (selection, NULL, &iter)) {
> + img_file = gnome_icon_entry_get_filename (prefs->img_notify, NULL);
> + pixbuf = em_tray_get_image_scaled (img_file);
> + gtk_list_store_set (GTK_LIST_STORE (prefs->notify_folders_store), &iter,
> + NOTIFY_PIXBUF_COLUMN, pixbuf,
> + NOTIFY_IMAGE_COLUMN, img_file,
> + -1);
> + }
> + }
> +
> + if (prefs->control)
> + evolution_config_control_changed (prefs->control);
> +}
> +
> +static void
> +notify_add_folder (GtkWidget *button, gpointer user_data)
> +{
> + EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
> +
> + em_tray_add_folder (button, prefs);
> +}
> +
> +static void
> +notify_remove_folder (GtkWidget *button, gpointer user_data)
> +{
> + EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
> + GtkTreeIter iter;
> +
> + if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (prefs->notify_folders), NULL, &iter))
> + gtk_list_store_remove (GTK_LIST_STORE (prefs->notify_folders_store), &iter);
> +
> + if (prefs->control)
> + evolution_config_control_changed (prefs->control);
> +}
> +
> +static void
> em_mailer_prefs_construct (EMMailerPrefs *prefs)
> {
> GSList *list, *header_config_list, *header_add_list, *p;
> GHashTable *default_header_hash;
> GtkWidget *toplevel, *menu;
> - GtkTreeSelection *selection;
> + GtkTreeSelection *selection, *folder_selec;
why not just re-use 'selection' ?
> GtkCellRenderer *renderer;
> + GtkTreeViewColumn *column;
> GtkTreeIter iter;
> - char *font, *buf;
> + char *font, *buf, *img, *snd;
> GladeXML *gui;
> gboolean bool;
> int val, i;
> @@ -455,26 +641,74 @@
> g_signal_connect (prefs->confirm_expunge, "toggled", G_CALLBACK (settings_changed), prefs);
>
> /* New Mail Notification */
> - val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/notify/type", NULL);
> - prefs->notify_not = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyNot"));
> - gtk_toggle_button_set_active (prefs->notify_not, val == MAIL_CONFIG_NOTIFY_NOT);
> - g_signal_connect (prefs->notify_not, "toggled", G_CALLBACK (settings_changed), prefs);
> -
> + prefs->notify_type = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/notify/type", NULL);
> +
> + prefs->notify_menu = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenu_NotifyType"));
> + g_signal_connect (prefs->notify_menu, "changed", G_CALLBACK (settings_notify_changed), prefs);
> +
> + prefs->none_notify = GTK_MENU_ITEM (glade_xml_get_widget (gui, "none_notify"));
> + g_signal_connect (prefs->none_notify, "activate", G_CALLBACK (settings_changed), prefs);
> + prefs->all_folders_notify = GTK_MENU_ITEM (glade_xml_get_widget (gui, "all_folders_notify"));
> + g_signal_connect (prefs->all_folders_notify, "activate", G_CALLBACK (settings_changed), prefs);
> + prefs->selected_folders_notify = GTK_MENU_ITEM (glade_xml_get_widget (gui, "selected_folders_notify"));
> + g_signal_connect (prefs->selected_folders_notify, "activate", G_CALLBACK (settings_changed), prefs);
> +
> + prefs->notify_folders = GTK_TREE_VIEW (glade_xml_get_widget (gui, "treeviewFolders"));
> + prefs->notify_folders_store = GTK_LIST_STORE (em_tray_get_store());
> + folder_selec = gtk_tree_view_get_selection (prefs->notify_folders);
> + g_signal_connect (folder_selec, "changed", G_CALLBACK (notify_folder_selected), prefs);
> + gtk_tree_view_set_model (prefs->notify_folders, GTK_TREE_MODEL (prefs->notify_folders_store));
> +
> + renderer = gtk_cell_renderer_pixbuf_new ();
> + column = gtk_tree_view_column_new_with_attributes (N_("Image"), renderer, "pixbuf", NOTIFY_PIXBUF_COLUMN, NULL);
> + gtk_tree_view_append_column (prefs->notify_folders, column);
> + renderer = gtk_cell_renderer_text_new ();
> + column = gtk_tree_view_column_new_with_attributes (N_("Name"), renderer, "text", NOTIFY_NAME_COLUMN, NULL);
> + gtk_tree_view_append_column (prefs->notify_folders, column);
> + column = gtk_tree_view_column_new_with_attributes (N_("Sound"), renderer, "text", NOTIFY_SOUND_COLUMN, NULL);
> + gtk_tree_view_append_column (prefs->notify_folders, column);
> +
> + prefs->frame_folders = GTK_FRAME(glade_xml_get_widget (gui, "frameFolders"));
> + prefs->frame_image = GTK_FRAME(glade_xml_get_widget (gui, "frameImage"));
> + prefs->frame_sound = GTK_FRAME(glade_xml_get_widget (gui, "frameSound"));
> + prefs->notify_desc = GTK_LABEL (glade_xml_get_widget (gui, "lblDescNotifyType"));
> +
> + prefs->img_notify = glade_xml_get_widget (gui, "iconentryImageNotify");
> + img = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/notify/image", NULL);
> + prefs->image_file = g_string_new (img);
> +
> + bool = gnome_icon_entry_set_filename (prefs->img_notify, img ? img : "");
> + g_signal_connect (prefs->img_notify, "changed", G_CALLBACK (notify_image_changed), prefs);
> + g_free (img);
> +
> + prefs->notify_sound_file = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyPlaySound"));
> + snd = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/notify/sound", NULL);
> + prefs->sound_file = g_string_new (snd);
> +
> + gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), snd ? snd : "");
> + g_signal_connect (gnome_file_entry_gtk_entry (prefs->notify_sound_file), "changed",
> + G_CALLBACK (notify_sound_changed), prefs);
> + g_free (snd);
> +
> + prefs->add_folder = GTK_BUTTON(glade_xml_get_widget (gui, "buttonAddFolder"));
> + g_signal_connect (G_OBJECT (prefs->add_folder), "clicked", G_CALLBACK (notify_add_folder), prefs);
no need to wrap this in G_OBJECT(), it takes a void* argument.
> +
> + prefs->del_folder = GTK_BUTTON(glade_xml_get_widget (gui, "buttonDelFolder"));
> + g_signal_connect (G_OBJECT (prefs->del_folder), "clicked", G_CALLBACK (notify_remove_folder), prefs);
same.
> +
> prefs->notify_beep = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyBeep"));
> - gtk_toggle_button_set_active (prefs->notify_beep, val == MAIL_CONFIG_NOTIFY_BEEP);
> - g_signal_connect (prefs->notify_beep, "toggled", G_CALLBACK (settings_changed), prefs);
> + bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/notify/beep", NULL);
> + prefs->play_beep = bool;
do you really need to store the val in a temp bool var here? seems kind
of a waste...
> + gtk_toggle_button_set_active (prefs->notify_beep, bool);
> + g_signal_connect (prefs->notify_beep, "toggled", G_CALLBACK (notify_beep_changed), prefs);
>
> prefs->notify_play_sound = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyPlaySound"));
> - gtk_toggle_button_set_active (prefs->notify_play_sound, val == MAIL_CONFIG_NOTIFY_PLAY_SOUND);
> + gtk_toggle_button_set_active (prefs->notify_play_sound, !bool);
> g_signal_connect (prefs->notify_play_sound, "toggled", G_CALLBACK (settings_changed), prefs);
> -
> - prefs->notify_sound_file = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyPlaySound"));
> - buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/notify/sound", NULL);
> - gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), buf ? buf : "");
> - g_signal_connect (gnome_file_entry_gtk_entry (prefs->notify_sound_file), "changed",
> - G_CALLBACK (settings_changed), prefs);
> - g_free (buf);
> -
> +
> + em_tray_folders_refresh ();
> + gtk_option_menu_set_history (prefs->notify_menu, prefs->notify_type);
> +
> /* Mail Fonts */
> font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL);
> prefs->font_fixed = GNOME_FONT_PICKER (glade_xml_get_widget (gui, "radFontFixed"));
> @@ -677,8 +911,10 @@
> guint32 rgb;
> int i, val;
> GtkTreeIter iter;
> - gboolean valid;
> + gboolean valid, cont;
> GSList *header_list;
> + FolderTrayNotify *folder_notify;
> + gchar *name, *sound, *id, *image, *beep, *folder_xml;
please use char instead of gchar here (doesn't break emacs syntax
highlighting and stuff)
>
> /* General tab */
>
> @@ -711,18 +947,43 @@
> gtk_toggle_button_get_active (prefs->confirm_expunge), NULL);
>
> /* New Mail Notification */
> - if (gtk_toggle_button_get_active (prefs->notify_not))
> - val = MAIL_CONFIG_NOTIFY_NOT;
> - else if (gtk_toggle_button_get_active (prefs->notify_beep))
> - val = MAIL_CONFIG_NOTIFY_BEEP;
> - else
> - val = MAIL_CONFIG_NOTIFY_PLAY_SOUND;
> -
> - gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/notify/type", val, NULL);
> -
> - entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (prefs->notify_sound_file));
> - cstring = gtk_entry_get_text (GTK_ENTRY (entry));
> - gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/notify/sound", cstring, NULL);
> + gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/notify/type", prefs->notify_type, NULL);
> +
> + if (prefs->notify_type == MAIL_CONFIG_NOTIFY_ALL) {
> + gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/notify/beep",
> + gtk_toggle_button_get_active (prefs->notify_beep), NULL);
> + cstring = gnome_icon_entry_get_filename (prefs->img_notify);
> + gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/notify/image", cstring, NULL);
> +
> + entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (prefs->notify_sound_file));
> + cstring = gtk_entry_get_text (GTK_ENTRY (entry));
> + gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/notify/sound", cstring, NULL);
> + }
> +
> + list = NULL;
> + folder_notify = g_new0 (FolderTrayNotify, 1);
> + for (cont = gtk_tree_model_get_iter_first ((GtkTreeModel *) prefs->notify_folders_store, &iter); cont;
> + cont = gtk_tree_model_iter_next ((GtkTreeModel *) prefs->notify_folders_store, &iter)) {
> + gtk_tree_model_get ((GtkTreeModel *) prefs->notify_folders_store, &iter,
> + NOTIFY_NAME_COLUMN, &name,
> + NOTIFY_SOUND_COLUMN, &sound,
> + NOTIFY_ID_COLUMN, &id,
> + NOTIFY_IMAGE_COLUMN, &image,
> + NOTIFY_BEEP_COLUMN, &beep,
> + -1);
> +
> + folder_notify->name = name;
> + folder_notify->sound = sound;
> + folder_notify->id = id;
> + folder_notify->image = image;
> + folder_notify->beep = beep;
> +
> + folder_xml = em_folder_tray_notify_to_xml (folder_notify);
> +
> + list = g_slist_append (list, folder_xml);
> + }
> + gconf_client_set_list (prefs->gconf, "/apps/evolution/mail/notify/folders",GCONF_VALUE_STRING, list, NULL);
> + em_tray_folders_refresh ();
you leak folder_notify here, you probably want to g_free that here :-)
>
> /* HTML Mail */
> if (gtk_toggle_button_get_active (prefs->images_always))
> Index: em-mailer-prefs.h
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/em-mailer-prefs.h,v
> retrieving revision 1.5
> diff -u -r1.5 em-mailer-prefs.h
> --- em-mailer-prefs.h 11 Dec 2003 04:56:12 -0000 1.5
> +++ em-mailer-prefs.h 11 Jan 2004 10:28:24 -0000
> @@ -81,7 +81,28 @@
> GtkToggleButton *confirm_expunge;
>
> /* New Mail Notification */
> - GtkToggleButton *notify_not;
> + guint notify_type;
> + GtkLabel *notify_desc;
> + GtkTreeView *notify_folders;
> + GtkListStore *notify_folders_store;
> +
> + GtkOptionMenu *notify_menu;
> + GtkMenuItem *none_notify;
> + GtkMenuItem *all_folders_notify;
> + GtkMenuItem *selected_folders_notify;
> +
> + GtkFrame *frame_folders;
> + GtkFrame *frame_image;
> + GtkFrame *frame_sound;
> +
> + GtkWidget *img_notify;
> +
> + GtkButton *add_folder;
> + GtkButton *del_folder;
> +
> + GString *image_file;
> + GString *sound_file;
> + gboolean play_beep;
> GtkToggleButton *notify_beep;
> GtkToggleButton *notify_play_sound;
> GnomeFileEntry *notify_sound_file;
> Index: evolution-mail.schemas.in.in
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/evolution-mail.schemas.in.in,v
> retrieving revision 1.3
> diff -u -r1.3 evolution-mail.schemas.in.in
> --- evolution-mail.schemas.in.in 11 Dec 2003 04:56:12 -0000 1.3
> +++ evolution-mail.schemas.in.in 11 Jan 2004 10:28:25 -0000
> @@ -499,6 +499,65 @@
> <!-- New Mail Notification settings -->
>
> <schema>
> + <key>/schemas/apps/evolution/mail/notify/beep</key>
> + <applyto>/apps/evolution/mail/notify/beep</applyto>
> + <owner>evolution-mail</owner>
> + <type>bool</type>
> + <default>1</default>
> + <locale name="C">
> + <short>Beep when new mail arrives</short>
> + <long>
> + Specify if the system must beep when new mail
> + arrives and all folders are selected
> + </long>
> + </locale>
> + </schema>
> +
> + <schema>
> + <key>/schemas/apps/evolution/mail/notify/folders</key>
> + <applyto>/apps/evolution/mail/notify/folders</applyto>
> + <owner>evolution-mail</owner>
> + <type>list</type>
> + <list_type>string</list_type>
> + <locale name="C">
> + <short>List of folders</short>
> + <long>
> + List of folders for notify when new mail arrives
> + </long>
> + </locale>
> + </schema>
> +
> + <schema>
> + <key>/schemas/apps/evolution/mail/notify/image</key>
> + <applyto>/apps/evolution/mail/notify/image</applyto>
> + <owner>evolution-mail</owner>
> + <type>string</type>
> + <default></default>
> + <locale name="C">
> + <short>Name of image</short>
> + <long>
> + Name of image to blink when new mail arrives and
> + all folders are selected
> + </long>
> + </locale>
> + </schema>
> +
> + <schema>
> + <key>/schemas/apps/evolution/mail/notify/sound</key>
> + <applyto>/apps/evolution/mail/notify/sound</applyto>
> + <owner>evolution-mail</owner>
> + <type>string</type>
> + <default></default>
> + <locale name="C">
> + <short>Name of sound</short>
> + <long>
> + Name of sound to play when new mail arrives and
> + all folders are selected
> + </long>
> + </locale>
> + </schema>
> +
> + <schema>
> <key>/schemas/apps/evolution/mail/notify/type</key>
> <applyto>/apps/evolution/mail/notify/type</applyto>
> <owner>evolution-mail</owner>
> Index: mail-component-factory.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/mail-component-factory.c,v
> retrieving revision 1.7
> diff -u -r1.7 mail-component-factory.c
> --- mail-component-factory.c 3 Dec 2003 15:37:55 -0000 1.7
> +++ mail-component-factory.c 11 Jan 2004 10:28:25 -0000
> @@ -42,6 +42,7 @@
>
> #include <string.h>
>
> +#include "mail/em-panel-applet.h"
>
> #define FACTORY_ID "OAFIID:GNOME_Evolution_Mail_Factory:" BASE_VERSION
>
> @@ -88,6 +89,7 @@
> static int init = 0;
>
> if (!init) {
> + em_tray_init ();
> mail_config_init ();
> mail_msg_init ();
> init = 1;
[snip glade file]
> Index: mail-config.h
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/mail-config.h,v
> retrieving revision 1.113
> diff -u -r1.113 mail-config.h
> --- mail-config.h 1 Dec 2003 18:28:26 -0000 1.113
> +++ mail-config.h 11 Jan 2004 10:28:26 -0000
> @@ -73,12 +73,6 @@
> } MailConfigDisplayStyle;
>
> typedef enum {
> - MAIL_CONFIG_NOTIFY_NOT,
> - MAIL_CONFIG_NOTIFY_BEEP,
> - MAIL_CONFIG_NOTIFY_PLAY_SOUND,
> -} MailConfigNewMailNotify;
> -
> -typedef enum {
> MAIL_CONFIG_XMAILER_NONE = 0,
> MAIL_CONFIG_XMAILER_EVO = 1,
> MAIL_CONFIG_XMAILER_OTHER = 2,
> Index: mail-folder-cache.c
> ===================================================================
> RCS file: /cvs/gnome/evolution/mail/mail-folder-cache.c,v
> retrieving revision 1.77
> diff -u -r1.77 mail-folder-cache.c
> --- mail-folder-cache.c 10 Dec 2003 18:36:13 -0000 1.77
> +++ mail-folder-cache.c 11 Jan 2004 10:28:26 -0000
> @@ -53,6 +53,9 @@
> #include "mail-config.h"
> #include "em-folder-tree-model.h"
>
> +/* New mail notification */
> +#include "em-panel-applet.h"
> +
> #define w(x)
> #define d(x) /*(printf("%s(%d):%s: ", __FILE__, __LINE__, __PRETTY_FUNCTION__), (x))*/
>
> @@ -147,25 +150,9 @@
> static gboolean
> notify_idle_cb (gpointer user_data)
> {
> - GConfClient *gconf;
> - char *filename;
> -
> - gconf = mail_config_get_gconf_client ();
> -
> - switch (notify_type) {
> - case MAIL_CONFIG_NOTIFY_PLAY_SOUND:
> - filename = gconf_client_get_string (gconf, "/apps/evolution/mail/notify/sound", NULL);
> - if (filename != NULL) {
> - gnome_sound_play (filename);
> - g_free (filename);
> - }
> - break;
> - case MAIL_CONFIG_NOTIFY_BEEP:
> - gdk_beep ();
> - break;
> - default:
> - break;
> - }
> + GString *uri = (GString *) user_data;
> +
> + em_tray_notify (TRUE, uri->str, notify_type);
>
> time (&last_notify);
>
> @@ -189,6 +176,7 @@
> struct _folder_update *up;
> struct _store_info *si;
> time_t now;
> + GString *uri;
>
> component = mail_component_peek ();
> model = mail_component_peek_tree_model (component);
> @@ -238,8 +226,10 @@
> }
>
> time (&now);
> - if (notify_type != 0 && up->new && notify_idle_id == 0 && (now - last_notify >= 5))
> - notify_idle_id = g_idle_add_full (G_PRIORITY_LOW, notify_idle_cb, NULL, NULL);
> + if (notify_type != 0 && up->new && notify_idle_id == 0 && (now - last_notify >= 5)) {
> + uri = g_string_new (notify_type == MAIL_CONFIG_NOTIFY_ALL ? up->path : up->uri);
> + notify_idle_id = g_idle_add_full (G_PRIORITY_LOW, notify_idle_cb, uri, NULL);
> + }
>
> free_update(up);
>
> @@ -353,6 +343,7 @@
>
> up = g_malloc0(sizeof(*up));
> up->path = g_strdup(mfi->path);
> + up->uri = g_strdup(mfi->uri); // For use with MAIL_CONFIG_NOTIFY_SELECTED notification
don't use c++ style comments - use c89 comments
> up->unread = unread;
> up->new = new ? 1 : 0;
> up->store = mfi->store_info->store;
[snip: eggmarshal.c and .h]
eggmarshal files should be autogenerated, so we don't actually need to
review those :-)
>
> ______________________________________________________________________
[snip: egg-tray-icon.c and .h]
assuming they are ok being taken directly from libeeg and such?
>
> ______________________________________________________________________
> /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
>
> #include <gtk/gtk.h>
> #include <gnome.h>
> #include <gconf/gconf-client.h>
> #include "e-util/eggtrayicon.h"
> #include "e-util/eggtraymanager.h"
> #include <libxml/parser.h>
> #include <libxml/tree.h>
> #include <libxml/xmlmemory.h>
> #include "em-folder-tree.h"
> #include "em-folder-selector.h"
> #include "em-panel-applet.h"
> #include "em-mailer-prefs.h"
>
> static gboolean em_tray_blink_icon (EvolutionTray *evo_tray);
> static void em_tray_update_status (EvolutionTray *evo_tray);
> static gboolean em_tray_folder_registered (gchar *uri);
> static FolderTrayNotify * em_tray_get_folder_info (gchar *uri);
> static FolderTrayNotify * em_tray_get_folders_from_xml (const char *xml);
> static gboolean em_tray_icon_press (GtkWidget *widget, GdkEventButton *event, EvolutionTray *evo_tray);
> static void em_tray_about (GtkMenuItem *menuitem, gpointer user_data);
> static GdkPixbuf * em_tray_blank_icon ();
> static void em_tray_create_ui (EvolutionTray *evo_tray);
>
> static EvolutionTray *evo_tray;
> static GtkWidget *image, *evbox;
> static gint notify_type;
> static GdkPixbuf *icon;
> static gchar *show_uri;
>
> char *
> em_folder_tray_notify_to_xml (FolderTrayNotify *folder_notify)
> {
> xmlDocPtr doc;
> xmlNodePtr root;
> xmlChar *xmlbuf;
> int n;
> char *tmp;
>
> doc = xmlNewDoc ("1.0");
>
> root = xmlNewDocNode (doc, NULL, "folder", NULL);
> xmlDocSetRootElement (doc, root);
>
> xmlSetProp (root, "id", folder_notify->id);
>
> xmlNewTextChild (root, NULL, "name", folder_notify->name);
> xmlNewTextChild (root, NULL, "image", folder_notify->image);
> xmlNewTextChild (root, NULL, "sound", folder_notify->sound);
> xmlNewTextChild (root, NULL, "beep", folder_notify->beep);
>
> xmlDocDumpMemory (doc, &xmlbuf, &n);
> xmlFreeDoc (doc);
>
> tmp = g_malloc (n + 1);
> memcpy (tmp, xmlbuf, n);
> tmp[n] = '\0';
> xmlFree (xmlbuf);
>
> return tmp;
> }
>
> static gboolean
> em_tray_blink_icon (EvolutionTray *evo_tray)
> {
> evo_tray->blink = !evo_tray->blink;
>
> if (egg_tray_manager_check_running (evo_tray->current_screen)) {
> if (evo_tray->newmail && egg_tray_manager_check_running (evo_tray->current_screen)) {
> if (evo_tray->blink)
> gtk_image_set_from_pixbuf (GTK_IMAGE (image), evo_tray->blank_icon);
> else
> gtk_image_set_from_pixbuf (GTK_IMAGE (image), icon);
>
> return TRUE;
> } else {
> gtk_image_set_from_pixbuf (GTK_IMAGE (image), evo_tray->icon);
>
> gtk_tooltips_set_tip (evo_tray->tray_icon_tooltip, GTK_WIDGET (evo_tray->tray_icon),
> _("Evolution New Mail Notification"),
> NULL);
> }
> }
>
> return FALSE;
> }
>
> static void
> em_tray_update_status (EvolutionTray *evo_tray)
> {
> if (egg_tray_manager_check_running (evo_tray->current_screen))
> g_timeout_add (500, em_tray_blink_icon, evo_tray);
> }
>
> static gboolean
> em_tray_folder_registered (gchar *uri)
> {
> gboolean cont;
> GtkTreeIter iter;
> gchar *id;
s/gchar/char/
>
> for (cont = gtk_tree_model_get_iter_first ((GtkTreeModel *) evo_tray->model, &iter); cont;
> cont = gtk_tree_model_iter_next ((GtkTreeModel *) evo_tray->model, &iter)) {
>
> gtk_tree_model_get (evo_tray->model, &iter,
> NOTIFY_ID_COLUMN, &id,
> -1);
>
> if (!strcmp (uri, id))
> return TRUE;
> }
>
> return FALSE;
> }
>
> static FolderTrayNotify *
> em_tray_get_folder_info (gchar *uri)
s/gchar/const char/
> {
> gboolean cont;
> GtkTreeIter iter;
> gchar *id, *name, *image, *sound, *beep;
s/gchar/char/
> FolderTrayNotify *folder;
>
> folder = g_new0 (FolderTrayNotify, 1);
>
> for (cont = gtk_tree_model_get_iter_first ((GtkTreeModel *) evo_tray->model, &iter); cont;
> cont = gtk_tree_model_iter_next ((GtkTreeModel *) evo_tray->model, &iter)) {
>
> gtk_tree_model_get (evo_tray->model, &iter,
> NOTIFY_ID_COLUMN, &id,
> NOTIFY_NAME_COLUMN, &name,
> NOTIFY_IMAGE_COLUMN, &image,
> NOTIFY_SOUND_COLUMN, &sound,
> NOTIFY_BEEP_COLUMN, &beep,
> -1);
>
> if (!strcmp (uri, id))
> break;
> }
>
> folder->id = id;
> folder->name = name;
> folder->image = image;
> folder->sound = sound;
> folder->beep = beep;
you might need to g_strdup some of these strings... what if the model
gets destroyed before the folder struct is used?
>
> return folder;
> }
>
> static gboolean
> em_tray_icon_press (GtkWidget *widget, GdkEventButton *event, EvolutionTray *evo_tray)
> {
> switch (event->button) {
> case 1:
> evo_tray->newmail = FALSE;
> em_tray_update_status (evo_tray);
> return TRUE;
> break;
> case 3:
> gtk_menu_popup (GTK_MENU (evo_tray->popup_menu),
> NULL,
> NULL,
> NULL,
> NULL,
> event->button,
> event->time);
> return TRUE;
> break;
> default:
> return FALSE;
> break;
> }
> }
>
> static FolderTrayNotify *
> em_tray_get_folders_from_xml (const char *xml)
> {
> xmlNodePtr node;
> xmlDocPtr doc;
> FolderTrayNotify *folder;
>
>
no need for 2 blank lines there...
> if (!(doc = xmlParseDoc ((char*) xml)))
> return NULL;
do you need to cast to (char *) there? I would hope that xmlParseDoc
takes a const char * arg...
if you do have to cast, please put a space before the *
>
> node = doc->children;
> if (strcmp (node->name, "folder") != 0) {
> xmlFreeDoc (doc);
> return NULL;
> }
>
> folder = g_new0 (FolderTrayNotify, 1);
>
> folder->id = g_strdup (xmlGetProp (node, "id"));
>
> for (node = node->children; node; node = node->next) {
> if (!strcmp (node->name, "name"))
> folder->name = g_strdup (xmlNodeGetContent (node));
>
> if (!strcmp (node->name, "image"))
> folder->image = g_strdup (xmlNodeGetContent (node));
>
> if (!strcmp (node->name, "sound"))
> folder->sound = g_strdup (xmlNodeGetContent (node));
>
> if (!strcmp (node->name, "beep"))
> folder->beep = g_strdup (xmlNodeGetContent (node));
> }
xmlNodeGetContent returns a malloc'd buffer so you are leaking there.
you need to xmlFree() the return values...
>
> xmlFreeDoc (doc);
>
> return folder;
> }
>
> void
> em_tray_folders_refresh ()
> {
> GSList *list, *l;
> GtkTreeIter iter;
> FolderTrayNotify *folder;
>
> list = gconf_client_get_list (evo_tray->conf_client,
> "/apps/evolution/mail/notify/folders",
> GCONF_VALUE_STRING,
> NULL);
> if (!list)
> return;
>
> gtk_list_store_clear (GTK_LIST_STORE (evo_tray->model));
>
> for (l = list; l; l = l->next) {
> folder = em_tray_get_folders_from_xml (l->data);
>
> gtk_list_store_append (GTK_LIST_STORE (evo_tray->model), &iter);
> gtk_list_store_set (GTK_LIST_STORE (evo_tray->model),
> &iter,
> NOTIFY_PIXBUF_COLUMN, em_tray_get_image_scaled (folder->image),
> NOTIFY_NAME_COLUMN, folder->name,
> NOTIFY_SOUND_COLUMN, folder->sound,
> NOTIFY_ID_COLUMN, folder->id,
> NOTIFY_IMAGE_COLUMN, folder->image,
> NOTIFY_BEEP_COLUMN, folder->beep,
> -1);
you need to free folder here, otherwise it gets leaked.
> }
> }
>
> static void
> em_tray_about (GtkMenuItem *menuitem, gpointer user_data)
> {
> static GtkWidget *about = NULL;
> GdkPixbuf *pixbuf = NULL;
> const gchar *authors[] = {"Miguel Angel López Hernández <miguel gulev org mx>", NULL};
> const gchar *documenters[] = {NULL};
> const gchar *translator_credits = "translator_credits";
s/gchar/char/
>
> if (about != NULL) {
> gdk_window_raise (about->window);
> gdk_window_show (about->window);
> return;
> }
>
> pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGES "/ico-mail.png", NULL);
>
> about = gnome_about_new ("Evolution Notification Applet",
> "0.0.1",
> "Copyright \xc2\xa9 2003-2004 Miguel Angel López Hernández",
> "Evolution notification applet",
> (const char**)authors,
> (const char**)documenters,
> strcmp (translator_credits, "translator_credits") != 0 ? translator_credits : NULL,
> pixbuf);
>
> if (pixbuf != NULL)
> gdk_pixbuf_unref (pixbuf);
>
> g_signal_connect (G_OBJECT (about), "destroy", G_CALLBACK (gtk_widget_destroyed), &about);
no need for the G_OBJECT() here.
>
> g_object_add_weak_pointer (G_OBJECT (about), (void **)&(about));
>
> gtk_widget_show (about);
> }
>
> GdkPixbuf *
> em_tray_get_image_scaled (gchar *image_file)
> {
> GdkPixbuf *tmp, *scaled;
> gint width, height;
s/gint/int/
>
> tmp = gdk_pixbuf_new_from_file (image_file, NULL);
> gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &width, &height);
> scaled = gdk_pixbuf_scale_simple (tmp, width, height, GDK_INTERP_BILINEAR);
>
> return scaled;
> }
>
> static GdkPixbuf *
> em_tray_blank_icon ()
> {
> GdkPixbuf *blank;
> gint width, height;
s/gint/int/
>
> gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &width, &height);
> blank = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
> gdk_pixbuf_fill (blank, 0);
>
> return blank;
> }
>
> static void
> em_tray_create_ui (EvolutionTray *evo_tray)
> {
> GtkWidget *item;
>
> evo_tray->tray_icon = egg_tray_icon_new (_("Evolution Tray Icon"));
>
> evo_tray->icon = em_tray_get_image_scaled (DEFAULT_IMAGE_NOTIFY);
>
> image = gtk_image_new_from_pixbuf (evo_tray->icon);
>
> evo_tray->blank_icon = em_tray_blank_icon ();
>
> /* Tooltip */
> evo_tray->tray_icon_tooltip = gtk_tooltips_new ();
> gtk_tooltips_set_tip (evo_tray->tray_icon_tooltip, GTK_WIDGET (evo_tray->tray_icon),
> _("Evolution New Mail Notification"),
> NULL);
>
> /* Event box */
> evbox = gtk_event_box_new ();
> g_signal_connect (G_OBJECT (evbox), "button_press_event", G_CALLBACK (em_tray_icon_press), (gpointer) evo_tray);
no need for G_OBJECT() here.
>
> /* Popup menu */
> evo_tray->popup_menu = gtk_menu_new ();
>
> item = gtk_image_menu_item_new_from_stock (GNOME_STOCK_ABOUT, NULL);
> g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (em_tray_about), (gpointer) evo_tray);
same.
> gtk_widget_show (item);
> gtk_menu_shell_append (GTK_MENU_SHELL (evo_tray->popup_menu), item);
>
> gtk_container_add (GTK_CONTAINER (evbox), image);
> gtk_container_add (GTK_CONTAINER (evo_tray->tray_icon), evbox);
> gtk_widget_show_all (GTK_WIDGET (evo_tray->tray_icon));
>
> evo_tray->created = TRUE;
> }
>
> GtkTreeModel *
> em_tray_get_store ()
> {
> return evo_tray->model;
> }
I think a better name for this function would be em_tray_get_model()
>
> void
> em_tray_init ()
> {
> evo_tray = g_new0 (EvolutionTray, 1);
>
> evo_tray->conf_client = gconf_client_get_default ();
>
> evo_tray->current_screen = gdk_screen_get_default();
>
> evo_tray->model = GTK_TREE_MODEL (gtk_list_store_new (NOTIFY_NUM_COLUMNS,
> GDK_TYPE_PIXBUF,
> G_TYPE_STRING,
> G_TYPE_STRING,
> G_TYPE_STRING,
> G_TYPE_STRING,
> G_TYPE_STRING));
might it be better to use newv() here and have an array of GType's? this
is how we do it in other places... not critical tho.
> em_tray_folders_refresh ();
>
> if (egg_tray_manager_check_running (evo_tray->current_screen))
> em_tray_create_ui (evo_tray);
> }
>
> void
> em_tray_notify (gboolean notify, gchar *uri, gint type)
s/gchar/const char/
s/gint/int/
> {
> char *sound, *image_name;
> char *name, *tooltip;
> gboolean beep;
> FolderTrayNotify *folder;
>
> switch (type) {
> case MAIL_CONFIG_NOTIFY_ALL:
> beep = gconf_client_get_bool (evo_tray->conf_client, "/apps/evolution/mail/notify/beep", NULL);
> sound = gconf_client_get_string (evo_tray->conf_client, "/apps/evolution/mail/notify/sound", NULL);
> image_name = gconf_client_get_string (evo_tray->conf_client, "/apps/evolution/mail/notify/image", NULL);
> name = uri;
> break;
> case MAIL_CONFIG_NOTIFY_SELECTED:
> if (!em_tray_folder_registered (uri))
> return;
>
> folder = em_tray_get_folder_info (uri);
> beep = !strcmp (folder->beep, "yes");
I think folder->beep should be changed to be a gboolean so you don't
have to do this except where the FolderTRayNotify is constructed.
> sound = folder->sound;
> image_name = folder->image;
> name = folder->name;
> break;
> }
>
> show_uri = uri;
> icon = em_tray_get_image_scaled (image_name);
> tooltip = g_strdup_printf (_("New mail on:\n%s"), name);
I think get rid of the \n and replace it with a space?
>
> if (egg_tray_manager_check_running (evo_tray->current_screen)) {
> if (!evo_tray->created) {
> em_tray_create_ui (evo_tray);
> evo_tray->newmail = FALSE;
> }
>
> gtk_tooltips_set_tip (evo_tray->tray_icon_tooltip,
> GTK_WIDGET (evo_tray->tray_icon),
> tooltip,
> NULL);
> }
>
> if (beep)
> gdk_beep ();
> else {
> if (sound != NULL) {
> gnome_sound_play (sound);
> g_free (sound);
> }
> }
if the 'else' has more than one line, then the 'then' branch should also
be encased in brackets.
if (beep) {
...
} else {
...
...
}
>
> notify_type = type;
>
> if (evo_tray->newmail)
> return;
>
> evo_tray->newmail = notify;
> em_tray_update_status (evo_tray);
> }
>
> ______________________________________________________________________
> /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
> #ifndef __EM_PANEL_APPLET_H__
> #define __EM_PANEL_APPLET_H__
>
> #include "e-util/eggtrayicon.h"
> #include <glade/glade.h>
>
> #define DEFAULT_SOUND_NOTIFY "/usr/share/sounds/email.wav"
> #define DEFAULT_IMAGE_NOTIFY EVOLUTION_IMAGES "/ico-mail.png"
>
> typedef enum {
> MAIL_CONFIG_NOTIFY_NONE,
> MAIL_CONFIG_NOTIFY_ALL,
> MAIL_CONFIG_NOTIFY_SELECTED,
> MAIL_NOTIFY_TYPES,
> } MailConfigNewMailNotifyType;
>
> static struct {
> const char *name;
> const char *description;
> } MailNotifyType[MAIL_NOTIFY_TYPES] = {
> { N_("None"),
> N_("Do not notify when new mail arrived.") },
> { N_("All Folders"),
> N_("Notify when new mail arrived to any folder.") },
> { N_("Selected Folders"),
> N_("Notify when new mail arrived to any of the selected folders.") },
> };
>
> typedef struct {
> GConfClient *conf_client;
>
> GdkScreen *current_screen;
>
> GtkTreeModel *model;
>
> EggTrayIcon *tray_icon;
> GtkTooltips *tray_icon_tooltip;
> GtkWidget *popup_menu;
> GdkPixbuf *icon;
> GdkPixbuf *blank_icon;
>
> gboolean blink;
> gboolean newmail;
>
> gboolean created;
> } EvolutionTray;
>
> typedef struct {
> gchar *id;
> gchar *name;
> gchar *image;
> gchar *sound;
> gchar *beep;
> } FolderTrayNotify;
s/gchar/char/
also, as said above - I think 'beep' should be a gboolean.
>
> enum {
> NOTIFY_PIXBUF_COLUMN,
> NOTIFY_NAME_COLUMN,
> NOTIFY_SOUND_COLUMN,
> NOTIFY_ID_COLUMN,
> NOTIFY_IMAGE_COLUMN,
> NOTIFY_BEEP_COLUMN,
> NOTIFY_NUM_COLUMNS,
> };
>
> void em_tray_init ();
> void em_tray_notify (gboolean notify, gchar *uri, gint type);
> GtkTreeModel * em_tray_get_store ();
> void em_tray_add_folder (GtkWidget *button, gpointer user_data);
> void em_tray_folders_refresh ();
> char * em_folder_tray_notify_to_xml (FolderTrayNotify *folder_notify);
> GdkPixbuf * em_tray_get_image_scaled (gchar *image_file)
> ;
move that ; up to the previous line :-)
also, s/gchar/char/ and s/gint/int/
>
> #endif
Jeff
--
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com - www.ximian.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]