Re: [evolution-patches] Patch for bug #12389



New small patch that doesn't use the virtual method, but does all the
hard work in comp-editor.c only.

-- dobey

On Thu, 2005-02-03 at 13:53 -0500, Rodney Dawes wrote:
> This patch adds a Help button to the Event/Task editor dialogs, and
> opens the appropriate help section for the editor in which it was
> clicked.
> 
> -- dobey
> 
? calendar/gui/apps_evolution_calendar-2.0.schemas
Index: calendar/gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.118
diff -u -p -r1.118 comp-editor.c
--- calendar/gui/dialogs/comp-editor.c	1 Feb 2005 17:30:49 -0000	1.118
+++ calendar/gui/dialogs/comp-editor.c	3 Feb 2005 19:45:08 -0000
@@ -96,12 +96,15 @@ struct _CompEditorPrivate {
 	gboolean is_group_item;
 	
  	gboolean warned;
+
+        char *help_section;
 };
 
 
 
 static gint comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e);
 static void comp_editor_finalize (GObject *object);
+static void comp_editor_show_help (CompEditor *editor);
 
 static void real_set_e_cal (CompEditor *editor, ECal *client);
 static void real_edit_comp (CompEditor *editor, ECalComponent *comp);
@@ -394,6 +397,10 @@ response_cb (GtkWidget *widget, int resp
 		}
 
 		break;
+	case GTK_RESPONSE_HELP:
+		comp_editor_show_help (editor);
+
+		break;
 	case GTK_RESPONSE_CANCEL:
 		commit_all_fields (editor);
 		
@@ -518,6 +525,7 @@ setup_widgets (CompEditor *editor)
 	/* Buttons */
 	gtk_dialog_add_button  (GTK_DIALOG (editor), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
 	gtk_dialog_add_button  (GTK_DIALOG (editor), GTK_STOCK_OK, GTK_RESPONSE_OK);
+	gtk_dialog_add_button  (GTK_DIALOG (editor), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
 	gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), GTK_RESPONSE_OK, FALSE);
 
 	g_signal_connect (editor, "response", G_CALLBACK (response_cb), editor);
@@ -596,6 +604,7 @@ comp_editor_init (CompEditor *editor)
  	priv->user_org = FALSE;
  	priv->warned = FALSE;
 	priv->is_group_item = FALSE;
+	priv->help_section = g_strdup ("usage-calendar");
 
 	gtk_window_set_type_hint (GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL);
 	gtk_dialog_set_has_separator (GTK_DIALOG (editor), FALSE);
@@ -634,6 +643,8 @@ comp_editor_finalize (GObject *object)
 	editor = COMP_EDITOR (object);
 	priv = editor->priv;
 
+	g_free (priv->help_section);
+
 	if (priv->client) {
 		g_object_unref (priv->client);
 		priv->client = NULL;
@@ -672,6 +683,23 @@ comp_editor_finalize (GObject *object)
 		(* G_OBJECT_CLASS (comp_editor_parent_class)->finalize) (object);
 }
 
+static void
+comp_editor_show_help (CompEditor *editor)
+{
+	GError *error = NULL;
+	CompEditorPrivate *priv;
+
+	priv = editor->priv;
+
+	gnome_help_display_desktop (NULL,
+				    "evolution-" BASE_VERSION,
+				    "evolution-" BASE_VERSION ".xml",
+				    priv->help_section,
+				    &error);
+	if (error != NULL)
+		g_warning ("%s", error->message);
+}
+
 
 static void
 delete_comp (CompEditor *editor)
@@ -1062,6 +1090,17 @@ comp_editor_get_e_cal (CompEditor *edito
 	priv = editor->priv;
 
 	return priv->client;
+}
+
+void
+comp_editor_set_help_section (CompEditor *editor, const char *section)
+{
+	CompEditorPrivate *priv;
+
+	priv = editor->priv;
+
+	g_free (priv->help_section);
+	priv->help_section = g_strdup (section);
 }
 
 /* Creates an appropriate title for the event editor dialog */
Index: calendar/gui/dialogs/comp-editor.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.h,v
retrieving revision 1.24
diff -u -p -r1.24 comp-editor.h
--- calendar/gui/dialogs/comp-editor.h	8 Jan 2005 10:53:52 -0000	1.24
+++ calendar/gui/dialogs/comp-editor.h	3 Feb 2005 19:45:08 -0000
@@ -81,6 +81,8 @@ void          comp_editor_show_page     
 					    CompEditorPage         *page);
 void          comp_editor_set_e_cal        (CompEditor             *editor,
 					    ECal              *client);
+void          comp_editor_set_help_section (CompEditor             *editor,
+					    const char             *section);
 ECal         *comp_editor_get_e_cal        (CompEditor             *editor);
 void          comp_editor_edit_comp        (CompEditor             *ee,
 					    ECalComponent           *comp);
Index: calendar/gui/dialogs/event-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-editor.c,v
retrieving revision 1.55
diff -u -p -r1.55 event-editor.c
--- calendar/gui/dialogs/event-editor.c	8 Jan 2005 10:53:52 -0000	1.55
+++ calendar/gui/dialogs/event-editor.c	3 Feb 2005 19:45:08 -0000
@@ -121,6 +121,8 @@ event_editor_init (EventEditor *ee)
 	priv->meeting_shown = TRUE;
 	priv->updating = FALSE;	
 	priv->is_meeting = FALSE;
+
+	comp_editor_set_help_section (COMP_EDITOR (ee), "usage-calendar-apts");
 }
 
 EventEditor *
Index: calendar/gui/dialogs/task-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/task-editor.c,v
retrieving revision 1.78
diff -u -p -r1.78 task-editor.c
--- calendar/gui/dialogs/task-editor.c	8 Jan 2005 10:53:52 -0000	1.78
+++ calendar/gui/dialogs/task-editor.c	3 Feb 2005 19:45:08 -0000
@@ -118,6 +118,7 @@ task_editor_init (TaskEditor *te)
 	priv->updating = FALSE;	
 	priv->is_assigned = FALSE;
 
+	comp_editor_set_help_section (COMP_EDITOR (te), "usage-calendar-todo");
 }
 
 TaskEditor *


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