aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-content.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-10-16 02:51:13 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-19 00:32:36 +0800
commit51ebf20237270a785af0aa0e614db42275a05c62 (patch)
tree328b2fe9b7aa111f0cb21f23b11bc2eaf6da3ac8 /shell/e-shell-content.c
parent2197e6401ec8c5e1b77fa51e085ac068daa39e6a (diff)
downloadgsoc2013-evolution-51ebf20237270a785af0aa0e614db42275a05c62.tar
gsoc2013-evolution-51ebf20237270a785af0aa0e614db42275a05c62.tar.gz
gsoc2013-evolution-51ebf20237270a785af0aa0e614db42275a05c62.tar.bz2
gsoc2013-evolution-51ebf20237270a785af0aa0e614db42275a05c62.tar.lz
gsoc2013-evolution-51ebf20237270a785af0aa0e614db42275a05c62.tar.xz
gsoc2013-evolution-51ebf20237270a785af0aa0e614db42275a05c62.tar.zst
gsoc2013-evolution-51ebf20237270a785af0aa0e614db42275a05c62.zip
EAlert: Allow arbitrary actions to be added.
You can now amend the predefined actions in an EAlert by calling e_alert_add_action(). Useful for adding actions from an existing GtkUIManager. Call e_alert_peek_actions() to obtain a combined list of predefined and custom actions. These will typically serve as "related" actions for GtkButtons (cf. gtk_activatable_set_related_action()). Also, both EShellWindow and EShellView now implement EAlertSink. Use EShellWindow for application-wide alerts, EShellView for view-specific alerts.
Diffstat (limited to 'shell/e-shell-content.c')
-rw-r--r--shell/e-shell-content.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 2648783831..afd69ffdfa 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -36,6 +36,7 @@
#include "e-util/e-alert-dialog.h"
#include "filter/e-rule-editor.h"
#include "widgets/misc/e-action-combo-box.h"
+#include "widgets/misc/e-alert-bar.h"
#include "widgets/misc/e-hinted-entry.h"
#include "e-shell-backend.h"
@@ -244,29 +245,35 @@ shell_content_size_allocate (GtkWidget *widget,
GtkAllocation child_allocation;
GtkRequisition child_requisition;
GtkWidget *child;
+ gint remaining_height;
priv = E_SHELL_CONTENT_GET_PRIVATE (widget);
+ remaining_height = allocation->height;
gtk_widget_set_allocation (widget, allocation);
child_allocation.x = allocation->x;
+ child_allocation.y = allocation->y;
child_allocation.width = allocation->width;
- /* Alert bar gets to be as tall as it wants. */
+ child_requisition.height = 0;
+
+ /* Alert bar gets to be as tall as it wants (if visible). */
child = priv->alert_bar;
- child_allocation.y = allocation->y;
+ child_allocation.y += child_requisition.height;
if (gtk_widget_get_visible (child))
gtk_widget_size_request (child, &child_requisition);
else
child_requisition.height = 0;
+ remaining_height -= child_requisition.height;
child_allocation.height = child_requisition.height;
gtk_widget_size_allocate (child, &child_allocation);
- /* So does the search bar (if we have one). */
+ /* Search bar gets to be as tall as it wants (if we have one). */
child = priv->searchbar;
child_allocation.y += child_requisition.height;
@@ -276,6 +283,7 @@ shell_content_size_allocate (GtkWidget *widget,
else
child_requisition.height = 0;
+ remaining_height -= child_requisition.height;
child_allocation.height = child_requisition.height;
if (child != NULL)
@@ -284,8 +292,7 @@ shell_content_size_allocate (GtkWidget *widget,
/* The GtkBin child gets whatever vertical space is left. */
child_allocation.y += child_requisition.height;
- child_allocation.height =
- allocation->height - child_requisition.height;
+ child_allocation.height = remaining_height;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child != NULL)
@@ -346,9 +353,8 @@ shell_content_submit_alert (EAlertSink *alert_sink,
EShellView *shell_view;
EShellWindow *shell_window;
EShellContent *shell_content;
- EAlertBar *alert_bar;
+ GtkWidget *alert_bar;
GtkWidget *dialog;
- GtkWindow *parent;
shell_content = E_SHELL_CONTENT (alert_sink);
shell_view = e_shell_content_get_shell_view (shell_content);
@@ -359,12 +365,13 @@ shell_content_submit_alert (EAlertSink *alert_sink,
case GTK_MESSAGE_INFO:
case GTK_MESSAGE_WARNING:
case GTK_MESSAGE_ERROR:
- e_alert_bar_add_alert (alert_bar, alert);
+ e_alert_bar_add_alert (
+ E_ALERT_BAR (alert_bar), alert);
break;
default:
- parent = GTK_WINDOW (shell_window);
- dialog = e_alert_dialog_new (parent, alert);
+ dialog = e_alert_dialog_new (
+ GTK_WINDOW (shell_window), alert);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
break;
@@ -395,7 +402,8 @@ e_shell_content_class_init (EShellContentClass *class)
container_class->remove = shell_content_remove;
container_class->forall = shell_content_forall;
- /* EShellContent:alert-bar
+ /**
+ * EShellContent:alert-bar
*
* Displays informational and error messages.
**/
@@ -543,12 +551,12 @@ e_shell_content_focus_search_results (EShellContent *shell_content)
*
* Returns: the #EAlertBar for @shell_content
**/
-EAlertBar *
+GtkWidget *
e_shell_content_get_alert_bar (EShellContent *shell_content)
{
g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), NULL);
- return E_ALERT_BAR (shell_content->priv->alert_bar);
+ return shell_content->priv->alert_bar;
}
/**