[evolution-patches] Fix for calendar/gui/dialogs/* [Memo-Editor]



The patch includes following files
*memo-editor.c
*memo-page.c
*memo-page.glade
*comp-editor.c
*event-editor.c
*save-comp.c

regarding
-Memo - UI fix
-categories - gconf entry in memo editor
-classification gconf enry in memo-editor, task editor, event-editor,
-displaying save/close prompt when memo editor is closed with out saving
-removed an extra separator near attach toolitem in memo-editor tool-bar
-and added a new file evolution/ui/evolution-memo-editor.xml for displaying menus in memo-editor

with regards.,
Rajeev


Do you Yahoo!?
With a free 1 GB, there's more in store with Yahoo! Mail.
Index: calendar.error.xml
===================================================================
RCS file: /cvs/gnome/evolution/calendar/calendar.error.xml,v
retrieving revision 1.14
diff -u -p -r1.14 calendar.error.xml
--- calendar.error.xml	13 Jan 2006 07:34:13 -0000	1.14
+++ calendar.error.xml	25 Jan 2006 09:17:58 -0000
@@ -123,6 +123,15 @@
  <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
  <button _label="_Save Changes" response="GTK_RESPONSE_YES"/>
  </error>
+
+ <error id="prompt-save-memo" type="warning" default="GTK_RESPONSE_YES">
+ <title>Save Memo</title>
+ <_primary>Would you like to save your changes to this memo?</_primary>
+ <_secondary>You have made changes to this memo, but not yet saved them.</_secondary>
+ <button _label="_Discard Changes" response="GTK_RESPONSE_NO"/>
+ <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
+ <button _label="_Save Changes" response="GTK_RESPONSE_YES"/>
+ </error>
 	      
  <error id="prompt-meeting-invite" type="question" default="GTK_RESPONSE_YES">
   <_primary>Would you like to send meeting invitations to participants?</_primary>
<Root>
	<commands>
		<cmd name="ViewCategories" _label="_Categories"
		_tip="Toggles whether to display categories"
		type="toggle" state="0"/>

    		<cmd name="ActionClassPublic" _label="Pu_blic" 
      		type="radio" group="class" _tip="Classify as public"/>

 	 	<cmd name="ActionClassPrivate" _label="_Private" 
      		type="radio" group="class" _tip="Classify as Private"/>

    		<cmd name="ActionClassConfidential" _label="_Confidential" 
		type="radio" group="class" _tip="Classify as Confidential"/>
		
	</commands>

  <menu>
    <submenu name="View">
	<menuitem name="ViewCategories" verb=""/>	
    </submenu>
    
    <submenu name="Options">
	    <submenu name="Classification" _label="_Classification">
		    <menuitem name="ActionClassPublic" id="ActionClassPublic" verb=""/>
		    <menuitem name="ActionClassPrivate" id="ActionClassPrivate" verb=""/>
		    <menuitem name="ActionClassConfidential" id="ActionClassConfidential" verb=""/>
	    </submenu>
    </submenu>
  </menu>

</Root>
Index: gui/dialogs/memo-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/memo-editor.c,v
retrieving revision 1.2
diff -u -p -r1.2 memo-editor.c
--- gui/dialogs/memo-editor.c	14 Nov 2005 18:18:17 -0000	1.2
+++ gui/dialogs/memo-editor.c	25 Jan 2006 11:32:43 -0000
@@ -32,8 +32,11 @@
 #include <glade/glade.h>
 #include <libgnome/gnome-i18n.h>
 
+#include <evolution-shell-component-utils.h>
+
 #include "memo-page.h"
 #include "cancel-comp.h"
+#include "../calendar-config.h"
 #include "memo-editor.h"
 
 struct _MemoEditorPrivate {
@@ -98,31 +101,126 @@ client_changed_cb (CompEditorPage *page,
 /*	set_menu_sens (MEMO_EDITOR (user_data)); */
 }
 
+static void
+menu_show_categories_cb (BonoboUIComponent           *component,
+		       const char                  *path,
+		       Bonobo_UIComponent_EventType type,
+		       const char                  *state,
+		       gpointer                     user_data)
+{
+	MemoEditor *me = (MemoEditor *) user_data;
+	
+	if (type != Bonobo_UIComponent_STATE_CHANGED)
+		return;
+
+	memo_page_set_show_categories (me->priv->memo_page, atoi(state));	
+	calendar_config_set_show_categories (atoi(state));
+}
+
+static void
+menu_class_public_cb (BonoboUIComponent           *ui_component,
+		     const char                  *path,
+		     Bonobo_UIComponent_EventType type,
+		     const char                  *state,
+		     gpointer			  user_data)
+{
+	MemoEditor *me = (MemoEditor *) user_data;
+
+	if (state[0] == '0')
+		return;
+	printf("Setting to public\n");
+	comp_editor_page_notify_changed (COMP_EDITOR_PAGE (me->priv->memo_page));
+	memo_page_set_classification (me->priv->memo_page, E_CAL_COMPONENT_CLASS_PUBLIC);
+}
+
+static void
+menu_class_private_cb (BonoboUIComponent           *ui_component,
+		      const char                  *path,
+		      Bonobo_UIComponent_EventType type,
+		      const char                  *state,
+		      gpointer			  user_data)
+{
+	MemoEditor *me = (MemoEditor *) user_data;
+	if (state[0] == '0')
+		return;
+	
+	printf("Setting to private\n");
+	comp_editor_page_notify_changed (COMP_EDITOR_PAGE (me->priv->memo_page));
+	memo_page_set_classification (me->priv->memo_page, E_CAL_COMPONENT_CLASS_PRIVATE);
+}
+
+static void
+menu_class_confidential_cb (BonoboUIComponent           *ui_component,
+		     	   const char                  *path,
+		     	   Bonobo_UIComponent_EventType type,
+		     	   const char                  *state,
+		     	   gpointer			user_data)
+{
+	MemoEditor *me = (MemoEditor *) user_data;
+	if (state[0] == '0')
+		return;
+
+	printf("Setting to confidential\n");
+	comp_editor_page_notify_changed (COMP_EDITOR_PAGE (me->priv->memo_page));
+	memo_page_set_classification (me->priv->memo_page, E_CAL_COMPONENT_CLASS_CONFIDENTIAL);
+}
+
 /* Object initialization function for the memo editor */
 static void
-memo_editor_init (MemoEditor *te)
+memo_editor_init (MemoEditor *me)
 {
 	MemoEditorPrivate *priv;
-	
+	CompEditor *editor = COMP_EDITOR(me);
+	gboolean status;
+
 	priv = g_new0 (MemoEditorPrivate, 1);
-	te->priv = priv;
+	me->priv = priv;
 
 	priv->updating = FALSE;	
 
+	bonobo_ui_component_freeze (editor->uic, NULL);
+
+	bonobo_ui_util_set_ui (editor->uic, PREFIX,
+			        EVOLUTION_UIDIR "/evolution-memo-editor.xml",
+			       "evolution-memo-editor", NULL);
+
+	status = calendar_config_get_show_categories ();
+	bonobo_ui_component_set_prop (
+		editor->uic, "/commands/ViewCategories",
+		"state", status ? "1" : "0", NULL);
+	bonobo_ui_component_add_listener (
+		editor->uic, "ViewCategories",
+		menu_show_categories_cb, editor);
+
+	bonobo_ui_component_set_prop (
+		editor->uic, "/commands/ActionClassPublic",
+		"state", "1", NULL);
+	bonobo_ui_component_add_listener (
+		editor->uic, "ActionClassPublic",
+		menu_class_public_cb, editor);
+	bonobo_ui_component_add_listener (
+		editor->uic, "ActionClassPrivate",
+		menu_class_private_cb, editor);
+	bonobo_ui_component_add_listener (
+		editor->uic, "ActionClassConfidential",
+		menu_class_confidential_cb, editor);
+
+	bonobo_ui_component_thaw (editor->uic, NULL);	
+
 	/* TODO add help stuff */
-/*	comp_editor_set_help_section (COMP_EDITOR (te), "usage-calendar-memo"); */
+/*	comp_editor_set_help_section (COMP_EDITOR (me), "usage-calendar-memo"); */
 }
 
 MemoEditor *
 memo_editor_construct (MemoEditor *me, ECal *client)
 {
 	MemoEditorPrivate *priv;
-	
+	CompEditor *editor = COMP_EDITOR (me);
 	gboolean read_only = FALSE;
 	
 	priv = me->priv;
 
-	priv->memo_page = memo_page_new ();
+	priv->memo_page = memo_page_new (editor->uic);
 	g_object_ref (priv->memo_page);
 	gtk_object_sink (GTK_OBJECT (priv->memo_page));
 	comp_editor_append_page (COMP_EDITOR (me), 
@@ -133,7 +231,8 @@ memo_editor_construct (MemoEditor *me, E
 
 	if (!e_cal_is_read_only (client, &read_only, NULL))
 		read_only = TRUE;
-
+	
+	bonobo_ui_component_set_prop (editor->uic, "/Toolbar/ecal3", "hidden", "1", NULL);
 	comp_editor_set_e_cal (COMP_EDITOR (me), client);
 
 	init_widgets (me);
@@ -144,11 +243,11 @@ memo_editor_construct (MemoEditor *me, E
 static void
 memo_editor_set_e_cal (CompEditor *editor, ECal *client)
 {
-	MemoEditor *te;
+	MemoEditor *me;
 	MemoEditorPrivate *priv;
 
-	te = MEMO_EDITOR (editor);
-	priv = te->priv;
+	me = MEMO_EDITOR (editor);
+	priv = me->priv;
 
 	if (COMP_EDITOR_CLASS (memo_editor_parent_class)->set_e_cal)
 		COMP_EDITOR_CLASS (memo_editor_parent_class)->set_e_cal (editor, client);
@@ -196,6 +295,7 @@ memo_editor_finalize (GObject *object)
 {
 	MemoEditor *me;
 	MemoEditorPrivate *priv;
+	ECalComponent *comp;
 
 	g_return_if_fail (object != NULL);
 	g_return_if_fail (IS_MEMO_EDITOR (object));
Index: gui/dialogs/event-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-editor.c,v
retrieving revision 1.76
diff -u -p -r1.76 event-editor.c
--- gui/dialogs/event-editor.c	23 Jan 2006 08:09:45 -0000	1.76
+++ gui/dialogs/event-editor.c	25 Jan 2006 11:33:39 -0000
@@ -244,12 +244,14 @@ menu_class_public_cb (BonoboUIComponent 
 		     const char                  *path,
 		     Bonobo_UIComponent_EventType type,
 		     const char                  *state,
-		     gpointer			  user_data)
+		     gpointer			 user_data)
 {
 	EventEditor *ee = (EventEditor *) user_data;
-
 	if (state[0] == '0')
 		return;
+
+	comp_editor_page_notify_changed (COMP_EDITOR_PAGE (ee->priv->event_page));
+	
 	event_page_set_classification (ee->priv->event_page, E_CAL_COMPONENT_CLASS_PUBLIC);
 }
 
@@ -258,12 +260,14 @@ menu_class_private_cb (BonoboUIComponent
 		      const char                  *path,
 		      Bonobo_UIComponent_EventType type,
 		      const char                  *state,
-		      gpointer			  user_data)
+		      gpointer			   user_data)
 {
 	EventEditor *ee = (EventEditor *) user_data;
 	if (state[0] == '0')
 		return;
 	
+	comp_editor_page_notify_changed (COMP_EDITOR_PAGE (ee->priv->event_page));
+
 	event_page_set_classification (ee->priv->event_page, E_CAL_COMPONENT_CLASS_PRIVATE);
 }
 
@@ -277,7 +281,9 @@ menu_class_confidential_cb (BonoboUIComp
 	EventEditor *ee = (EventEditor *) user_data;
 	if (state[0] == '0')
 		return;
-	
+
+	comp_editor_page_notify_changed (COMP_EDITOR_PAGE (ee->priv->event_page));
+
 	event_page_set_classification (ee->priv->event_page, E_CAL_COMPONENT_CLASS_CONFIDENTIAL);
 }
 
@@ -541,7 +547,6 @@ event_editor_construct (EventEditor *ee,
 				 _("Appoint_ment"), TRUE);
 	g_signal_connect (G_OBJECT (priv->event_page), "client_changed",
 			  G_CALLBACK (client_changed_cb), ee);
-
 	priv->recur_window = gtk_dialog_new_with_buttons (_("Recurrence"),
 							  (GtkWindow *) ee, GTK_DIALOG_MODAL,
 							  "gtk-close", GTK_RESPONSE_CLOSE,
Index: gui/dialogs/task-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/task-editor.c,v
retrieving revision 1.90
diff -u -p -r1.90 task-editor.c
--- gui/dialogs/task-editor.c	23 Jan 2006 08:09:45 -0000	1.90
+++ gui/dialogs/task-editor.c	25 Jan 2006 11:33:53 -0000
@@ -207,6 +207,7 @@ menu_class_public_cb (BonoboUIComponent 
 	if (state[0] == '0')
 		return;
 	printf("Setting to public\n");
+	comp_editor_page_notify_changed (COMP_EDITOR_PAGE (te->priv->task_page));
 	task_page_set_classification (te->priv->task_page, E_CAL_COMPONENT_CLASS_PUBLIC);
 }
 
@@ -222,6 +223,7 @@ menu_class_private_cb (BonoboUIComponent
 		return;
 	
 	printf("Setting to private\n");
+	comp_editor_page_notify_changed (COMP_EDITOR_PAGE (te->priv->task_page));
 	task_page_set_classification (te->priv->task_page, E_CAL_COMPONENT_CLASS_PRIVATE);
 }
 
@@ -237,6 +239,7 @@ menu_class_confidential_cb (BonoboUIComp
 		return;
 	
 	printf("Setting to confidential\n");
+	comp_editor_page_notify_changed (COMP_EDITOR_PAGE (te->priv->task_page));
 	task_page_set_classification (te->priv->task_page, E_CAL_COMPONENT_CLASS_CONFIDENTIAL);
 }
 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2957
diff -u -p -r1.2957 ChangeLog
--- ChangeLog	24 Jan 2006 04:56:49 -0000	1.2957
+++ ChangeLog	25 Jan 2006 11:34:02 -0000
@@ -1,3 +1,10 @@
+2006-01-25  Rajeev ramanathan <rajeevramanathan_2004 yahoo co in>
+	** Fixes Bug #328150
+	
+	*calendar/gui/dialogs/memo-editor.c
+	*evolution-memo-editor.xml
+	Menus are added
+	
 2005-09-17  Jon Ander Hernandez <hernandez movimage com>
 	
 	** Fixes bug #313118
Index: gui/dialogs/save-comp.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/save-comp.c,v
retrieving revision 1.16
diff -u -p -r1.16 save-comp.c
--- gui/dialogs/save-comp.c	16 May 2005 06:13:14 -0000	1.16
+++ gui/dialogs/save-comp.c	25 Jan 2006 11:36:07 -0000
@@ -48,6 +48,8 @@ save_component_dialog (GtkWindow *parent
 			return e_error_run (parent, "calendar:prompt-save-appointment", NULL);
 		case E_CAL_COMPONENT_TODO:
 			return e_error_run (parent, "calendar:prompt-save-task", NULL);
+		case E_CAL_COMPONENT_JOURNAL:
+			return e_error_run (parent, "calendar:prompt-save-memo", NULL);
 		default:
 			return GTK_RESPONSE_NO;
 	}
Index: gui/dialogs/memo-page.glade
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/memo-page.glade,v
retrieving revision 1.1
diff -u -p -r1.1 memo-page.glade
--- gui/dialogs/memo-page.glade	19 Oct 2005 11:39:34 -0000	1.1
+++ gui/dialogs/memo-page.glade	27 Jan 2006 06:33:09 -0000
@@ -24,86 +24,19 @@
       <property name="spacing">6</property>
 
       <child>
-	<widget class="GtkLabel" id="label21">
-	  <property name="visible">True</property>
-	  <property name="label" translatable="yes">&lt;span weight=&quot;bold&quot;&gt;Basics&lt;/span&gt;</property>
-	  <property name="use_underline">False</property>
-	  <property name="use_markup">True</property>
-	  <property name="justify">GTK_JUSTIFY_LEFT</property>
-	  <property name="wrap">False</property>
-	  <property name="selectable">False</property>
-	  <property name="xalign">0</property>
-	  <property name="yalign">0.5</property>
-	  <property name="xpad">0</property>
-	  <property name="ypad">0</property>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
-	</packing>
-      </child>
-
-      <child>
 	<widget class="GtkHBox" id="hbox7">
 	  <property name="visible">True</property>
 	  <property name="homogeneous">False</property>
 	  <property name="spacing">0</property>
 
 	  <child>
-	    <widget class="GtkLabel" id="label22">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes"></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">12</property>
-	      <property name="ypad">0</property>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
 	    <widget class="GtkTable" id="table3">
 	      <property name="visible">True</property>
-	      <property name="n_rows">4</property>
+	      <property name="n_rows">3</property>
 	      <property name="n_columns">2</property>
 	      <property name="homogeneous">False</property>
 	      <property name="row_spacing">6</property>
 	      <property name="column_spacing">12</property>
-	      
-	      <child>
-		<widget class="GtkLabel" id="label100">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">Classi_fication:</property>
-		  <property name="use_underline">True</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="mnemonic_widget">classification</property>
-		</widget>
-		<packing>
-		  <property name="left_attach">0</property>
-		  <property name="right_attach">1</property>
-		  <property name="top_attach">1</property>
-		  <property name="bottom_attach">2</property>
-		  <property name="x_options">fill</property>
-		  <property name="y_options"></property>
-		</packing>
-	      </child>
 
 	      <child>
 		<widget class="GtkHBox" id="hbox10">
@@ -112,70 +45,6 @@
 		  <property name="spacing">0</property>
 
 		  <child>
-		    <widget class="GtkOptionMenu" id="classification">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="history">0</property>
-
-		      <child>
-			<widget class="GtkMenu" id="menu1">
-
-			  <child>
-			    <widget class="GtkMenuItem" id="public1">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">Public</property>
-			      <property name="use_underline">True</property>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkMenuItem" id="private1">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">Private</property>
-			      <property name="use_underline">True</property>
-			    </widget>
-			  </child>
-
-			  <child>
-			    <widget class="GtkMenuItem" id="confidential1">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">Confidential</property>
-			      <property name="use_underline">True</property>
-			    </widget>
-			  </child>
-			</widget>
-		      </child>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">True</property>
-		      <property name="fill">True</property>
-		    </packing>
-		  </child>
-
-		  <child>
-		    <widget class="GtkLabel" id="label23">
-		      <property name="visible">True</property>
-		      <property name="label" translatable="yes">_Group:</property>
-		      <property name="use_underline">True</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">12</property>
-		      <property name="ypad">0</property>
-		      <property name="mnemonic_widget">source</property>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
-
-		  <child>
 		    <widget class="Custom" id="source">
 		      <property name="visible">True</property>
 		      <property name="creation_function">memo_page_create_source_option_menu</property>
@@ -193,8 +62,8 @@
 		<packing>
 		  <property name="left_attach">1</property>
 		  <property name="right_attach">2</property>
-		  <property name="top_attach">1</property>
-		  <property name="bottom_attach">2</property>
+		  <property name="top_attach">0</property>
+		  <property name="bottom_attach">1</property>
 		  <property name="x_options">fill</property>
 		  <property name="y_options">fill</property>
 		</packing>
@@ -212,8 +81,8 @@
 		<packing>
 		  <property name="left_attach">0</property>
 		  <property name="right_attach">1</property>
-		  <property name="top_attach">2</property>
-		  <property name="bottom_attach">3</property>
+		  <property name="top_attach">1</property>
+		  <property name="bottom_attach">2</property>
 		  <property name="x_options">fill</property>
 		  <property name="y_options"></property>
 		</packing>
@@ -234,8 +103,8 @@
 		<packing>
 		  <property name="left_attach">1</property>
 		  <property name="right_attach">2</property>
-		  <property name="top_attach">2</property>
-		  <property name="bottom_attach">3</property>
+		  <property name="top_attach">1</property>
+		  <property name="bottom_attach">2</property>
 		  <property name="y_options"></property>
 		</packing>
 	      </child>
@@ -271,8 +140,8 @@
 		<packing>
 		  <property name="left_attach">1</property>
 		  <property name="right_attach">2</property>
-		  <property name="top_attach">3</property>
-		  <property name="bottom_attach">4</property>
+		  <property name="top_attach">2</property>
+		  <property name="bottom_attach">3</property>
 		  <property name="x_options">expand|shrink|fill</property>
 		  <property name="y_options">expand|shrink|fill</property>
 		</packing>
@@ -296,10 +165,40 @@
 		<packing>
 		  <property name="left_attach">0</property>
 		  <property name="right_attach">1</property>
-		  <property name="top_attach">3</property>
-		  <property name="bottom_attach">4</property>
+		  <property name="top_attach">2</property>
+		  <property name="bottom_attach">3</property>
 		  <property name="x_options">fill</property>
 		  <property name="y_options">fill</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label23">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">_Group:</property>
+		  <property name="use_underline">True</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">12</property>
+		  <property name="ypad">0</property>
+		  <property name="mnemonic_widget">source</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="left_attach">0</property>
+		  <property name="right_attach">1</property>
+		  <property name="top_attach">0</property>
+		  <property name="bottom_attach">1</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options"></property>
+
 		</packing>
 	      </child>
 	    </widget>
Index: gui/dialogs/memo-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/memo-page.c,v
retrieving revision 1.2
diff -u -p -r1.2 memo-page.c
--- gui/dialogs/memo-page.c	26 Nov 2005 02:31:52 -0000	1.2
+++ gui/dialogs/memo-page.c	27 Jan 2006 06:34:16 -0000
@@ -59,7 +59,10 @@ struct _MemoPagePrivate {
 
 	GtkWidget *memo_content;
 
-	GtkWidget *classification;
+/* Bonobo Controller for the menu/toolbar */
+	BonoboUIComponent *uic;
+
+	ECalComponentClassification classification;
 
 	GtkWidget *categories_btn;
 	GtkWidget *categories;
@@ -118,37 +121,39 @@ memo_page_class_init (MemoPageClass *kla
 
 /* Object initialization function for the memo page */
 static void
-memo_page_init (MemoPage *tpage)
+memo_page_init (MemoPage *mpage)
 {
 	MemoPagePrivate *priv;
 
 	priv = g_new0 (MemoPagePrivate, 1);
-	tpage->priv = priv;
+	mpage->priv = priv;
 
 	priv->xml = NULL;
 
 	priv->main = NULL;
 	priv->memo_content = NULL;
-	priv->classification = NULL;
+	priv->classification = E_CAL_COMPONENT_CLASS_NONE;
 	priv->categories_btn = NULL;
 	priv->categories = NULL;
 
 	priv->updating = FALSE;
+
 }
 
 /* Destroy handler for the memo page */
 static void
 memo_page_finalize (GObject *object)
 {
-	MemoPage *tpage;
+	MemoPage *mpage;
 	MemoPagePrivate *priv;
+	char *status;
 
 	g_return_if_fail (object != NULL);
 	g_return_if_fail (IS_MEMO_PAGE (object));
 
-	tpage = MEMO_PAGE (object);
-	priv = tpage->priv;
-
+	mpage = MEMO_PAGE (object);
+	priv = mpage->priv;
+	
 	if (priv->main)
 		gtk_widget_unref (priv->main);
 
@@ -158,23 +163,45 @@ memo_page_finalize (GObject *object)
 	}
 
 	g_free (priv);
-	tpage->priv = NULL;
+	mpage->priv = NULL;
 
 	if (G_OBJECT_CLASS (memo_page_parent_class)->finalize)
 		(* G_OBJECT_CLASS (memo_page_parent_class)->finalize) (object);
 }
 
-
+static void
+set_classification_menu (MemoPage *page, gint class)
+{
+	bonobo_ui_component_freeze (page->priv->uic, NULL);
+	switch (class) {
+		case E_CAL_COMPONENT_CLASS_PUBLIC:
+			bonobo_ui_component_set_prop (
+				page->priv->uic, "/commands/ActionClassPublic",
+				"state", "1", NULL);
+			break;
+		case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
+			bonobo_ui_component_set_prop (
+				page->priv->uic, "/commands/ActionClassConfidential",
+				"state", "1", NULL);
+			break;
+		case E_CAL_COMPONENT_CLASS_PRIVATE:
+			bonobo_ui_component_set_prop (
+				page->priv->uic, "/commands/ActionClassPrivate",
+				"state", "1", NULL);
+			break;
+	}
+	bonobo_ui_component_thaw (page->priv->uic, NULL);
+}
 
 /* get_widget handler for the task page */
 static GtkWidget *
 memo_page_get_widget (CompEditorPage *page)
 {
-	MemoPage *tpage;
+	MemoPage *mpage;
 	MemoPagePrivate *priv;
 
-	tpage = MEMO_PAGE (page);
-	priv = tpage->priv;
+	mpage = MEMO_PAGE (page);
+	priv = mpage->priv;
 
 	return priv->main;
 }
@@ -183,44 +210,44 @@ memo_page_get_widget (CompEditorPage *pa
 static void
 memo_page_focus_main_widget (CompEditorPage *page)
 {
-	MemoPage *tpage;
+	MemoPage *mpage;
 	MemoPagePrivate *priv;
 
-	tpage = MEMO_PAGE (page);
-	priv = tpage->priv;
+	mpage = MEMO_PAGE (page);
+	priv = mpage->priv;
 
 	gtk_widget_grab_focus (priv->memo_content);
 }
 
 /* Fills the widgets with default values */
 static void
-clear_widgets (MemoPage *tpage)
+clear_widgets (MemoPage *mpage)
 {
 	MemoPagePrivate *priv;
 
-	priv = tpage->priv;
+	priv = mpage->priv;
 
 	/* memo content */
 	gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content)), "", 0);
 
 	/* Classification */
-	e_dialog_option_menu_set (priv->classification, E_CAL_COMPONENT_CLASS_PRIVATE, classification_map);
+	priv->classification = E_CAL_COMPONENT_CLASS_PRIVATE;
+	set_classification_menu (mpage, priv->classification);
 
 	/* Categories */
 	e_dialog_editable_set (priv->categories, NULL);
 }
 
-/* Decode the radio button group for classifications */
-static ECalComponentClassification
-classification_get (GtkWidget *widget)
+void 
+memo_page_set_classification (MemoPage *page, ECalComponentClassification class)
 {
-	return e_dialog_option_menu_get (widget, classification_map);
+	page->priv->classification = class;
 }
 
 static void
 sensitize_widgets (MemoPage *mpage)
 {
-	gboolean read_only;
+	gboolean read_only, sens, sensitize;
 	MemoPagePrivate *priv;
 	
 	priv = mpage->priv;
@@ -228,30 +255,48 @@ sensitize_widgets (MemoPage *mpage)
 	if (!e_cal_is_read_only (COMP_EDITOR_PAGE (mpage)->client, &read_only, NULL))
 		read_only = TRUE;
 	
+	if (COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_IS_ASSIGNED)
+	 	sens = COMP_EDITOR_PAGE (mpage)->flags & COMP_EDITOR_PAGE_USER_ORG;
+
+	sensitize = (!read_only && sens);
+	
+	priv = mpage->priv;
+
+	if (!e_cal_is_read_only (COMP_EDITOR_PAGE (mpage)->client, &read_only, NULL))
+		read_only = TRUE;
+	
 	gtk_widget_set_sensitive (priv->memo_content, !read_only);
-	gtk_widget_set_sensitive (priv->classification, !read_only);
 	gtk_widget_set_sensitive (priv->categories_btn, !read_only);
 	gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only);
+
+	bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPublic", "sensitive", sensitize ? "1" : "0"
+			, NULL);
+	bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassPrivate", "sensitive", sensitize ? "1" : "0"
+			, NULL);
+	bonobo_ui_component_set_prop (priv->uic, "/commands/ActionClassConfidential", "sensitive",
+		       	sensitize ? "1" : "0", NULL);
+	bonobo_ui_component_set_prop (priv->uic, "/commands/ViewCategories", "sensitive", sensitize ? "1" : "0"
+			, NULL);
 }
 
 /* fill_widgets handler for the memo page */
 static gboolean
 memo_page_fill_widgets (CompEditorPage *page, ECalComponent *comp)
 {
-	MemoPage *tpage;
+	MemoPage *mpage;
 	MemoPagePrivate *priv;
 	ECalComponentClassification cl;
 	GSList *l;
 	const char *categories;
 	ESource *source;
 
-	tpage = MEMO_PAGE (page);
-	priv = tpage->priv;
+	mpage = MEMO_PAGE (page);
+	priv = mpage->priv;
 
 	priv->updating = TRUE;
 	
 	/* Clean the screen */
-	clear_widgets (tpage);
+	clear_widgets (mpage);
 
 	e_cal_component_get_description_list (comp, &l);
 	if (l && l->data) {
@@ -271,15 +316,26 @@ memo_page_fill_widgets (CompEditorPage *
 
 	switch (cl) {
 	case E_CAL_COMPONENT_CLASS_PUBLIC:
+		{
+			cl = E_CAL_COMPONENT_CLASS_PUBLIC;
+			break;
+		}
 	case E_CAL_COMPONENT_CLASS_PRIVATE:
+		{	
+			cl = E_CAL_COMPONENT_CLASS_PRIVATE;
+			break;
+		}
 	case E_CAL_COMPONENT_CLASS_CONFIDENTIAL:
-		break;
+		{
+			cl = E_CAL_COMPONENT_CLASS_CONFIDENTIAL;
+			break;
+		}
 	default:
 		/* default to PUBLIC */
 		cl = E_CAL_COMPONENT_CLASS_PUBLIC;
                 break;
 	}
-	e_dialog_option_menu_set (priv->classification, cl, classification_map);
+	set_classification_menu (mpage, cl);
 
 	/* Categories */
 	e_cal_component_get_categories (comp, &categories);
@@ -291,7 +347,7 @@ memo_page_fill_widgets (CompEditorPage *
 
 	priv->updating = FALSE;
 
-	sensitize_widgets (tpage);
+	sensitize_widgets (mpage);
 
 	return TRUE;
 }
@@ -300,15 +356,15 @@ memo_page_fill_widgets (CompEditorPage *
 static gboolean
 memo_page_fill_component (CompEditorPage *page, ECalComponent *comp)
 {
-	MemoPage *tpage;
+	MemoPage *mpage;
 	MemoPagePrivate *priv;
 	char *cat, *str;
 	int i;
 	GtkTextBuffer *text_buffer;
 	GtkTextIter text_iter_start, text_iter_end;
 
-	tpage = MEMO_PAGE (page);
-	priv = tpage->priv;
+	mpage = MEMO_PAGE (page);
+	priv = mpage->priv;
 	text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content));
 
 	/* Memo Content */
@@ -365,7 +421,7 @@ memo_page_fill_component (CompEditorPage
 		g_free (str);
 
 	/* Classification. */
-	e_cal_component_set_classification (comp, classification_get (priv->classification));
+	e_cal_component_set_classification (comp, priv->classification);
 
 	/* Categories */
 	cat = e_dialog_editable_get (priv->categories);
@@ -381,19 +437,28 @@ memo_page_fill_component (CompEditorPage
 	return TRUE;
 }
 
-
-
+void
+memo_page_set_show_categories (MemoPage *page, gboolean state)
+{
+	if (state) {
+		gtk_widget_show (page->priv->categories_btn);
+		gtk_widget_show (page->priv->categories);	
+	} else {
+		gtk_widget_hide (page->priv->categories_btn);
+		gtk_widget_hide (page->priv->categories);
+	}
+}
 
 /* Gets the widgets from the XML file and returns if they are all available. */
 static gboolean
-get_widgets (MemoPage *tpage)
+get_widgets (MemoPage *mpage)
 {
-	CompEditorPage *page = COMP_EDITOR_PAGE (tpage);
+	CompEditorPage *page = COMP_EDITOR_PAGE (mpage);
 	MemoPagePrivate *priv;
 	GSList *accel_groups;
 	GtkWidget *toplevel;
 
-	priv = tpage->priv;
+	priv = mpage->priv;
 
 #define GW(name) glade_xml_get_widget (priv->xml, name)
 
@@ -417,8 +482,6 @@ get_widgets (MemoPage *tpage)
 
 	priv->memo_content = GW ("memo_content");
 
-	priv->classification = GW ("classification");
-
 	priv->categories_btn = GW ("categories-button");
 	priv->categories = GW ("categories");
 
@@ -426,8 +489,7 @@ get_widgets (MemoPage *tpage)
 
 #undef GW
 
-	return (priv->classification
-		&& priv->memo_content
+	return (priv->memo_content
 		&& priv->categories_btn
 		&& priv->categories);
 }
@@ -438,12 +500,12 @@ get_widgets (MemoPage *tpage)
 static void
 categories_clicked_cb (GtkWidget *button, gpointer data)
 {
-	MemoPage *tpage;
+	MemoPage *mpage;
 	MemoPagePrivate *priv;
 	GtkWidget *entry;
 
-	tpage = MEMO_PAGE (data);
-	priv = tpage->priv;
+	mpage = MEMO_PAGE (data);
+	priv = mpage->priv;
 
 	entry = priv->categories;
 	e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry));
@@ -453,24 +515,24 @@ categories_clicked_cb (GtkWidget *button
 static void
 field_changed_cb (GtkWidget *widget, gpointer data)
 {
-	MemoPage *tpage;
+	MemoPage *mpage;
 	MemoPagePrivate *priv;
 	
-	tpage = MEMO_PAGE (data);
-	priv = tpage->priv;
+	mpage = MEMO_PAGE (data);
+	priv = mpage->priv;
 	
 	if (!priv->updating)
-		comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage));
+		comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage));
 }
 
 static void
 source_changed_cb (GtkWidget *widget, ESource *source, gpointer data)
 {
-	MemoPage *tpage;
+	MemoPage *mpage;
 	MemoPagePrivate *priv;
 
-	tpage = MEMO_PAGE (data);
-	priv = tpage->priv;
+	mpage = MEMO_PAGE (data);
+	priv = mpage->priv;
 
 	if (!priv->updating) {
 		ECal *client;
@@ -483,7 +545,7 @@ source_changed_cb (GtkWidget *widget, ES
 				g_object_unref (client);
 
 			e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source_selector),
-						     e_cal_get_source (COMP_EDITOR_PAGE (tpage)->client));
+						     e_cal_get_source (COMP_EDITOR_PAGE (mpage)->client));
 
 			dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
 							 GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
@@ -495,19 +557,19 @@ source_changed_cb (GtkWidget *widget, ES
 			comp_editor_notify_client_changed (
 				COMP_EDITOR (gtk_widget_get_toplevel (priv->main)),
 				client);
-			sensitize_widgets (tpage);
+			sensitize_widgets (mpage);
 		}
 	}
 }
 
 /* Hooks the widget signals */
 static gboolean
-init_widgets (MemoPage *tpage)
+init_widgets (MemoPage *mpage)
 {
 	MemoPagePrivate *priv;
 	GtkTextBuffer *text_buffer;
 
-	priv = tpage->priv;
+	priv = mpage->priv;
 
 	/* Memo Content */
 	text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content));
@@ -516,44 +578,44 @@ init_widgets (MemoPage *tpage)
 
 	/* Categories button */
 	g_signal_connect((priv->categories_btn), "clicked",
-			    G_CALLBACK (categories_clicked_cb), tpage);
+			    G_CALLBACK (categories_clicked_cb), mpage);
 
 	/* Source selector */
 	g_signal_connect((priv->source_selector), "source_selected",
-			 G_CALLBACK (source_changed_cb), tpage);
+			 G_CALLBACK (source_changed_cb), mpage);
 
 	/* Connect the default signal handler to use to make sure the "changed"
 	   field gets set whenever a field is changed. */
 
 	/* Belongs to priv->memo_content */
 	g_signal_connect ((text_buffer), "changed",
-			  G_CALLBACK (field_changed_cb), tpage);
+			  G_CALLBACK (field_changed_cb), mpage);
 
-	g_signal_connect((priv->classification), "changed",
-			    G_CALLBACK (field_changed_cb), tpage);
 	g_signal_connect((priv->categories), "changed",
-			    G_CALLBACK (field_changed_cb), tpage);
-	
+			    G_CALLBACK (field_changed_cb), mpage);
+
+	memo_page_set_show_categories (mpage, calendar_config_get_show_categories());
+
 	return TRUE;
 }
 
 
 /**
  * memo_page_construct:
- * @tpage: An memo page.
+ * @mpage: An memo page.
  * 
  * Constructs an memo page by loading its Glade data.
  * 
- * Return value: The same object as @tpage, or NULL if the widgets could not be
+ * Return value: The same object as @mpage, or NULL if the widgets could not be
  * created.
  **/
 MemoPage *
-memo_page_construct (MemoPage *tpage)
+memo_page_construct (MemoPage *mpage)
 {
 	MemoPagePrivate *priv;
 	char *gladefile;
 
-	priv = tpage->priv;
+	priv = mpage->priv;
 
 	gladefile = g_build_filename (EVOLUTION_GLADEDIR,
 				      "memo-page.glade",
@@ -567,19 +629,19 @@ memo_page_construct (MemoPage *tpage)
 		return NULL;
 	}
 
-	if (!get_widgets (tpage)) {
+	if (!get_widgets (mpage)) {
 		g_message ("memo_page_construct(): "
 			   "Could not find all widgets in the XML file!");
 		return NULL;
 	}
 
-	if (!init_widgets (tpage)) {
+	if (!init_widgets (mpage)) {
 		g_message ("memo_page_construct(): " 
 			   "Could not initialize the widgets!");
 		return NULL;
 	}
 
-	return tpage;
+	return mpage;
 }
 
 /**
@@ -591,17 +653,18 @@ memo_page_construct (MemoPage *tpage)
  * not be created.
  **/
 MemoPage *
-memo_page_new (void)
+memo_page_new (BonoboUIComponent *uic)
 {
-	MemoPage *tpage;
+	MemoPage *mpage;
 
-	tpage = gtk_type_new (TYPE_MEMO_PAGE);
-	if (!memo_page_construct (tpage)) {
-		g_object_unref (tpage);
+	mpage = gtk_type_new (TYPE_MEMO_PAGE);
+	mpage->priv->uic = uic;
+	if (!memo_page_construct (mpage)) {
+		g_object_unref (mpage);
 		return NULL;
 	}
 
-	return tpage;
+	return mpage;
 }
 
 GtkWidget *memo_page_create_source_option_menu (void);


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