[evolution/express2] Handle adding 'X' close button on the menu bar. Restore adding the same for adding in calendar since



commit bde1bc6bca4c5ed63a193f7dc50252e550a0fb40
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Tue May 11 18:47:09 2010 +0530

    Handle adding 'X' close button on the menu bar. Restore adding the same
    for adding in calendar since it doesn't have a toolbar.

 modules/calendar/e-cal-shell-view-actions.c |   26 +++++++++++++++++++++++
 shell/e-shell-view.c                        |    3 +-
 shell/e-shell-window-actions.c              |    8 +++++++
 shell/e-shell-window-private.h              |    1 +
 shell/e-shell-window.c                      |   30 +++++++++++++++++++++++++++
 shell/e-shell-window.h                      |    1 +
 ui/evolution-calendars.ui                   |    7 +++++-
 ui/evolution-shell.ui                       |    2 +
 8 files changed, 76 insertions(+), 2 deletions(-)
---
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 1330ac7..83f6101 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -1196,6 +1196,25 @@ action_event_schedule_cb (GtkAction *action,
 	edit_event_as (cal_shell_view, TRUE);
 }
 
+ static void
+quit_calendar_cb (GtkAction *action,
+                          ECalShellView *cal_shell_view)
+{
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	GdkEvent *event;
+
+	shell_view = E_SHELL_VIEW (cal_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	/* Synthesize a delete_event on this window. */
+	event = gdk_event_new (GDK_DELETE);
+	event->any.window = g_object_ref (((GtkWidget *) shell_window)->window);
+	event->any.send_event = TRUE;
+	gtk_main_do_event (event);
+	gdk_event_free (event);
+}
+
 static void
 action_event_schedule_appointment_cb (GtkAction *action,
                           ECalShellView *cal_shell_view)
@@ -1428,6 +1447,13 @@ static GtkActionEntry calendar_entries[] = {
 	  N_("Converts a meeting to an appointment"),
 	  G_CALLBACK (action_event_schedule_appointment_cb) },
 
+	{ "quit-calendar",
+	  GTK_STOCK_CLOSE,
+	  N_("Quit"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  G_CALLBACK (quit_calendar_cb) },
+
 	/*** Menus ***/
 
 	{ "calendar-actions-menu",
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 77215e7..be099b9 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -670,7 +670,8 @@ shell_view_construct_searchbar (EShellView *shell_view)
 		item = gtk_tool_button_new (image, gtk_action_get_label (action));
 		gtk_widget_set_name (GTK_WIDGET (item), "MeeGoCloseButton");
 		gtk_activatable_set_related_action (GTK_ACTIVATABLE (item), action);
-		gtk_toolbar_insert (GTK_TOOLBAR (main_toolbar), item, -1);
+		gtk_box_pack_start ((GtkBox *)e_shell_window_get_menu_bar_box(shell_window), (GtkWidget *)item, FALSE, FALSE, 0);
+		gtk_widget_show_all((GtkWidget *)item);
 	}
 
 	return widget;
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index 06fce0f..65c6acf 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -1453,6 +1453,14 @@ static GtkActionEntry shell_entries[] = {
 	  N_("Close this window"),
 	  G_CALLBACK (action_close_cb) },
 
+	{ "close-window-menu",
+	  GTK_STOCK_CLOSE,
+	  NULL,
+	  "<Control>w",
+	  N_("Close this window"),
+	  G_CALLBACK (action_close_cb) },
+
+
 	{ "close-window",
 	  GTK_STOCK_CLOSE,
 	  N_("_Close Window"),
diff --git a/shell/e-shell-window-private.h b/shell/e-shell-window-private.h
index 6050ce1..02a6885 100644
--- a/shell/e-shell-window-private.h
+++ b/shell/e-shell-window-private.h
@@ -93,6 +93,7 @@ struct _EShellWindowPrivate {
 	GtkWidget *status_notebook;
 
 	/* Miscellaneous */
+	GtkWidget *menubar_box;
 
 	/* Shell signal handlers. */
 	GArray *signal_handler_ids;
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 0460823..7970f5b 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -344,6 +344,23 @@ shell_window_construct_menubar (EShellWindow *shell_window)
 		shell_window, "/main-menu");
 	gtk_widget_show (main_menu);
 
+	if (e_shell_get_small_screen_mode (shell_window->priv->shell)) {
+		GtkWidget *parent, *child;
+
+		parent = gtk_widget_get_parent (main_menu);
+		g_object_ref (parent);
+		gtk_container_remove ((GtkContainer *)parent, main_menu);
+		child = gtk_hbox_new (FALSE, 0);
+		gtk_box_pack_start ((GtkBox *)child, main_menu, TRUE, TRUE, 0);
+		gtk_widget_show (child);
+		gtk_container_add ((GtkContainer *)parent, child);
+		shell_window->priv->menubar_box = child;
+		
+		e_mutual_binding_new (main_menu, "visible",
+				child, "visible");
+		main_menu = child;
+	}
+
 	g_signal_connect (
 		shell_window, "notify::active-view",
 		G_CALLBACK (shell_window_menubar_update_new_menu), NULL);
@@ -351,6 +368,12 @@ shell_window_construct_menubar (EShellWindow *shell_window)
 	return main_menu;
 }
 
+GtkWidget *
+e_shell_window_get_menu_bar_box (EShellWindow *shell_window)
+{
+	return shell_window->priv->menubar_box;
+}
+
 static GtkWidget *
 shell_window_construct_toolbar (EShellWindow *shell_window)
 {
@@ -411,6 +434,13 @@ shell_window_construct_toolbar (EShellWindow *shell_window)
 	if (e_shell_get_meego_mode (shell_window->priv->shell))
 		 gtk_widget_set_name (GTK_WIDGET (toolbar), "MeeGoToolbar");
 
+	toolbar = e_shell_window_get_managed_widget (
+		shell_window, "/close-toolbar");
+	gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
+	gtk_box_pack_start (GTK_BOX (box), toolbar, FALSE, FALSE, 0);
+	if (e_shell_get_meego_mode (shell_window->priv->shell))
+		 gtk_widget_set_name (GTK_WIDGET (toolbar), "MeeGoToolbar");
+	
 	return box;
 }
 
diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h
index 58401b2..9baa3cf 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -146,6 +146,7 @@ void		e_shell_window_register_new_source_actions
 						 const gchar *backend_name,
 						 GtkActionEntry *entries,
 						 guint n_entries);
+GtkWidget *	e_shell_window_get_menu_bar_box (EShellWindow *shell_window);
 
 G_END_DECLS
 
diff --git a/ui/evolution-calendars.ui b/ui/evolution-calendars.ui
index cbffb86..8bd41d4 100644
--- a/ui/evolution-calendars.ui
+++ b/ui/evolution-calendars.ui
@@ -59,7 +59,12 @@
     <separator/>
     <toolitem action='preferences'/>
 #endif
-
+  </toolbar>
+  <toolbar name='close-toolbar'>
+#if EXPRESS
+    <separator expand="true"/>
+    <toolitem action='quit-calendar'/>
+#endif
   </toolbar>
   <popup name='calendar-popup'>
     <menuitem action='calendar-new'/>
diff --git a/ui/evolution-shell.ui b/ui/evolution-shell.ui
index 5e249da..c161899 100644
--- a/ui/evolution-shell.ui
+++ b/ui/evolution-shell.ui
@@ -94,4 +94,6 @@
     <placeholder name='toolbar-actions'/>
   </toolbar>
   <toolbar name='search-toolbar'/>
+  <toolbar name='close-toolbar'/>
+
 </ui>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]