diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2003-11-13 04:22:12 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2003-11-13 04:22:12 +0800 |
commit | 5d07b9739f9c601b3f627b7a586fc02946c81a75 (patch) | |
tree | 3734d48b08c1fc40d962605b216a354348687470 | |
parent | f0427b10105cd3046923d4362d73150cd5c7208f (diff) | |
download | gsoc2013-evolution-5d07b9739f9c601b3f627b7a586fc02946c81a75.tar.gz gsoc2013-evolution-5d07b9739f9c601b3f627b7a586fc02946c81a75.tar.zst gsoc2013-evolution-5d07b9739f9c601b3f627b7a586fc02946c81a75.zip |
Call e_sidebar_select_button() instead of switch_view().
* e-shell-window.c (e_shell_window_switch_to_component): Call
e_sidebar_select_button() instead of switch_view().
* e-sidebar.c (update_buttons): New helper function.
(e_sidebar_select_button): New.
svn path=/trunk/; revision=23299
-rw-r--r-- | shell/ChangeLog | 8 | ||||
-rw-r--r-- | shell/e-shell-window.c | 2 | ||||
-rw-r--r-- | shell/e-sidebar.c | 76 | ||||
-rw-r--r-- | shell/e-sidebar.h | 2 |
4 files changed, 63 insertions, 25 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index bc8031d33a..07b908529a 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,11 @@ +2003-11-12 Ettore Perazzoli <ettore@ximian.com> + + * e-shell-window.c (e_shell_window_switch_to_component): Call + e_sidebar_select_button() instead of switch_view(). + + * e-sidebar.c (update_buttons): New helper function. + (e_sidebar_select_button): New. + 2003-11-11 JP Rosevear <jpr@ximian.com> * main.c (kill_dataserver): kill the right thing diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index 158ef3b485..586f7e6419 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -478,7 +478,7 @@ e_shell_window_switch_to_component (EShellWindow *window, const char *component_ return; } - switch_view (window, view); + e_sidebar_select_button (E_SIDEBAR (priv->sidebar), view->button_id); } diff --git a/shell/e-sidebar.c b/shell/e-sidebar.c index ca94de9a9a..5636716b32 100644 --- a/shell/e-sidebar.c +++ b/shell/e-sidebar.c @@ -62,6 +62,49 @@ static unsigned int signals[NUM_SIGNALS] = { 0 }; #define PADDING 6 +/* Utility functions. */ + +static Button * +button_new (GtkWidget *button_widget, + int id) +{ + Button *button = g_new (Button, 1); + + button->button_widget = button_widget; + button->id = id; + + g_object_ref (button_widget); + + return button; +} + +static void +button_free (Button *button) +{ + g_object_unref (button->button_widget); + g_free (button); +} + +static void +update_buttons (ESidebar *sidebar, int new_selected_id) +{ + GSList *p; + + sidebar->priv->in_toggle = TRUE; + + for (p = sidebar->priv->buttons; p != NULL; p = p->next) { + Button *button = p->data; + + if (button->id == new_selected_id) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button->button_widget), TRUE); + else + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button->button_widget), FALSE); + } + + sidebar->priv->in_toggle = FALSE; +} + + /* Callbacks. */ static void @@ -93,30 +136,6 @@ button_toggled_callback (GtkToggleButton *toggle_button, } -/* Utility functions. */ - -static Button * -button_new (GtkWidget *button_widget, - int id) -{ - Button *button = g_new (Button, 1); - - button->button_widget = button_widget; - button->id = id; - - g_object_ref (button_widget); - - return button; -} - -static void -button_free (Button *button) -{ - g_object_unref (button->button_widget); - g_free (button); -} - - /* Layout. */ static void @@ -422,4 +441,13 @@ e_sidebar_add_button (ESidebar *sidebar, } +void +e_sidebar_select_button (ESidebar *sidebar, int id) +{ + update_buttons (sidebar, id); + + g_signal_emit (sidebar, signals[BUTTON_SELECTED], 0, id); +} + + E_MAKE_TYPE (e_sidebar, "ESidebar", ESidebar, class_init, init, PARENT_TYPE) diff --git a/shell/e-sidebar.h b/shell/e-sidebar.h index d77a7c91b7..e224698346 100644 --- a/shell/e-sidebar.h +++ b/shell/e-sidebar.h @@ -60,5 +60,7 @@ void e_sidebar_add_button (ESidebar *sidebar, GdkPixbuf *icon, int id); +void e_sidebar_select_button (ESidebar *sidebar, + int id); #endif /* _E_SIDEBAR_H_ */ |