[evolution/kill-bonobo] Changes for having a light version of calendar.



commit 46cc80aa8c6579a8badb79e719bd9aec29220e9f
Author: Srinivasa Ragavan <sragavan novell com>
Date:   Fri Aug 7 09:02:17 2009 +0530

    Changes for having a light version of calendar.

 calendar/gui/dialogs/comp-editor.c    |   75 ++++++++++++++++++++++++++++++---
 calendar/gui/dialogs/comp-editor.h    |    2 +
 calendar/gui/dialogs/event-page.c     |    7 +++
 calendar/gui/dialogs/event-page.glade |   23 ++++++++++-
 4 files changed, 100 insertions(+), 7 deletions(-)
---
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 100a161..0b9dfba 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -75,6 +75,8 @@
 
 #define d(x)
 
+static gboolean comp_lite = FALSE;
+
 /* Private part of the CompEditor structure */
 struct _CompEditorPrivate {
 
@@ -1606,6 +1608,7 @@ comp_editor_init (CompEditor *editor)
 	GtkAction *action;
 	GtkWidget *container;
 	GtkWidget *widget;
+	GtkWidget *scroll;
 	EShell *shell;
 	gint n_targets;
 	GError *error = NULL;
@@ -1628,7 +1631,9 @@ comp_editor_init (CompEditor *editor)
 	priv->is_group_item = FALSE;
 
 	priv->ui_manager = gtk_ui_manager_new ();
-
+	
+	if (comp_lite)
+		gtk_window_set_default_size ((GtkWindow *) editor, 800, 450);
 	gtk_window_add_accel_group (
 		GTK_WINDOW (editor),
 		gtk_ui_manager_get_accel_group (priv->ui_manager));
@@ -1702,9 +1707,11 @@ comp_editor_init (CompEditor *editor)
 	gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
 	gtk_widget_show (widget);
 
-	widget = comp_editor_get_managed_widget (editor, "/main-toolbar");
-	gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
-	gtk_widget_show (widget);
+	if (!comp_lite) {
+		widget = comp_editor_get_managed_widget (editor, "/main-toolbar");
+		gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+		gtk_widget_show (widget);
+	}
 
 	widget = e_attachment_paned_new ();
 	gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
@@ -1712,15 +1719,60 @@ comp_editor_init (CompEditor *editor)
 	priv->attachment_view = g_object_ref (widget);
 	gtk_widget_show (widget);
 
+	if (comp_lite) {
+		GtkWidget *tmp, *tmp1, *tmp_box, *cont;
+		GtkWidget *combo;
+	
+		e_attachment_paned_set_expanded (E_ATTACHMENT_PANED (widget), TRUE);
+		e_attachment_paned_set_expanded (E_ATTACHMENT_PANED (widget), FALSE);
+
+		combo = e_attachment_paned_get_view_combo (
+			E_ATTACHMENT_PANED (widget));
+		gtk_widget_hide (combo);
+		cont = e_attachment_paned_get_controls_container (
+			E_ATTACHMENT_PANED (widget));
+
+		tmp_box = gtk_hbox_new (FALSE, 0);
+		tmp = gtk_hbox_new (FALSE, 0);
+		tmp1 = gtk_image_new_from_stock (GTK_STOCK_SAVE, GTK_ICON_SIZE_BUTTON);
+		gtk_box_pack_start ((GtkBox *)tmp, tmp1, FALSE, FALSE, 0);
+		tmp1 = gtk_label_new_with_mnemonic (_("Save"));
+		gtk_box_pack_start ((GtkBox *)tmp, tmp1, FALSE, FALSE, 3);
+		gtk_widget_show_all(tmp);
+		
+		combo = gtk_ui_manager_get_widget (priv->ui_manager, "/main-toolbar/save");
+		gtk_widget_reparent (combo, tmp_box);
+		gtk_box_set_child_packing ((GtkBox *)tmp_box, combo, FALSE, FALSE, 6, GTK_PACK_END);
+		gtk_tool_item_set_is_important (GTK_TOOL_ITEM (combo), TRUE);
+		combo = gtk_bin_get_child ((GtkBin *)combo);
+		gtk_container_remove((GtkContainer *)combo, gtk_bin_get_child ((GtkBin *)combo));
+		gtk_container_add((GtkContainer *)combo, tmp);
+		gtk_button_set_relief ((GtkButton *)combo, GTK_RELIEF_NORMAL);		
+
+		gtk_widget_show(tmp_box);
+		gtk_box_pack_end (GTK_BOX (cont), tmp_box, FALSE, FALSE, 4);
+		
+	}
 	container = e_attachment_paned_get_content_area (
 		E_ATTACHMENT_PANED (priv->attachment_view));
 
+	if (comp_lite) {
+		scroll = gtk_scrolled_window_new (NULL, NULL);
+		gtk_scrolled_window_set_policy ((GtkScrolledWindow *)scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+		gtk_widget_show(scroll);
+		gtk_box_pack_start (GTK_BOX (container), scroll, TRUE, TRUE, 0);
+	}
+
 	widget = gtk_notebook_new ();
 	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
-	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+	if (!comp_lite)
+		gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+	else
+		gtk_scrolled_window_add_with_viewport ((GtkScrolledWindow *) scroll, widget);
 	priv->notebook = GTK_NOTEBOOK (widget);
 	gtk_widget_show (widget);
-
+	if (comp_lite)
+		gtk_widget_set_size_request (scroll, 300, -1);
 	comp_editor_setup_recent_menu (editor);
 
 	/* Drag-and-Drop Support */
@@ -2944,3 +2996,14 @@ obj_removed_cb (ECal *client,
 		close_dialog (editor);
 }
 
+gboolean
+comp_editor_get_lite ()
+{
+	return comp_lite;
+}
+
+void
+comp_editor_set_lite (gboolean status)
+{
+	comp_lite = status;
+}
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 0edb2cc..157343b 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -156,6 +156,8 @@ GtkWidget *	comp_editor_get_managed_widget	(CompEditor *editor,
 						 const gchar *widget_path);
 CompEditor *	comp_editor_find_instance	(const gchar *uid);
 
+void		comp_editor_set_lite 		(gboolean status);
+gboolean	comp_editor_get_lite		(void);
 G_END_DECLS
 
 #endif
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index c48fe3c..4b09622 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -161,6 +161,7 @@ struct _EventPagePrivate {
 	GtkWidget *remove;
 	GtkWidget *edit;
 	GtkWidget *invite;
+	GtkWidget *invite_label;
 	GtkWidget *attendees_label;
 
 	/* ListView stuff */
@@ -2259,6 +2260,12 @@ get_widgets (EventPage *epage)
 	priv->info_string = GW ("generic-info-msgs");
 
 	priv->invite = GW ("invite");
+	priv->invite_label = GW ("invite-label");
+	if (comp_editor_get_lite ())
+		gtk_widget_hide (priv->invite);
+	else
+		gtk_widget_hide (priv->invite_label);
+			
 	priv->add = GW ("add-attendee");
 	priv->remove = GW ("remove-attendee");
 	priv->edit = GW ("edit-attendee");
diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade
index 7a57f6b..f1bb4e1 100644
--- a/calendar/gui/dialogs/event-page.glade
+++ b/calendar/gui/dialogs/event-page.glade
@@ -898,7 +898,28 @@ b</property>
 		  </child>
 
 		  <child>
-		    <placeholder/>
+		    <widget class="GtkLabel" id="invite-label">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Attendees</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
 		  </child>
 		</widget>
 		<packing>



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