[evolution/express2: 12/51] Redo Calendar for express mode. Just design/layout changes.



commit 4cc6bd4673115dff52a403d31e9613deea402d0e
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Fri Mar 19 22:41:25 2010 +0530

    Redo Calendar for express mode. Just design/layout changes.

 modules/calendar/e-cal-shell-content.c      |   92 +++++++++++++++-----------
 modules/calendar/e-cal-shell-view-actions.c |   49 +++++++++++----
 modules/calendar/e-cal-shell-view-private.c |   56 +++++++++-------
 modules/calendar/e-cal-shell-view.c         |   30 +++++++++
 ui/evolution-calendars.ui                   |   14 ++++
 5 files changed, 165 insertions(+), 76 deletions(-)
---
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index f5cc016..6a3f8b6 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -314,8 +314,8 @@ cal_shell_content_constructed (GObject *object)
 {
 	ECalShellContentPrivate *priv;
 	ECalendarView *calendar_view;
-	ECalModel *memo_model;
-	ECalModel *task_model;
+	ECalModel *memo_model=NULL;
+	ECalModel *task_model=NULL;
 	EShell *shell;
 	EShellContent *shell_content;
 	EShellSettings *shell_settings;
@@ -346,40 +346,47 @@ cal_shell_content_constructed (GObject *object)
 
 	/* We borrow the memopad and taskpad models from the memo
 	 * and task views, loading the views if necessary. */
-
-	foreign_view = e_shell_window_get_shell_view (shell_window, "memos");
-	foreign_content = e_shell_view_get_shell_content (foreign_view);
-	g_object_get (foreign_content, "model", &memo_model, NULL);
-
-	foreign_view = e_shell_window_get_shell_view (shell_window, "tasks");
-	foreign_content = e_shell_view_get_shell_content (foreign_view);
-	g_object_get (foreign_content, "model", &task_model, NULL);
-
+	if(!e_shell_get_express_mode(e_shell_get_default())) {
+		foreign_view = e_shell_window_get_shell_view (shell_window, "memos");
+		foreign_content = e_shell_view_get_shell_content (foreign_view);
+		g_object_get (foreign_content, "model", &memo_model, NULL);
+	
+		foreign_view = e_shell_window_get_shell_view (shell_window, "tasks");
+		foreign_content = e_shell_view_get_shell_content (foreign_view);
+		g_object_get (foreign_content, "model", &task_model, NULL);
+	}
 	/* Build content widgets. */
 
 	container = GTK_WIDGET (object);
+	
+	if (!e_shell_get_express_mode(e_shell_get_default())) {
+		widget = e_paned_new (GTK_ORIENTATION_HORIZONTAL);
+		gtk_container_add (GTK_CONTAINER (container), widget);
+		priv->hpaned = g_object_ref (widget);
+		gtk_widget_show (widget);
 
-	widget = e_paned_new (GTK_ORIENTATION_HORIZONTAL);
-	gtk_container_add (GTK_CONTAINER (container), widget);
-	priv->hpaned = g_object_ref (widget);
-	gtk_widget_show (widget);
-
-	container = priv->hpaned;
+		container = priv->hpaned;
+	}
 
 	widget = gtk_notebook_new ();
 	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
 	gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
-	gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, FALSE);
+	if (!e_shell_get_express_mode(e_shell_get_default()))	
+		gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, FALSE);
+	else
+		gtk_container_add (GTK_CONTAINER (container), widget);
 	priv->notebook = g_object_ref (widget);
 	gtk_widget_show (widget);
 
-	/* FIXME Need to deal with saving and restoring the position.
-	 *       Month view has its own position. */
-	widget = e_paned_new (GTK_ORIENTATION_VERTICAL);
-	e_paned_set_fixed_resize (E_PANED (widget), FALSE);
-	gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, TRUE);
-	priv->vpaned = g_object_ref (widget);
-	gtk_widget_show (widget);
+	if (!e_shell_get_express_mode(e_shell_get_default())) {
+		/* FIXME Need to deal with saving and restoring the position.
+		 *       Month view has its own position. */
+		widget = e_paned_new (GTK_ORIENTATION_VERTICAL);
+		e_paned_set_fixed_resize (E_PANED (widget), FALSE);
+		gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, TRUE);
+		priv->vpaned = g_object_ref (widget);
+		gtk_widget_show (widget);
+	}
 
 	container = priv->notebook;
 
@@ -403,7 +410,7 @@ cal_shell_content_constructed (GObject *object)
 		priv->notebook, "page");
 
 	container = priv->vpaned;
-
+if(!e_shell_get_express_mode(e_shell_get_default())) {
 	widget = gtk_vbox_new (FALSE, 0);
 	gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, TRUE);
 	gtk_widget_show (widget);
@@ -484,7 +491,7 @@ cal_shell_content_constructed (GObject *object)
 		widget, "open-component",
 		G_CALLBACK (e_cal_shell_view_memopad_open_memo),
 		shell_view);
-
+}
 	/* Load the view instance. */
 
 	view_instance = e_shell_view_new_view_instance (shell_view, NULL);
@@ -496,21 +503,23 @@ cal_shell_content_constructed (GObject *object)
 	 *     The GtkWidget::map() callback below explains why. */
 	priv->view_instance = view_instance;
 
-	g_signal_connect_swapped (
-		shell_view, "notify::view-id",
-		G_CALLBACK (cal_shell_content_notify_view_id_cb),
-		object);
-
-	/* Bind GObject properties to GConf keys. */
+	if (!e_shell_get_express_mode(e_shell_get_default())) {	
+		g_signal_connect_swapped (
+			shell_view, "notify::view-id",
+			G_CALLBACK (cal_shell_content_notify_view_id_cb),
+			object);
 
-	bridge = gconf_bridge_get ();
+		bridge = gconf_bridge_get ();
 
-	object = G_OBJECT (priv->vpaned);
-	key = "/apps/evolution/calendar/display/tag_vpane_position";
-	gconf_bridge_bind_property_delayed (bridge, key, object, "proportion");
+		object = G_OBJECT (priv->vpaned);
+		key = "/apps/evolution/calendar/display/tag_vpane_position";
+		gconf_bridge_bind_property_delayed (bridge, key, object, "proportion");
+	}
 
-	g_object_unref (memo_model);
-	g_object_unref (task_model);
+	if (memo_model)
+		g_object_unref (memo_model);
+	if (task_model)
+		g_object_unref (task_model);
 }
 
 static void
@@ -536,6 +545,7 @@ cal_shell_content_class_init (ECalShellContentClass *class)
 {
 	GObjectClass *object_class;
 	GtkWidgetClass *widget_class;
+	EShellContentClass *shell_content_class;
 
 	parent_class = g_type_class_peek_parent (class);
 	g_type_class_add_private (class, sizeof (ECalShellContentPrivate));
@@ -545,6 +555,10 @@ cal_shell_content_class_init (ECalShellContentClass *class)
 	object_class->get_property = cal_shell_content_get_property;
 	object_class->dispose = cal_shell_content_dispose;
 	object_class->constructed = cal_shell_content_constructed;
+	
+	shell_content_class = E_SHELL_CONTENT_CLASS (class);
+	if(e_shell_get_express_mode(e_shell_get_default()))
+		shell_content_class->construct_searchbar = NULL;
 
 	widget_class = GTK_WIDGET_CLASS (class);
 	widget_class->map = cal_shell_content_map;
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 5eaa9a4..b5609aa 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -1197,6 +1197,21 @@ action_event_schedule_cb (GtkAction *action,
 }
 
 static void
+quit_calendar_cb (GtkAction *action,
+                          ECalShellView *cal_shell_view)
+{
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	EShell *shell;
+
+	shell_view = E_SHELL_VIEW (cal_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+	
+	shell = e_shell_window_get_shell (shell_window);
+	e_shell_quit (shell);
+}
+
+static void
 action_event_schedule_appointment_cb (GtkAction *action,
                           ECalShellView *cal_shell_view)
 {
@@ -1428,6 +1443,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",
@@ -1689,7 +1711,7 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view)
 
 	cal_shell_content = cal_shell_view->priv->cal_shell_content;
 	searchbar = e_cal_shell_content_get_searchbar (cal_shell_content);
-
+	
 	/* Calendar Actions */
 	action_group = ACTION_GROUP (CALENDAR);
 	gtk_action_group_add_actions (
@@ -1710,8 +1732,9 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view)
 	/* Advanced Search Action */
 	action = ACTION (CALENDAR_SEARCH_ADVANCED_HIDDEN);
 	gtk_action_set_visible (action, FALSE);
-	e_shell_searchbar_set_search_option (
-		searchbar, GTK_RADIO_ACTION (action));
+	if (searchbar)
+		e_shell_searchbar_set_search_option (
+			searchbar, GTK_RADIO_ACTION (action));
 
 	/* Lockdown Printing Actions */
 	action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
@@ -1833,18 +1856,20 @@ e_cal_shell_view_update_search_filter (ECalShellView *cal_shell_view)
 
 	cal_shell_content = cal_shell_view->priv->cal_shell_content;
 	searchbar = e_cal_shell_content_get_searchbar (cal_shell_content);
-	combo_box = e_shell_searchbar_get_filter_combo_box (searchbar);
+	if (searchbar) {
+		combo_box = e_shell_searchbar_get_filter_combo_box (searchbar);
 
-	e_shell_view_block_execute_search (shell_view);
+		e_shell_view_block_execute_search (shell_view);
 
-	/* Use any action in the group; doesn't matter which. */
-	e_action_combo_box_set_action (combo_box, radio_action);
+		/* Use any action in the group; doesn't matter which. */
+		e_action_combo_box_set_action (combo_box, radio_action);
 
-	ii = CALENDAR_FILTER_UNMATCHED;
-	e_action_combo_box_add_separator_after (combo_box, ii);
+		ii = CALENDAR_FILTER_UNMATCHED;
+		e_action_combo_box_add_separator_after (combo_box, ii);
 
-	ii = CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS;
-	e_action_combo_box_add_separator_after (combo_box, ii);
+		ii = CALENDAR_FILTER_NEXT_7_DAYS_APPOINTMENTS;
+		e_action_combo_box_add_separator_after (combo_box, ii);
 
-	e_shell_view_unblock_execute_search (shell_view);
+		e_shell_view_unblock_execute_search (shell_view);
+	}
 }
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index dc30897..1c9c268 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -535,35 +535,41 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view)
 		G_CALLBACK (cal_shell_view_selector_client_removed_cb),
 		cal_shell_view);
 
-	g_signal_connect_swapped (
-		memo_table, "popup-event",
-		G_CALLBACK (cal_shell_view_memopad_popup_event_cb),
-		cal_shell_view);
-
-	g_signal_connect_swapped (
-		memo_table, "selection-change",
-		G_CALLBACK (e_cal_shell_view_memopad_actions_update),
-		cal_shell_view);
+	if (memo_table) 
+		g_signal_connect_swapped (
+			memo_table, "popup-event",
+			G_CALLBACK (cal_shell_view_memopad_popup_event_cb),
+			cal_shell_view);
 
-	g_signal_connect_swapped (
-		memo_table, "status-message",
-		G_CALLBACK (e_cal_shell_view_memopad_set_status_message),
-		cal_shell_view);
+	if (memo_table)
+		g_signal_connect_swapped (
+			memo_table, "selection-change",
+			G_CALLBACK (e_cal_shell_view_memopad_actions_update),
+			cal_shell_view);
 
-	g_signal_connect_swapped (
-		task_table, "popup-event",
-		G_CALLBACK (cal_shell_view_taskpad_popup_event_cb),
-		cal_shell_view);
+	if (memo_table)
+		g_signal_connect_swapped (
+			memo_table, "status-message",
+			G_CALLBACK (e_cal_shell_view_memopad_set_status_message),
+			cal_shell_view);
 
-	g_signal_connect_swapped (
-		task_table, "status-message",
-		G_CALLBACK (e_cal_shell_view_taskpad_set_status_message),
-		cal_shell_view);
+	if (task_table)
+		g_signal_connect_swapped (
+			task_table, "popup-event",
+			G_CALLBACK (cal_shell_view_taskpad_popup_event_cb),
+			cal_shell_view);
 
-	g_signal_connect_swapped (
-		task_table, "selection-change",
-		G_CALLBACK (e_cal_shell_view_taskpad_actions_update),
-		cal_shell_view);
+	if (task_table)
+		g_signal_connect_swapped (
+			task_table, "status-message",
+			G_CALLBACK (e_cal_shell_view_taskpad_set_status_message),
+			cal_shell_view);
+	
+	if (task_table)
+		g_signal_connect_swapped (
+			task_table, "selection-change",
+			G_CALLBACK (e_cal_shell_view_taskpad_actions_update),
+			cal_shell_view);
 
 	e_categories_add_change_hook (
 		(GHookFunc) e_cal_shell_view_update_search_filter,
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index cd44f37..5df2806 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -303,6 +303,36 @@ cal_shell_view_update_actions (EShellView *shell_view)
 
 	shell_window = e_shell_view_get_shell_window (shell_view);
 
+	if(e_shell_get_express_mode(e_shell_get_default())) {
+		GtkWidget *widget, *item;
+		GdkScreen *scr;
+		gint monitor;
+		GdkRectangle rect;
+
+		/* Hack: Get rid of New and Send/Receive in toolbar 
+		 * while in express mode */
+		widget = e_shell_window_get_managed_widget (
+			shell_window, "/main-toolbar");
+
+		item = (GtkWidget *)gtk_toolbar_get_nth_item ((GtkToolbar *)widget, 0);
+		gtk_widget_hide(item);
+	
+		widget = e_shell_window_get_managed_widget (
+			shell_window, "/main-menu");
+		gtk_widget_hide(widget);
+		
+		item = e_shell_window_get_managed_widget (
+			shell_window, "/main-toolbar/send-receive");
+		gtk_widget_hide(item);	
+
+		scr = gdk_screen_get_default ();
+		monitor = gdk_screen_get_monitor_at_window (scr, GTK_WIDGET (shell_window)->window);
+		gdk_screen_get_monitor_geometry (scr, monitor, &rect);
+		
+		gtk_window_set_default_size ((GtkWindow *)shell_window, rect.width, rect.height);
+		gtk_window_set_decorated ((GtkWindow *)shell_window, FALSE);
+
+	}
 	cal_shell_content = priv->cal_shell_content;
 	calendar = e_cal_shell_content_get_calendar (cal_shell_content);
 	view_type = gnome_calendar_get_view (calendar);
diff --git a/ui/evolution-calendars.ui b/ui/evolution-calendars.ui
index feef83d..d3ef98a 100644
--- a/ui/evolution-calendars.ui
+++ b/ui/evolution-calendars.ui
@@ -28,20 +28,34 @@
     </placeholder>
   </menubar>
   <toolbar name='main-toolbar'>
+<!-- if !EXPRESS -->		  
     <toolitem action='calendar-print'/>
     <toolitem action='delete-selection'/>
     <separator/>
+<!-- endif -->    
     <toolitem action='calendar-go-back'/>
     <toolitem action='calendar-go-today'/>
     <toolitem action='calendar-go-forward'/>
+<!-- if !EXPRESS -->		      
     <separator/>
     <toolitem action='calendar-jump-to'/>
+<!-- endif -->        
     <separator/>
     <toolitem action='calendar-view-day'/>
     <toolitem action='calendar-view-workweek'/>
+<!-- if !EXPRESS -->		      
     <toolitem action='calendar-view-week'/>
+<!-- endif -->    
+
     <toolitem action='calendar-view-month'/>
+<!-- if !EXPRESS -->		      
     <toolitem action='calendar-view-list'/>
+<!-- endif -->    
+<!-- if EXPRESS -->
+    <separator expand="true"/>
+    <toolitem action='quit-calendar'/>
+<!-- endif -->    
+
   </toolbar>
   <popup name='calendar-popup'>
     <menuitem action='calendar-new'/>



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