aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-sidebar.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2007-10-11 22:03:13 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-10-11 22:03:13 +0800
commiteeb89358f6f3aa8f211b33c23842a8deb08171a8 (patch)
tree5874c18c42397a4a387d6c4aa87718044b31431d /shell/e-sidebar.c
parentaa70b15ea030e8c5a42ea9512c522140e6b8f5e7 (diff)
downloadgsoc2013-evolution-eeb89358f6f3aa8f211b33c23842a8deb08171a8.tar
gsoc2013-evolution-eeb89358f6f3aa8f211b33c23842a8deb08171a8.tar.gz
gsoc2013-evolution-eeb89358f6f3aa8f211b33c23842a8deb08171a8.tar.bz2
gsoc2013-evolution-eeb89358f6f3aa8f211b33c23842a8deb08171a8.tar.lz
gsoc2013-evolution-eeb89358f6f3aa8f211b33c23842a8deb08171a8.tar.xz
gsoc2013-evolution-eeb89358f6f3aa8f211b33c23842a8deb08171a8.tar.zst
gsoc2013-evolution-eeb89358f6f3aa8f211b33c23842a8deb08171a8.zip
** Fix for bug #329823
2007-10-11 Milan Crha <mcrha@redhat.com> ** Fix for bug #329823 * Evolution-Shell.idl: (setButtonIcon): * e-sidebar.h: (e_sidebar_change_button_icon): * e-sidebar.c: (struct Button), (button_new), (button_free), (e_sidebar_change_button_icon): * e-shell.h: (EMainShellFunc), (e_shell_foreach_shell_window): * e-shell.c: (EMainShellFunc), (e_shell_foreach_shell_window): * e-component-view.h: (e_component_view_set_button_icon): * e-component-view.c: (e_component_view_set_button_icon): * e-shell-window.h: (e_shell_window_change_component_button_icon): * e-shell-window.c: (e_shell_window_change_component_button_icon): * e-shell-view.c: (struct change_icon_struct), (change_button_icon_func), (impl_ShellView_setButtonIcon), (e_shell_view_class_init): Added support to change component's button icon. * mail-component.h: (mail_indicate_new_mail): * mail-component.c: (mail_indicate_new_mail), (struct _MailComponentPrivate), (impl_dispose), (impl_createView): New function to indicate new mails on sidebar's button and storing component_view in priv struct for later use. * em-folder-view.c: (emfv_list_done_message_selected): * mail-folder-cache.c: (real_flush_updates): Indicate changes like for plugins for new mails. svn path=/trunk/; revision=34374
Diffstat (limited to 'shell/e-sidebar.c')
-rw-r--r--shell/e-sidebar.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/shell/e-sidebar.c b/shell/e-sidebar.c
index 4fd2e0e3c0..24f685a525 100644
--- a/shell/e-sidebar.c
+++ b/shell/e-sidebar.c
@@ -43,6 +43,7 @@ typedef struct {
GtkWidget *icon;
GtkWidget *hbox;
GtkTooltips *tooltips;
+ GdkPixbuf *default_icon;
int id;
} Button;
@@ -89,6 +90,7 @@ button_new (GtkWidget *button_widget, GtkWidget *label, GtkWidget *icon, GtkTool
button->hbox = hbox;
button->tooltips = tooltips;
button->id = id;
+ button->default_icon = NULL;
g_object_ref (button_widget);
g_object_ref (label);
@@ -107,6 +109,8 @@ button_free (Button *button)
g_object_unref (button->icon);
g_object_unref (button->hbox);
g_object_unref (button->tooltips);
+ if (button->default_icon)
+ g_object_unref (button->default_icon);
g_free (button);
}
@@ -578,6 +582,45 @@ e_sidebar_add_button (ESidebar *sidebar,
gtk_widget_queue_resize (GTK_WIDGET (sidebar));
}
+/**
+ * e_sidebar_change_button_icon
+ * This will change icon in icon_widget of the button of known component.
+ * You cannot change icon as in a stack, only one default icon will be stored.
+ * @param sidebar ESidebar instance.
+ * @param icon Pointer to buffer with icon. Can by NULL, in this case the icon will be
+ * put back to default one for the component.
+ * @param button_id Component's button ID, for which change the icon.
+ **/
+
+void
+e_sidebar_change_button_icon (ESidebar *sidebar, GdkPixbuf *icon, int button_id)
+{
+ GSList *p;
+
+ g_return_if_fail (sidebar != NULL);
+
+ for (p = sidebar->priv->buttons; p != NULL; p = p->next) {
+ Button *button = p->data;
+
+ if (button->id == button_id) {
+ if (!button->icon)
+ break;
+
+ if (icon) {
+ if (!button->default_icon)
+ button->default_icon = gdk_pixbuf_copy (gtk_image_get_pixbuf (GTK_IMAGE (button->icon)));
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (button->icon), icon);
+ } else if (button->default_icon) {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (button->icon), button->default_icon);
+ g_object_unref (button->default_icon);
+ button->default_icon = NULL;
+ }
+
+ break;
+ }
+ }
+}
void
e_sidebar_select_button (ESidebar *sidebar, int id)