diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-07-09 04:45:49 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-07-09 04:45:49 +0800 |
commit | 82c99d625bf2d763adf0b812dd59b92a4aaa4735 (patch) | |
tree | bbd0e022c15bf6e947f47bcb2bb1950444785d9b /shell/e-shortcuts-view.c | |
parent | b749cf077233687b34a5ae0aed1ee33d23b76471 (diff) | |
download | gsoc2013-evolution-82c99d625bf2d763adf0b812dd59b92a4aaa4735.tar.gz gsoc2013-evolution-82c99d625bf2d763adf0b812dd59b92a4aaa4735.tar.zst gsoc2013-evolution-82c99d625bf2d763adf0b812dd59b92a4aaa4735.zip |
Change the group icon size using e_shortcuts_set_group_uses_small_icons()
* e-shortcuts-view.c (toggle_large_icons_cb): Change the group
icon size using e_shortcuts_set_group_uses_small_icons() instead
of changing it on the widget directly.
(toggle_small_icons_cb): Likewise.
(group_change_icon_size_callback): New, callback for the
"group_change_icon_size" signal on the EShortcuts object.
(e_shortcuts_view_construct): Connect. Also, initialize the icon
sizes in the icon bars from the EShortcuts object.
* e-shell-view.c (e_shell_view_load_settings): Don't set the
shortcut group icon modes here anymore.
* e-shortcuts.c: New member use_small_icons in struct
ShortcutGroup.
(shortcut_group_new): Init to FALSE.
(e_shortcuts_set_group_uses_small_icons): New.
(e_shortcuts_get_group_uses_small_icons): New.
(class_init): Install "group_change_icon_size" signal.
(save_shortcuts): Save the icon size per-group
here, i.e. <group title="foo" icon_size="small">.
(load_shortcuts): Set the icon size from the group's definition
here.
* e-shortcuts.h: New signal "group_change_icon_size" in
EShortcutsClass.
svn path=/trunk/; revision=17386
Diffstat (limited to 'shell/e-shortcuts-view.c')
-rw-r--r-- | shell/e-shortcuts-view.c | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c index fea3182dd9..670bae4468 100644 --- a/shell/e-shortcuts-view.c +++ b/shell/e-shortcuts-view.c @@ -65,6 +65,8 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; +/* Utility functions. */ + static void show_new_group_dialog (EShortcutsView *view) { @@ -106,9 +108,7 @@ toggle_large_icons_cb (GtkWidget *widget, if (! GTK_CHECK_MENU_ITEM (widget)->active) return; - e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (menu_data->shortcuts_view), - menu_data->group_num, - E_ICON_BAR_LARGE_ICONS); + e_shortcuts_set_group_uses_small_icons (menu_data->shortcuts_view->priv->shortcuts, menu_data->group_num, FALSE); } static void @@ -124,9 +124,7 @@ toggle_small_icons_cb (GtkWidget *widget, if (! GTK_CHECK_MENU_ITEM (widget)->active) return; - e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (menu_data->shortcuts_view), - menu_data->group_num, - E_ICON_BAR_SMALL_ICONS); + e_shortcuts_set_group_uses_small_icons (menu_data->shortcuts_view->priv->shortcuts, menu_data->group_num, TRUE); } static void @@ -218,14 +216,12 @@ rename_group_cb (GtkWidget *widget, to an actual ShortcutBar bug. */ group = e_group_bar_get_current_group_num (E_GROUP_BAR (E_SHORTCUT_BAR (shortcuts_view))); - original_view_type = e_shortcut_bar_get_view_type (E_SHORTCUT_BAR (menu_data->shortcuts_view), - group); + original_view_type = e_shortcut_bar_get_view_type (E_SHORTCUT_BAR (menu_data->shortcuts_view), group); e_shortcuts_rename_group (shortcuts, menu_data->group_num, new_name); g_free (new_name); e_group_bar_set_current_group_num (E_GROUP_BAR (E_SHORTCUT_BAR (shortcuts_view)), group, FALSE); - e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (menu_data->shortcuts_view), - group, original_view_type); + e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (menu_data->shortcuts_view), group, original_view_type); } static GnomeUIInfo icon_size_radio_group_uiinfo[] = { @@ -424,6 +420,26 @@ pop_up_right_click_menu_for_shortcut (EShortcutsView *shortcuts_view, } +/* View callbacks. This part exists mostly because of breakage in the + EShortcutBar design. */ + +static void +group_change_icon_size_callback (EShortcuts *shortucts, + int group_num, + gboolean use_small_icons, + void *data) +{ + EShortcutsView *view; + + view = E_SHORTCUTS_VIEW (data); + + if (use_small_icons) + e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (view), group_num, E_ICON_BAR_SMALL_ICONS); + else + e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (view), group_num, E_ICON_BAR_LARGE_ICONS); +} + + /* GtkObject methods. */ static void @@ -685,6 +701,7 @@ e_shortcuts_view_construct (EShortcutsView *shortcuts_view, EShortcuts *shortcuts) { EShortcutsViewPrivate *priv; + int i, num_groups; g_return_if_fail (shortcuts != NULL); g_return_if_fail (E_IS_SHORTCUTS (shortcuts)); @@ -696,6 +713,18 @@ e_shortcuts_view_construct (EShortcutsView *shortcuts_view, e_shortcut_bar_set_model (E_SHORTCUT_BAR (shortcuts_view), E_SHORTCUT_MODEL (e_shortcuts_view_model_new (shortcuts))); + + gtk_signal_connect_while_alive (GTK_OBJECT (shortcuts), "group_change_icon_size", + GTK_SIGNAL_FUNC (group_change_icon_size_callback), + shortcuts_view, GTK_OBJECT (shortcuts_view)); + + num_groups = e_shortcuts_get_num_groups (shortcuts); + for (i = 0; i < num_groups; i ++) { + if (e_shortcuts_get_group_uses_small_icons (shortcuts, i)) + e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (shortcuts_view), i, E_ICON_BAR_SMALL_ICONS); + else + e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (shortcuts_view), i, E_ICON_BAR_LARGE_ICONS); + } } GtkWidget * |