aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog24
-rw-r--r--shell/e-component-registry.c31
-rw-r--r--shell/e-component-registry.h3
-rw-r--r--shell/e-shell-view.c12
-rw-r--r--shell/e-shell-window.c23
-rw-r--r--shell/e-shell-window.h2
-rw-r--r--shell/e-sidebar.c44
-rw-r--r--shell/e-sidebar.h4
8 files changed, 70 insertions, 73 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index b4df3e0962..6ecd53c350 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,27 @@
+2008-08-07 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes bug #467115
+
+ * e-component-registry.h:
+ Replace button and menu icon pixbufs with an icon name string.
+
+ * e-component-registry.c (query_components):
+ No need to create pixbufs, just save the icon name.
+
+ * e-sidebar.c:
+ Remember a default icon name rather than a default pixbuf.
+
+ * e-sidebar.c (e_sidebar_add_button), (e_sidebar_change_button_icon):
+ * e-shell-window.c (e_shell_window_change_component_button_icon):
+ Take an icon name instead of a pixbuf.
+
+ * e-shell-window.c (switch_view):
+ Call gtk_window_set_icon_name() instead of gtk_window_set_icon().
+
+ * e-shell-window.c (setup_widgets):
+ Change XML from pixtype="pixbuf" to pixbuf="filename" and derive
+ an appropriate filename from the icon name.
+
2008-08-06 Milan Crha <mcrha@redhat.com>
** Fix for bug #249844
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c
index ebb4cd9b9c..146ceb26a6 100644
--- a/shell/e-component-registry.c
+++ b/shell/e-component-registry.c
@@ -54,9 +54,8 @@ component_info_new (const char *id,
const char *button_tooltips,
const char *menu_label,
const char *menu_accelerator,
- int sort_order,
- GdkPixbuf *button_icon,
- GdkPixbuf *menu_icon)
+ const char *icon_name,
+ int sort_order)
{
EComponentInfo *info = g_new0 (EComponentInfo, 1);
@@ -67,16 +66,9 @@ component_info_new (const char *id,
info->button_tooltips = g_strdup (button_tooltips);
info->menu_label = g_strdup (menu_label);
info->menu_accelerator = g_strdup (menu_accelerator);
+ info->icon_name = g_strdup (icon_name);
info->sort_order = sort_order;
- info->button_icon = button_icon;
- if (info->button_icon)
- g_object_ref (info->button_icon);
-
- info->menu_icon = menu_icon;
- if (info->menu_icon)
- g_object_ref (info->menu_icon);
-
return info;
}
@@ -90,12 +82,6 @@ component_info_free (EComponentInfo *info)
g_free (info->menu_label);
g_free (info->menu_accelerator);
- if (info->button_icon)
- g_object_unref (info->button_icon);
-
- if (info->menu_icon)
- g_object_unref (info->menu_icon);
-
if (info->iface != NULL)
bonobo_object_release_unref (info->iface, NULL);
@@ -183,7 +169,6 @@ query_components (EComponentRegistry *registry)
const char *icon_name;
const char *sort_order_string;
const char *tooltips;
- GdkPixbuf *icon = NULL, *menuicon = NULL;
EComponentInfo *info;
int sort_order;
GNOME_Evolution_Component iface;
@@ -211,10 +196,6 @@ query_components (EComponentRegistry *registry)
alias = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:component_alias", NULL);
icon_name = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_icon", NULL);
- if (icon_name) {
- icon = e_icon_factory_get_icon (icon_name, E_ICON_SIZE_LARGE_TOOLBAR);
- menuicon = e_icon_factory_get_icon (icon_name, E_ICON_SIZE_MENU);
- }
sort_order_string = bonobo_server_info_prop_lookup (& info_list->_buffer[i],
"evolution:button_sort_order", NULL);
@@ -224,15 +205,11 @@ query_components (EComponentRegistry *registry)
sort_order = atoi (sort_order_string);
info = component_info_new (id, iface, alias, label, tooltips, menu_label,
- menu_accelerator, sort_order, icon, menuicon);
+ menu_accelerator, icon_name, sort_order);
set_schemas (info, & info_list->_buffer [i]);
registry->priv->infos = g_slist_prepend (registry->priv->infos, info);
- if (icon != NULL)
- g_object_unref (icon);
- if (menuicon != NULL)
- g_object_unref (menuicon);
bonobo_object_release_unref(iface, NULL);
}
g_slist_free(languages);
diff --git a/shell/e-component-registry.h b/shell/e-component-registry.h
index 0c7ff03b0e..1d5943537c 100644
--- a/shell/e-component-registry.h
+++ b/shell/e-component-registry.h
@@ -73,10 +73,9 @@ struct _EComponentInfo {
char *button_label;
char *button_tooltips;
- GdkPixbuf *button_icon;
char *menu_label;
char *menu_accelerator;
- GdkPixbuf *menu_icon;
+ char *icon_name;
int sort_order;
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index ebcc9c03fe..daa9794e3b 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -61,7 +61,7 @@ impl_ShellView_setComponent(PortableServer_Servant _servant, const CORBA_char *i
struct change_icon_struct {
const char *component_name;
- GdkPixbuf *icon;
+ const char *icon_name;
};
static gboolean
@@ -72,7 +72,7 @@ change_button_icon_func (EShell *shell, EShellWindow *window, gpointer user_data
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (cis != NULL, FALSE);
- e_shell_window_change_component_button_icon (window, cis->component_name, cis->icon);
+ e_shell_window_change_component_button_icon (window, cis->component_name, cis->icon_name);
return TRUE;
}
@@ -85,15 +85,9 @@ impl_ShellView_setButtonIcon (PortableServer_Servant _servant, const CORBA_char
struct change_icon_struct cis;
cis.component_name = id;
- cis.icon = NULL;
-
- if (iconName)
- cis.icon = e_icon_factory_get_icon (iconName, E_ICON_SIZE_BUTTON);
+ cis.icon_name = iconName;
e_shell_foreach_shell_window (shell, change_button_icon_func, &cis);
-
- if (cis.icon)
- g_object_unref (cis.icon);
}
static void
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 6f906b00e7..cf188e27e7 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -331,8 +331,8 @@ switch_view (EShellWindow *window, ComponentView *component_view)
} else
gtk_window_set_title (GTK_WINDOW (window), component_view->title);
- if (info->button_icon)
- gtk_window_set_icon (GTK_WINDOW (window), info->button_icon);
+ if (info->icon_name)
+ gtk_window_set_icon_name (GTK_WINDOW (window), info->icon_name);
gconf_client_set_string (gconf_client, "/apps/evolution/shell/view_defaults/component_id",
(component_view->component_alias != NULL
@@ -756,12 +756,14 @@ setup_widgets (EShellWindow *window)
char *tmp, *tmp2;
EComponentInfo *info = p->data;
ComponentView *view = component_view_new (info->id, info->alias, button_id);
+ GtkIconInfo *icon_info;
+ gint width;
window->priv->component_views = g_slist_prepend (window->priv->component_views, view);
if (!info->button_label || !info->menu_label)
continue;
- e_sidebar_add_button (E_SIDEBAR (priv->sidebar), info->button_label, info->button_tooltips, info->button_icon, button_id);
+ e_sidebar_add_button (E_SIDEBAR (priv->sidebar), info->button_label, info->button_tooltips, info->icon_name, button_id);
g_string_printf(xml, "SwitchComponent-%s", info->alias);
bonobo_ui_component_add_verb (e_shell_window_peek_bonobo_ui_component (window),
@@ -783,11 +785,14 @@ setup_widgets (EShellWindow *window)
g_free (tmp2);
g_free (tmp);
- tmp = bonobo_ui_util_pixbuf_to_xml (info->menu_icon),
- g_string_append_printf(xml, "\" pixtype=\"pixbuf\" pixname=\"%s\"/>"
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, NULL);
+ icon_info = gtk_icon_theme_lookup_icon (
+ gtk_icon_theme_get_default (),
+ info->icon_name, width, 0);
+ g_string_append_printf(xml, "\" pixtype=\"filename\" pixname=\"%s\"/>"
"</placeholder></submenu></submenu>\n",
- tmp);
- g_free(tmp);
+ gtk_icon_info_get_filename (icon_info));
+ gtk_icon_info_free (icon_info);
bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
"/menu",
xml->str,
@@ -1246,7 +1251,7 @@ e_shell_window_set_title(EShellWindow *window, const char *component_id, const c
* @param icon Icon buffer.
**/
void
-e_shell_window_change_component_button_icon (EShellWindow *window, const char *component_id, GdkPixbuf *icon)
+e_shell_window_change_component_button_icon (EShellWindow *window, const char *component_id, const char *icon_name)
{
EShellWindowPrivate *priv;
GSList *p;
@@ -1265,7 +1270,7 @@ e_shell_window_change_component_button_icon (EShellWindow *window, const char *c
if (strcmp (this_view->component_id, component_id) == 0
|| (this_view->component_alias != NULL
&& strcmp (this_view->component_alias, component_id) == 0)) {
- e_sidebar_change_button_icon (E_SIDEBAR (priv->sidebar), icon, this_view->button_id);
+ e_sidebar_change_button_icon (E_SIDEBAR (priv->sidebar), icon_name, this_view->button_id);
break;
}
}
diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h
index 07b8586e2e..400d68bc19 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -73,6 +73,6 @@ void e_shell_window_set_title(EShellWindow *window, const char *component_id, co
void e_shell_window_save_defaults (EShellWindow *window);
void e_shell_window_show_settings (EShellWindow *window);
-void e_shell_window_change_component_button_icon (EShellWindow *window, const char *component_id, GdkPixbuf *icon);
+void e_shell_window_change_component_button_icon (EShellWindow *window, const char *component_id, const char *icon_name);
#endif /* _E_SHELL_WINDOW_H_ */
diff --git a/shell/e-sidebar.c b/shell/e-sidebar.c
index d3404b5813..bd822b25da 100644
--- a/shell/e-sidebar.c
+++ b/shell/e-sidebar.c
@@ -36,7 +36,7 @@ typedef struct {
GtkWidget *label;
GtkWidget *icon;
GtkWidget *hbox;
- GdkPixbuf *default_icon;
+ gchar *default_icon_name;
int id;
} Button;
@@ -79,17 +79,20 @@ button_new (GtkWidget *button_widget,
int id)
{
Button *button = g_new (Button, 1);
+ const gchar *icon_name;
button->button_widget = button_widget;
button->label = label;
- button->icon = icon;
+ button->icon = icon;
button->hbox = hbox;
button->id = id;
- button->default_icon = NULL;
+
+ gtk_image_get_icon_name (GTK_IMAGE (icon), &icon_name, NULL);
+ button->default_icon_name = g_strdup (icon_name);
g_object_ref (button_widget);
g_object_ref (label);
- g_object_ref (icon);
+ g_object_ref (icon);
g_object_ref (hbox);
return button;
@@ -102,8 +105,7 @@ button_free (Button *button)
g_object_unref (button->label);
g_object_unref (button->icon);
g_object_unref (button->hbox);
- if (button->default_icon)
- g_object_unref (button->default_icon);
+ g_free (button->default_icon_name);
g_free (button);
}
@@ -545,7 +547,7 @@ void
e_sidebar_add_button (ESidebar *sidebar,
const char *label,
const char *tooltips,
- GdkPixbuf *icon,
+ const char *icon_name,
int id)
{
GtkWidget *button_widget;
@@ -564,7 +566,8 @@ e_sidebar_add_button (ESidebar *sidebar,
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
gtk_widget_show (hbox);
- icon_widget = gtk_image_new_from_pixbuf (icon);
+ icon_widget = gtk_image_new_from_icon_name (
+ icon_name, GTK_ICON_SIZE_BUTTON);
gtk_widget_show (icon_widget);
label_widget = gtk_label_new (label);
@@ -603,16 +606,15 @@ e_sidebar_add_button (ESidebar *sidebar,
/**
* e_sidebar_change_button_icon
+ * @sidebar: an #ESidebar
+ * @icon_name: button icon name, or %NULL
+ * @button_id: component's button ID, for which change the 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)
+e_sidebar_change_button_icon (ESidebar *sidebar, const gchar *icon_name, int button_id)
{
GSList *p;
@@ -625,16 +627,12 @@ e_sidebar_change_button_icon (ESidebar *sidebar, GdkPixbuf *icon, int 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)));
+ if (icon_name == NULL)
+ icon_name = button->default_icon_name;
- 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;
- }
+ gtk_image_set_from_icon_name (
+ GTK_IMAGE (button->icon),
+ icon_name, GTK_ICON_SIZE_BUTTON);
break;
}
diff --git a/shell/e-sidebar.h b/shell/e-sidebar.h
index 319f7e8f04..3ab9350e55 100644
--- a/shell/e-sidebar.h
+++ b/shell/e-sidebar.h
@@ -67,14 +67,14 @@ void e_sidebar_set_selection_widget (ESidebar *sidebar,
void e_sidebar_add_button (ESidebar *sidebar,
const char *label,
const char *tooltips,
- GdkPixbuf *icon,
+ const char *icon_name,
int id);
void e_sidebar_select_button (ESidebar *sidebar,
int id);
void e_sidebar_change_button_icon (ESidebar *sidebar,
- GdkPixbuf *icon,
+ const char *icon_name,
int button_id);
ESidebarMode e_sidebar_get_mode (ESidebar *sidebar);