From ad6fcfd6ba8385b646581203a962ee8911582ab7 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 7 Aug 2009 09:02:17 +0530 Subject: 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(-) (limited to 'calendar') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 6a97128bcf..10a5232d73 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 { /* Client to use */ @@ -1544,6 +1546,7 @@ comp_editor_init (CompEditor *editor) GtkAction *action; GtkWidget *container; GtkWidget *widget; + GtkWidget *scroll; gint n_targets; GError *error = NULL; @@ -1559,7 +1562,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)); @@ -1633,9 +1638,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); @@ -1643,15 +1650,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 */ @@ -2830,3 +2882,14 @@ obj_removed_cb (ECal *client, GList *uids, gpointer data) 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 21f9066ba3..258d11b257 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -151,6 +151,8 @@ GtkActionGroup * GtkWidget * comp_editor_get_managed_widget (CompEditor *editor, const gchar *widget_path); +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 7a595000a8..0975bb02ee 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 */ @@ -2251,6 +2252,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 7a57f6b716..f1bb4e15dc 100644 --- a/calendar/gui/dialogs/event-page.glade +++ b/calendar/gui/dialogs/event-page.glade @@ -898,7 +898,28 @@ b - + + True + Attendees + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + -- cgit v1.2.3