Add a string to CompEditorPrivate to store the name of the help section we

2005-02-04  Rodney Dawes  <dobey@novell.com>

	* gui/dialogs/comp-editor.[ch]: Add a string to CompEditorPrivate to
	store the name of the help section we need to refer for derived dialogs
	(response_cb): Handle the GTK_RESPONSE_HELP response and show help
	(setup_widgets): Add a button to the dialog for Help
	(comp_editor_init): Default to the "usage-calendar" help section
	(comp_editor_finalize): Free the help_section variable
	(comp_editor_show_help): Add a new method to actually open the help
	(comp_editor_set_help_section): Add a method for derivatives to set the
	help section they want to open

	* gui/dialogs/event-editor.c (event_editor_init): Set the help section
	we want to open for the event editor to "usage-calendar-apts"

	* gui/dialogs/task-editor.c (task_editor_init): Set the help section
	we want to open for the event editor to "usage-calendar-todo"

svn path=/trunk/; revision=28710
This commit is contained in:
Rodney Dawes
2005-02-04 15:49:15 +00:00
committed by Rodney Dawes
parent cd399f7a40
commit afbb1fd44d
5 changed files with 62 additions and 0 deletions

View File

@ -1,3 +1,21 @@
2005-02-04 Rodney Dawes <dobey@novell.com>
* gui/dialogs/comp-editor.[ch]: Add a string to CompEditorPrivate to
store the name of the help section we need to refer for derived dialogs
(response_cb): Handle the GTK_RESPONSE_HELP response and show help
(setup_widgets): Add a button to the dialog for Help
(comp_editor_init): Default to the "usage-calendar" help section
(comp_editor_finalize): Free the help_section variable
(comp_editor_show_help): Add a new method to actually open the help
(comp_editor_set_help_section): Add a method for derivatives to set the
help section they want to open
* gui/dialogs/event-editor.c (event_editor_init): Set the help section
we want to open for the event editor to "usage-calendar-apts"
* gui/dialogs/task-editor.c (task_editor_init): Set the help section
we want to open for the event editor to "usage-calendar-todo"
2005-02-04 Rodrigo Moya <rodrigo@novell.com>
* gui/e-tasks.c (update_view): clear the component preview when we

View File

@ -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);
@ -393,6 +396,10 @@ response_cb (GtkWidget *widget, int response, gpointer data)
close_dialog (editor);
}
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)
@ -1064,6 +1092,17 @@ comp_editor_get_e_cal (CompEditor *editor)
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 */
static char *
make_title_from_comp (ECalComponent *comp, gboolean is_group_item)

View File

@ -81,6 +81,8 @@ void comp_editor_show_page (CompEditor *editor,
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);

View File

@ -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 *

View File

@ -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 *