aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-04-09 11:19:45 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-04-09 11:21:54 +0800
commite17db00f41d85ef48088fd29c2c55f82875682bd (patch)
treec3009f98e42556ab6950102b29a3142ec6221615 /shell
parenta74acbf19734f875d8b0bd5abf2570c762d5626c (diff)
downloadgsoc2013-evolution-e17db00f41d85ef48088fd29c2c55f82875682bd.tar.gz
gsoc2013-evolution-e17db00f41d85ef48088fd29c2c55f82875682bd.tar.zst
gsoc2013-evolution-e17db00f41d85ef48088fd29c2c55f82875682bd.zip
Add e_shell_view_get_size_group().
Returns a GtkSizeGroup used to keep the search bar and sidebar banner vertically aligned.
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-searchbar.c5
-rw-r--r--shell/e-shell-sidebar.c6
-rw-r--r--shell/e-shell-view.c30
-rw-r--r--shell/e-shell-view.h1
4 files changed, 42 insertions, 0 deletions
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index 85a75da862..24a4ea096a 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -784,12 +784,14 @@ shell_searchbar_constructed (GObject *object)
EShellView *shell_view;
EShellWindow *shell_window;
EShellSearchbar *searchbar;
+ GtkSizeGroup *size_group;
GtkAction *action;
GtkWidget *widget;
searchbar = E_SHELL_SEARCHBAR (object);
shell_view = e_shell_searchbar_get_shell_view (searchbar);
shell_window = e_shell_view_get_shell_window (shell_view);
+ size_group = e_shell_view_get_size_group (shell_view);
g_signal_connect (
shell_view, "clear-search",
@@ -855,6 +857,9 @@ shell_searchbar_constructed (GObject *object)
widget, "primary-icon-tooltip-text",
G_BINDING_SYNC_CREATE);
+ widget = GTK_WIDGET (searchbar);
+ gtk_size_group_add_widget (size_group, widget);
+
e_extensible_load_extensions (E_EXTENSIBLE (object));
/* Chain up to parent's constructed() method. */
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
index 0707008119..a2fa399d77 100644
--- a/shell/e-shell-sidebar.c
+++ b/shell/e-shell-sidebar.c
@@ -201,14 +201,20 @@ shell_sidebar_constructed (GObject *object)
{
EShellView *shell_view;
EShellSidebar *shell_sidebar;
+ GtkSizeGroup *size_group;
GtkAction *action;
+ GtkWidget *widget;
gchar *label;
gchar *icon_name;
shell_sidebar = E_SHELL_SIDEBAR (object);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
+ size_group = e_shell_view_get_size_group (shell_view);
action = e_shell_view_get_action (shell_view);
+ widget = shell_sidebar->priv->event_box;
+ gtk_size_group_add_widget (size_group, widget);
+
g_object_get (action, "icon-name", &icon_name, NULL);
e_shell_sidebar_set_icon_name (shell_sidebar, icon_name);
g_free (icon_name);
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index f13b7c8d69..1cc0efdfc8 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -59,6 +59,7 @@ struct _EShellViewPrivate {
guint merge_id;
GtkAction *action;
+ GtkSizeGroup *size_group;
GtkWidget *shell_content;
GtkWidget *shell_sidebar;
GtkWidget *shell_taskbar;
@@ -613,6 +614,10 @@ shell_view_constructed (GObject *object)
shell_view->priv->searchbar = g_object_ref_sink (widget);
}
+ /* Size group should be safe to unreference now. */
+ g_object_unref (shell_view->priv->size_group);
+ shell_view->priv->size_group = NULL;
+
/* Update actions whenever the Preferences window is closed. */
widget = e_shell_get_preferences_window (shell);
shell_view->priv->preferences_window = g_object_ref (widget);
@@ -1028,6 +1033,8 @@ static void
e_shell_view_init (EShellView *shell_view,
EShellViewClass *class)
{
+ GtkSizeGroup *size_group;
+
/* XXX Our use of GInstanceInitFunc's 'class' parameter
* prevents us from using G_DEFINE_ABSTRACT_TYPE. */
@@ -1037,8 +1044,11 @@ e_shell_view_init (EShellView *shell_view,
if (class->view_collection == NULL)
shell_view_init_view_collection (class);
+ size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+
shell_view->priv = E_SHELL_VIEW_GET_PRIVATE (shell_view);
shell_view->priv->state_key_file = g_key_file_new ();
+ shell_view->priv->size_group = size_group;
}
GType
@@ -1411,6 +1421,26 @@ e_shell_view_get_search_query (EShellView *shell_view)
}
/**
+ * e_shell_view_get_size_group:
+ * @shell_view: an #EShellView
+ *
+ * Returns a #GtkSizeGroup that #EShellContent and #EShellSidebar use
+ * to keep the search bar and sidebar banner vertically aligned. The
+ * rest of the application should have no need for this.
+ *
+ * Note, this is only available during #EShellView construction.
+ *
+ * Returns: a #GtkSizeGroup for internal use
+ **/
+GtkSizeGroup *
+e_shell_view_get_size_group (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return shell_view->priv->size_group;
+}
+
+/**
* e_shell_view_get_shell_backend:
* @shell_view: an #EShellView
*
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index 65c32b2982..068ae392ca 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -208,6 +208,7 @@ EFilterRule * e_shell_view_get_search_rule (EShellView *shell_view);
void e_shell_view_set_search_rule (EShellView *shell_view,
EFilterRule *search_rule);
gchar * e_shell_view_get_search_query (EShellView *shell_view);
+GtkSizeGroup * e_shell_view_get_size_group (EShellView *shell_view);
EShellBackend * e_shell_view_get_shell_backend (EShellView *shell_view);
EShellContent * e_shell_view_get_shell_content (EShellView *shell_view);
EShellSidebar * e_shell_view_get_shell_sidebar (EShellView *shell_view);