Bug 795870 - Add a way to initiate refresh of account sources
[evolution.git] / src / shell / e-shell-switcher.c
blob9f0c8eb40aabf8cab77cdffc0af68f951cdcecef
1 /*
2 * e-shell-switcher.c
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
21 /**
22 * SECTION: e-shell-switcher
23 * @short_description: buttons for switching views
24 * @include: shell/e-shell-switcher.h
25 **/
27 #include "evolution-config.h"
29 #include "e-shell-switcher.h"
31 #include <glib/gi18n.h>
32 #include <libebackend/libebackend.h>
34 #include <e-util/e-util.h>
36 #include "e-shell-window-private.h"
38 #define E_SHELL_SWITCHER_GET_PRIVATE(obj) \
39 (G_TYPE_INSTANCE_GET_PRIVATE \
40 ((obj), E_TYPE_SHELL_SWITCHER, EShellSwitcherPrivate))
42 #define E_SHELL_SWITCHER_GET_PRIVATE(obj) \
43 (G_TYPE_INSTANCE_GET_PRIVATE \
44 ((obj), E_TYPE_SHELL_SWITCHER, EShellSwitcherPrivate))
46 #define H_PADDING 6
47 #define V_PADDING 6
49 struct _EShellSwitcherPrivate {
50 GList *proxies;
51 gboolean style_set;
52 GtkToolbarStyle style;
53 GtkSettings *settings;
54 gulong settings_handler_id;
55 gboolean toolbar_visible;
58 enum {
59 PROP_0,
60 PROP_TOOLBAR_STYLE,
61 PROP_TOOLBAR_VISIBLE
64 enum {
65 STYLE_CHANGED,
66 LAST_SIGNAL
69 static guint signals[LAST_SIGNAL];
71 /* Forward Declarations */
72 static void shell_switcher_tool_shell_iface_init (GtkToolShellIface *iface);
74 G_DEFINE_TYPE_WITH_CODE (
75 EShellSwitcher,
76 e_shell_switcher,
77 GTK_TYPE_BIN,
78 G_IMPLEMENT_INTERFACE (
79 E_TYPE_EXTENSIBLE, NULL)
80 G_IMPLEMENT_INTERFACE (
81 GTK_TYPE_TOOL_SHELL,
82 shell_switcher_tool_shell_iface_init))
84 static gint
85 shell_switcher_layout_actions (EShellSwitcher *switcher)
87 GtkAllocation allocation;
88 gint num_btns = g_list_length (switcher->priv->proxies), btns_per_row;
89 GList **rows, *p;
90 gboolean icons_only;
91 gint row_number;
92 gint max_width = 0;
93 gint max_height = 0;
94 gint row_last;
95 gint x, y;
96 gint i;
98 gtk_widget_get_allocation (GTK_WIDGET (switcher), &allocation);
100 y = allocation.y + allocation.height;
102 if (num_btns == 0)
103 return allocation.height;
105 icons_only = (switcher->priv->style == GTK_TOOLBAR_ICONS);
107 /* Figure out the max width and height. */
108 for (p = switcher->priv->proxies; p != NULL; p = p->next) {
109 GtkWidget *widget = p->data;
110 GtkRequisition requisition;
112 gtk_widget_get_preferred_size (widget, &requisition, NULL);
113 max_height = MAX (max_height, requisition.height);
114 max_width = MAX (max_width, requisition.width);
117 /* Figure out how many rows and columns we'll use. */
118 btns_per_row = MAX (1, allocation.width / (max_width + H_PADDING));
119 if (!icons_only) {
120 /* If using text buttons, we want to try to have a
121 * completely filled-in grid, but if we can't, we want
122 * the odd row to have just a single button. */
123 while (btns_per_row > 0 && num_btns % btns_per_row > 1)
124 btns_per_row--;
127 if (btns_per_row <= 0)
128 btns_per_row = 1;
130 /* Assign buttons to rows. */
131 rows = g_new0 (GList *, num_btns / btns_per_row + 1);
133 if (!icons_only && num_btns % btns_per_row != 0 && switcher->priv->proxies) {
134 rows[0] = g_list_append (rows[0], switcher->priv->proxies->data);
136 p = switcher->priv->proxies->next;
137 row_number = p ? 1 : 0;
138 } else {
139 p = switcher->priv->proxies;
140 row_number = 0;
143 for (; p != NULL; p = p->next) {
144 GtkWidget *widget = p->data;
146 if (g_list_length (rows[row_number]) == btns_per_row)
147 row_number++;
149 rows[row_number] = g_list_append (rows[row_number], widget);
152 row_last = row_number;
154 /* Layout the buttons. */
155 for (i = row_last; i >= 0; i--) {
156 gint len, extra_width;
158 x = H_PADDING + allocation.x;
159 y -= max_height + V_PADDING;
160 len = g_list_length (rows[i]);
161 if (!icons_only)
162 extra_width =
163 (allocation.width - (len * max_width) -
164 (len * H_PADDING + H_PADDING)) / len;
165 else
166 extra_width = 0;
167 for (p = rows[i]; p != NULL; p = p->next) {
168 GtkAllocation child_allocation;
170 child_allocation.x = x;
171 child_allocation.y = y;
172 child_allocation.width = max_width + extra_width;
173 child_allocation.height = max_height;
175 gtk_widget_size_allocate (
176 GTK_WIDGET (p->data), &child_allocation);
178 x += child_allocation.width + H_PADDING;
182 for (i = 0; i <= row_last; i++)
183 g_list_free (rows[i]);
184 g_free (rows);
186 return y - allocation.y - V_PADDING;
189 static void
190 shell_switcher_toolbar_style_changed_cb (EShellSwitcher *switcher)
192 if (!switcher->priv->style_set) {
193 switcher->priv->style_set = TRUE;
194 e_shell_switcher_unset_style (switcher);
198 static void
199 shell_switcher_set_property (GObject *object,
200 guint property_id,
201 const GValue *value,
202 GParamSpec *pspec)
204 switch (property_id) {
205 case PROP_TOOLBAR_STYLE:
206 e_shell_switcher_set_style (
207 E_SHELL_SWITCHER (object),
208 g_value_get_enum (value));
209 return;
211 case PROP_TOOLBAR_VISIBLE:
212 e_shell_switcher_set_visible (
213 E_SHELL_SWITCHER (object),
214 g_value_get_boolean (value));
215 return;
218 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
221 static void
222 shell_switcher_get_property (GObject *object,
223 guint property_id,
224 GValue *value,
225 GParamSpec *pspec)
227 switch (property_id) {
228 case PROP_TOOLBAR_STYLE:
229 g_value_set_enum (
230 value, e_shell_switcher_get_style (
231 E_SHELL_SWITCHER (object)));
232 return;
234 case PROP_TOOLBAR_VISIBLE:
235 g_value_set_boolean (
236 value, e_shell_switcher_get_visible (
237 E_SHELL_SWITCHER (object)));
238 return;
241 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
244 static void
245 shell_switcher_dispose (GObject *object)
247 EShellSwitcherPrivate *priv;
249 priv = E_SHELL_SWITCHER_GET_PRIVATE (object);
251 while (priv->proxies != NULL) {
252 GtkWidget *widget = priv->proxies->data;
253 gtk_container_remove (GTK_CONTAINER (object), widget);
256 /* Chain up to parent's dispose() method. */
257 G_OBJECT_CLASS (e_shell_switcher_parent_class)->dispose (object);
260 static void
261 shell_switcher_get_preferred_width (GtkWidget *widget,
262 gint *minimum,
263 gint *natural)
265 EShellSwitcherPrivate *priv;
266 GtkWidget *child;
267 GList *iter;
269 priv = E_SHELL_SWITCHER_GET_PRIVATE (widget);
271 *minimum = *natural = 0;
273 child = gtk_bin_get_child (GTK_BIN (widget));
274 if (child != NULL)
275 gtk_widget_get_preferred_width (child, minimum, natural);
277 if (!priv->toolbar_visible)
278 return;
280 for (iter = priv->proxies; iter != NULL; iter = iter->next) {
281 GtkWidget *widget_proxy = iter->data;
282 gint child_min, child_nat;
284 gtk_widget_get_preferred_width (
285 widget_proxy, &child_min, &child_nat);
287 child_min += H_PADDING;
288 child_nat += H_PADDING;
290 *minimum = MAX (*minimum, child_min);
291 *natural = MAX (*natural, child_nat);
295 static void
296 shell_switcher_get_preferred_height (GtkWidget *switcher_widget,
297 gint *minimum,
298 gint *natural)
300 EShellSwitcherPrivate *priv;
301 GtkWidget *child;
302 GList *iter;
304 priv = E_SHELL_SWITCHER_GET_PRIVATE (switcher_widget);
306 *minimum = *natural = 0;
308 child = gtk_bin_get_child (GTK_BIN (switcher_widget));
309 if (child != NULL)
310 gtk_widget_get_preferred_height (child, minimum, natural);
312 if (!priv->toolbar_visible)
313 return;
315 for (iter = priv->proxies; iter != NULL; iter = iter->next) {
316 GtkWidget *widget = iter->data;
317 gint child_min, child_nat;
319 gtk_widget_get_preferred_height (
320 widget, &child_min, &child_nat);
322 child_min += V_PADDING;
323 child_nat += V_PADDING;
325 *minimum += child_min;
326 *natural += child_nat;
330 static void
331 shell_switcher_size_allocate (GtkWidget *widget,
332 GtkAllocation *allocation)
334 EShellSwitcher *switcher;
335 GtkAllocation child_allocation;
336 GtkWidget *child;
337 gint height;
339 switcher = E_SHELL_SWITCHER (widget);
341 gtk_widget_set_allocation (widget, allocation);
343 if (switcher->priv->toolbar_visible)
344 height = shell_switcher_layout_actions (switcher);
345 else
346 height = allocation->height;
348 child_allocation.x = allocation->x;
349 child_allocation.y = allocation->y;
350 child_allocation.width = allocation->width;
351 child_allocation.height = height;
353 child = gtk_bin_get_child (GTK_BIN (widget));
354 if (child != NULL)
355 gtk_widget_size_allocate (child, &child_allocation);
358 static void
359 shell_switcher_screen_changed (GtkWidget *widget,
360 GdkScreen *previous_screen)
362 EShellSwitcherPrivate *priv;
363 GtkSettings *settings;
365 priv = E_SHELL_SWITCHER_GET_PRIVATE (widget);
367 if (gtk_widget_has_screen (widget))
368 settings = gtk_widget_get_settings (widget);
369 else
370 settings = NULL;
372 if (settings == priv->settings)
373 return;
375 if (priv->settings != NULL) {
376 g_signal_handler_disconnect (
377 priv->settings, priv->settings_handler_id);
378 g_object_unref (priv->settings);
381 if (settings != NULL) {
382 priv->settings = g_object_ref (settings);
383 priv->settings_handler_id = e_signal_connect_notify_swapped (
384 settings, "notify::gtk-toolbar-style",
385 G_CALLBACK (shell_switcher_toolbar_style_changed_cb),
386 widget);
387 } else
388 priv->settings = NULL;
390 shell_switcher_toolbar_style_changed_cb (E_SHELL_SWITCHER (widget));
393 static void
394 shell_switcher_remove (GtkContainer *container,
395 GtkWidget *remove_widget)
397 EShellSwitcherPrivate *priv;
398 GList *link;
400 priv = E_SHELL_SWITCHER_GET_PRIVATE (container);
402 /* Look in the internal widgets first. */
404 link = g_list_find (priv->proxies, remove_widget);
405 if (link != NULL) {
406 GtkWidget *widget = link->data;
408 gtk_widget_unparent (widget);
409 priv->proxies = g_list_delete_link (priv->proxies, link);
410 gtk_widget_queue_resize (GTK_WIDGET (container));
411 return;
414 /* Chain up to parent's remove() method. */
415 GTK_CONTAINER_CLASS (e_shell_switcher_parent_class)->remove (
416 container, remove_widget);
419 static void
420 shell_switcher_forall (GtkContainer *container,
421 gboolean include_internals,
422 GtkCallback callback,
423 gpointer callback_data)
425 EShellSwitcherPrivate *priv;
427 priv = E_SHELL_SWITCHER_GET_PRIVATE (container);
429 if (include_internals)
430 g_list_foreach (
431 priv->proxies, (GFunc) callback, callback_data);
433 /* Chain up to parent's forall() method. */
434 GTK_CONTAINER_CLASS (e_shell_switcher_parent_class)->forall (
435 container, include_internals, callback, callback_data);
438 static void
439 shell_switcher_style_changed (EShellSwitcher *switcher,
440 GtkToolbarStyle style)
442 if (switcher->priv->style == style)
443 return;
445 switcher->priv->style = style;
447 g_list_foreach (
448 switcher->priv->proxies,
449 (GFunc) gtk_tool_item_toolbar_reconfigured, NULL);
451 gtk_widget_queue_resize (GTK_WIDGET (switcher));
452 g_object_notify (G_OBJECT (switcher), "toolbar-style");
455 static GtkIconSize
456 shell_switcher_get_icon_size (GtkToolShell *shell)
458 return GTK_ICON_SIZE_LARGE_TOOLBAR;
461 static GtkOrientation
462 shell_switcher_get_orientation (GtkToolShell *shell)
464 return GTK_ORIENTATION_HORIZONTAL;
467 static GtkToolbarStyle
468 shell_switcher_get_style (GtkToolShell *shell)
470 return e_shell_switcher_get_style (E_SHELL_SWITCHER (shell));
473 static GtkReliefStyle
474 shell_switcher_get_relief_style (GtkToolShell *shell)
476 return GTK_RELIEF_NORMAL;
479 static gfloat
480 shell_switcher_get_text_alignment (GtkToolShell *shell)
482 return 0.0;
485 static void
486 e_shell_switcher_class_init (EShellSwitcherClass *class)
488 GObjectClass *object_class;
489 GtkWidgetClass *widget_class;
490 GtkContainerClass *container_class;
492 g_type_class_add_private (class, sizeof (EShellSwitcherPrivate));
494 object_class = G_OBJECT_CLASS (class);
495 object_class->set_property = shell_switcher_set_property;
496 object_class->get_property = shell_switcher_get_property;
497 object_class->dispose = shell_switcher_dispose;
499 widget_class = GTK_WIDGET_CLASS (class);
500 widget_class->get_preferred_width = shell_switcher_get_preferred_width;
501 widget_class->get_preferred_height = shell_switcher_get_preferred_height;
502 widget_class->size_allocate = shell_switcher_size_allocate;
503 widget_class->screen_changed = shell_switcher_screen_changed;
505 container_class = GTK_CONTAINER_CLASS (class);
506 container_class->remove = shell_switcher_remove;
507 container_class->forall = shell_switcher_forall;
509 class->style_changed = shell_switcher_style_changed;
512 * EShellSwitcher:toolbar-style
514 * The switcher's toolbar style.
516 g_object_class_install_property (
517 object_class,
518 PROP_TOOLBAR_STYLE,
519 g_param_spec_enum (
520 "toolbar-style",
521 "Toolbar Style",
522 "The switcher's toolbar style",
523 GTK_TYPE_TOOLBAR_STYLE,
524 E_SHELL_SWITCHER_DEFAULT_TOOLBAR_STYLE,
525 G_PARAM_READWRITE |
526 G_PARAM_CONSTRUCT |
527 G_PARAM_STATIC_STRINGS));
530 * EShellSwitcher:toolbar-visible
532 * Whether the switcher is visible.
534 g_object_class_install_property (
535 object_class,
536 PROP_TOOLBAR_VISIBLE,
537 g_param_spec_boolean (
538 "toolbar-visible",
539 "Toolbar Visible",
540 "Whether the switcher is visible",
541 TRUE,
542 G_PARAM_READWRITE |
543 G_PARAM_CONSTRUCT |
544 G_PARAM_STATIC_STRINGS));
547 * EShellSwitcher::style-changed
548 * @switcher: the #EShellSwitcher which emitted the signal
549 * @style: the new #GtkToolbarStyle of the switcher
551 * Emitted when the style of the switcher changes.
553 signals[STYLE_CHANGED] = g_signal_new (
554 "style-changed",
555 G_OBJECT_CLASS_TYPE (class),
556 G_SIGNAL_RUN_FIRST,
557 G_STRUCT_OFFSET (EShellSwitcherClass, style_changed),
558 NULL, NULL,
559 g_cclosure_marshal_VOID__ENUM,
560 G_TYPE_NONE, 1,
561 GTK_TYPE_TOOLBAR_STYLE);
564 static void
565 e_shell_switcher_init (EShellSwitcher *switcher)
567 switcher->priv = E_SHELL_SWITCHER_GET_PRIVATE (switcher);
569 gtk_widget_set_has_window (GTK_WIDGET (switcher), FALSE);
571 e_extensible_load_extensions (E_EXTENSIBLE (switcher));
574 static void
575 shell_switcher_tool_shell_iface_init (GtkToolShellIface *iface)
577 iface->get_icon_size = shell_switcher_get_icon_size;
578 iface->get_orientation = shell_switcher_get_orientation;
579 iface->get_style = shell_switcher_get_style;
580 iface->get_relief_style = shell_switcher_get_relief_style;
581 iface->get_text_alignment = shell_switcher_get_text_alignment;
585 * e_shell_switcher_new:
587 * Creates a new #EShellSwitcher instance.
589 * Returns: a new #EShellSwitcher instance
591 GtkWidget *
592 e_shell_switcher_new (void)
594 return g_object_new (E_TYPE_SHELL_SWITCHER, NULL);
598 * gtk+ doesn't give us what we want - a middle click,
599 * option on toolbar items, so we have to get it by force.
601 static GtkButton *
602 tool_item_get_button (GtkWidget *widget)
604 GtkWidget *child;
606 g_return_val_if_fail (GTK_IS_TOOL_ITEM (widget), NULL);
608 child = gtk_bin_get_child (GTK_BIN (widget));
609 if (child != NULL && GTK_IS_BUTTON (child))
610 return GTK_BUTTON (child);
611 else
612 return NULL;
615 static gboolean
616 tool_item_button_cb (GtkWidget *internal_widget,
617 GdkEvent *button_event,
618 GtkAction *action)
620 guint32 my_mods = GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK |
621 GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_META_MASK;
622 GdkModifierType event_state = 0;
623 guint event_button = 0;
625 g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
627 gdk_event_get_button (button_event, &event_button);
628 gdk_event_get_state (button_event, &event_state);
630 if (event_button == 2 || (event_button == 1 && (event_state & my_mods) == GDK_SHIFT_MASK)) {
631 gtk_action_activate (action);
632 return TRUE;
635 return FALSE;
639 * e_shell_switcher_add_action:
640 * @switcher: an #EShellSwitcher
641 * @switch_action: a #GtkAction
642 * @new_window_action: a #GtkAction
644 * Adds a button to @switcher that proxies for @switcher_action.
645 * Switcher buttons appear in the order they were added. A middle
646 * click opens a new window of this type.
648 * #EShellWindow adds switcher actions in the order given by the
649 * <structfield>sort_order</structfield> field in #EShellBackendClass.
651 void
652 e_shell_switcher_add_action (EShellSwitcher *switcher,
653 GtkAction *switch_action,
654 GtkAction *new_window_action)
656 GtkWidget *widget;
657 GtkButton *button;
658 GSettings *settings;
659 gchar **strv;
660 gint ii;
661 gboolean skip = FALSE;
663 g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
664 g_return_if_fail (GTK_IS_ACTION (switch_action));
665 g_return_if_fail (GTK_IS_ACTION (new_window_action));
667 settings = e_util_ref_settings ("org.gnome.evolution.shell");
668 strv = g_settings_get_strv (settings, "buttons-hide");
669 g_clear_object (&settings);
671 for (ii = 0; strv && strv[ii] && !skip; ii++) {
672 gchar *name;
674 name = g_strdup_printf (E_SHELL_SWITCHER_FORMAT, strv[ii]);
675 skip = g_strcmp0 (name, gtk_action_get_name (switch_action)) == 0;
676 g_free (name);
679 g_strfreev (strv);
681 if (skip)
682 return;
684 g_object_ref (switch_action);
685 widget = gtk_action_create_tool_item (switch_action);
686 gtk_tool_item_set_is_important (GTK_TOOL_ITEM (widget), TRUE);
687 gtk_widget_show (widget);
689 button = tool_item_get_button (widget);
690 if (button != NULL)
691 g_signal_connect (
692 button, "button-release-event",
693 G_CALLBACK (tool_item_button_cb),
694 new_window_action);
696 switcher->priv->proxies = g_list_append (
697 switcher->priv->proxies, widget);
699 gtk_widget_set_parent (widget, GTK_WIDGET (switcher));
700 gtk_widget_queue_resize (GTK_WIDGET (switcher));
704 * e_shell_switcher_get_style:
705 * @switcher: an #EShellSwitcher
707 * Returns whether @switcher has text, icons or both.
709 * Returns: the current style of @shell
711 GtkToolbarStyle
712 e_shell_switcher_get_style (EShellSwitcher *switcher)
714 g_return_val_if_fail (
715 E_IS_SHELL_SWITCHER (switcher),
716 E_SHELL_SWITCHER_DEFAULT_TOOLBAR_STYLE);
718 return switcher->priv->style;
722 * e_shell_switcher_set_style:
723 * @switcher: an #EShellSwitcher
724 * @style: the new style for @switcher
726 * Alters the view of @switcher to display either icons only, text only,
727 * or both.
729 void
730 e_shell_switcher_set_style (EShellSwitcher *switcher,
731 GtkToolbarStyle style)
733 g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
735 switcher->priv->style_set = TRUE;
736 g_signal_emit (switcher, signals[STYLE_CHANGED], 0, style);
740 * e_shell_switcher_unset_style:
741 * @switcher: an #EShellSwitcher
743 * Unsets a switcher style set with e_shell_switcher_set_style(), so
744 * that user preferences will be used to determine the switcher style.
746 void
747 e_shell_switcher_unset_style (EShellSwitcher *switcher)
749 GtkSettings *settings;
750 GtkToolbarStyle style;
752 g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
754 if (!switcher->priv->style_set)
755 return;
757 settings = switcher->priv->settings;
758 if (settings != NULL)
759 g_object_get (settings, "gtk-toolbar-style", &style, NULL);
760 else
761 style = E_SHELL_SWITCHER_DEFAULT_TOOLBAR_STYLE;
763 if (style == GTK_TOOLBAR_BOTH)
764 style = GTK_TOOLBAR_BOTH_HORIZ;
766 if (style != switcher->priv->style)
767 g_signal_emit (switcher, signals[STYLE_CHANGED], 0, style);
769 switcher->priv->style_set = FALSE;
773 * e_shell_switcher_get_visible:
774 * @switcher: an #EShellSwitcher
776 * Returns %TRUE if the switcher buttons are visible.
778 * Note that switcher button visibility is different than
779 * @switcher<!-- -->'s GTK_VISIBLE flag, since #EShellSwitcher
780 * is actually a container widget for #EShellSidebar.
782 * Returns: %TRUE if the switcher buttons are visible
784 gboolean
785 e_shell_switcher_get_visible (EShellSwitcher *switcher)
787 g_return_val_if_fail (E_IS_SHELL_SWITCHER (switcher), FALSE);
789 return switcher->priv->toolbar_visible;
793 * e_shell_switcher_set_visible:
794 * @switcher: an #EShellSwitcher
795 * @visible: whether the switcher buttons should be visible
797 * Sets the switcher button visiblity to @visible.
799 * Note that switcher button visibility is different than
800 * @switcher<!-- -->'s GTK_VISIBLE flag, since #EShellSwitcher
801 * is actually a container widget for #EShellSidebar.
803 void
804 e_shell_switcher_set_visible (EShellSwitcher *switcher,
805 gboolean visible)
807 GList *iter;
809 g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
811 if (switcher->priv->toolbar_visible == visible)
812 return;
814 switcher->priv->toolbar_visible = visible;
816 for (iter = switcher->priv->proxies; iter != NULL; iter = iter->next)
817 g_object_set (iter->data, "visible", visible, NULL);
819 gtk_widget_queue_resize (GTK_WIDGET (switcher));
821 g_object_notify (G_OBJECT (switcher), "toolbar-visible");