aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-sidebar.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2003-11-13 04:22:12 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2003-11-13 04:22:12 +0800
commit5d07b9739f9c601b3f627b7a586fc02946c81a75 (patch)
tree3734d48b08c1fc40d962605b216a354348687470 /shell/e-sidebar.c
parentf0427b10105cd3046923d4362d73150cd5c7208f (diff)
downloadgsoc2013-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
Diffstat (limited to 'shell/e-sidebar.c')
-rw-r--r--shell/e-sidebar.c76
1 files changed, 52 insertions, 24 deletions
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)