aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog18
-rw-r--r--calendar/gui/calendar-commands.c4
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c37
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade2
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h11
-rw-r--r--calendar/gui/tasks-control.c21
6 files changed, 81 insertions, 12 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 313b4a6b62..f5e999af8d 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -75,6 +75,24 @@
* pcs/cal-backend-file.c (cal_backend_file_get_free_busy): implemented
+2001-07-28 Federico Mena Quintero <federico@ximian.com>
+
+ Fixes bug #5352.
+
+ * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_show): Added a
+ `page' argument so that we can select which page to show when
+ popping up the dialog.
+ (cal_prefs_dialog_construct): Added the `page' argument as well.
+ (cal_prefs_dialog_new): Likewise.
+
+ * gui/calendar-commands.c (settings_cmd): Set the page to the main
+ calendar settings one.
+
+ * gui/tasks-control.c (tasks_control_settings_cmd): Implemented
+ callback for the "Task Settings" command.
+ (verbs): Added the "TasksSettings" verb.
+ (pixmaps): Added an icon for the tasks settings command.
+
2001-07-27 JP Rosevear <jpr@ximian.com>
* conduits/calendar/calendar-conduit.c (local_record_from_comp):
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index f51a4142ca..8f4c9da265 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -266,9 +266,9 @@ static void
settings_cmd (BonoboUIComponent *uic, gpointer data, const char *path)
{
if (!preferences_dialog)
- preferences_dialog = cal_prefs_dialog_new ();
+ preferences_dialog = cal_prefs_dialog_new (CAL_PREFS_DIALOG_PAGE_CALENDAR);
else
- cal_prefs_dialog_show (preferences_dialog);
+ cal_prefs_dialog_show (preferences_dialog, CAL_PREFS_DIALOG_PAGE_CALENDAR);
}
static void
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index c05628797f..931ac12b73 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -47,6 +47,8 @@ struct _CalPrefsDialogPrivate {
GtkWidget *dialog;
+ GtkWidget *toplevel_notebook;
+
GtkWidget *timezone;
GtkWidget *working_days[7];
GtkWidget *week_start_day;
@@ -120,23 +122,26 @@ cal_prefs_dialog_init (CalPrefsDialog *prefs)
/**
* cal_prefs_dialog_new:
- * @Returns: a new #CalPrefsDialog.
+ * @page: Page to show when the dialog is popped up.
*
* Creates a new #CalPrefsDialog.
+ *
+ * Return value: a new #CalPrefsDialog.
**/
CalPrefsDialog *
-cal_prefs_dialog_new (void)
+cal_prefs_dialog_new (CalPrefsDialogPage page)
{
CalPrefsDialog *prefs;
prefs = CAL_PREFS_DIALOG (gtk_type_new (cal_prefs_dialog_get_type ()));
- return cal_prefs_dialog_construct (prefs);
+ return cal_prefs_dialog_construct (prefs, page);
}
/**
* cal_prefs_dialog_construct:
* @prefs: A #CalPrefsDialog.
+ * @page: Page to show when the dialog is popped up.
*
* Constructs a task editor by loading its Glade XML file.
*
@@ -145,7 +150,7 @@ cal_prefs_dialog_new (void)
* destroyed.
**/
CalPrefsDialog *
-cal_prefs_dialog_construct (CalPrefsDialog *prefs)
+cal_prefs_dialog_construct (CalPrefsDialog *prefs, CalPrefsDialogPage page)
{
CalPrefsDialogPrivate *priv;
@@ -170,7 +175,7 @@ cal_prefs_dialog_construct (CalPrefsDialog *prefs)
cal_prefs_dialog_show_config (prefs);
- gtk_widget_show (priv->dialog);
+ cal_prefs_dialog_show (prefs, page);
return prefs;
@@ -194,6 +199,8 @@ get_widgets (CalPrefsDialog *prefs)
priv->dialog = GW ("cal-prefs-dialog");
+ priv->toplevel_notebook = GW ("toplevel-notebook");
+
/* The indices must be 0 (Sun) to 6 (Sat). */
priv->working_days[0] = GW ("sun_button");
priv->working_days[1] = GW ("mon_button");
@@ -220,6 +227,7 @@ get_widgets (CalPrefsDialog *prefs)
#undef GW
return (priv->dialog
+ && priv->toplevel_notebook
&& priv->timezone
&& priv->working_days[0]
&& priv->working_days[1]
@@ -276,9 +284,10 @@ cal_prefs_dialog_create_time_edit (void)
void
-cal_prefs_dialog_show (CalPrefsDialog *prefs)
+cal_prefs_dialog_show (CalPrefsDialog *prefs, CalPrefsDialogPage page)
{
CalPrefsDialogPrivate *priv;
+ int page_num;
g_return_if_fail (IS_CAL_PREFS_DIALOG (prefs));
@@ -292,6 +301,22 @@ cal_prefs_dialog_show (CalPrefsDialog *prefs)
cal_prefs_dialog_show_config (prefs);
gtk_widget_show (priv->dialog);
}
+
+ switch (page) {
+ case CAL_PREFS_DIALOG_PAGE_CALENDAR:
+ page_num = 0;
+ break;
+
+ case CAL_PREFS_DIALOG_PAGE_TASKS:
+ page_num = 2;
+ break;
+
+ default:
+ g_assert_not_reached ();
+ return;
+ }
+
+ gtk_notebook_set_page (GTK_NOTEBOOK (priv->toplevel_notebook), page_num);
}
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade
index b93e15f442..2e30d92f20 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.glade
+++ b/calendar/gui/dialogs/cal-prefs-dialog.glade
@@ -89,7 +89,7 @@
<widget>
<class>GtkNotebook</class>
- <name>notebook1</name>
+ <name>toplevel-notebook</name>
<can_focus>True</can_focus>
<show_tabs>True</show_tabs>
<show_border>True</show_border>
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
index e238d83378..88d3b10249 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -47,6 +47,11 @@ typedef struct _CalPrefsDialogClass CalPrefsDialogClass;
typedef struct _CalPrefsDialogPrivate CalPrefsDialogPrivate;
+typedef enum {
+ CAL_PREFS_DIALOG_PAGE_CALENDAR,
+ CAL_PREFS_DIALOG_PAGE_TASKS
+} CalPrefsDialogPage;
+
struct _CalPrefsDialog
{
GtkObject object;
@@ -62,10 +67,10 @@ struct _CalPrefsDialogClass
GtkType cal_prefs_dialog_get_type (void);
-CalPrefsDialog* cal_prefs_dialog_construct (CalPrefsDialog *prefs);
-CalPrefsDialog* cal_prefs_dialog_new (void);
+CalPrefsDialog* cal_prefs_dialog_construct (CalPrefsDialog *prefs, CalPrefsDialogPage page);
+CalPrefsDialog* cal_prefs_dialog_new (CalPrefsDialogPage page);
-void cal_prefs_dialog_show (CalPrefsDialog *prefs);
+void cal_prefs_dialog_show (CalPrefsDialog *prefs, CalPrefsDialogPage page);
END_GNOME_DECLS
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index f2d594610a..d72798528b 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -29,6 +29,7 @@
#include <libgnome/gnome-util.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-ui-util.h>
+#include "dialogs/cal-prefs-dialog.h"
#include "calendar-config.h"
#include "e-tasks.h"
#include "tasks-control.h"
@@ -73,6 +74,9 @@ static void tasks_control_paste_cmd (BonoboUIComponent *uic,
static void tasks_control_delete_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
+static void tasks_control_settings_cmd (BonoboUIComponent *uic,
+ gpointer data,
+ const char *path);
BonoboControl *
@@ -234,6 +238,7 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("TasksCopy", tasks_control_copy_cmd),
BONOBO_UI_VERB ("TasksPaste", tasks_control_paste_cmd),
BONOBO_UI_VERB ("TasksDelete", tasks_control_delete_cmd),
+ BONOBO_UI_VERB ("TasksSettings", tasks_control_settings_cmd),
BONOBO_UI_VERB_END
};
@@ -242,6 +247,7 @@ static EPixmap pixmaps [] = {
E_PIXMAP ("/menu/File/New/NewFirstItem/NewTask", "evolution-tasks-mini.png"),
E_PIXMAP ("/menu/File/Print/Print", "print.xpm"),
E_PIXMAP ("/menu/File/Print/Print Preview", "print-preview.xpm"),
+ E_PIXMAP ("/menu/Tools/Component/TasksSettings", "configure_16_calendar.xpm"),
E_PIXMAP ("/Toolbar/New", "buttons/new_appointment.png"),
E_PIXMAP ("/Toolbar/Print", "buttons/print.png"),
E_PIXMAP_END
@@ -366,3 +372,18 @@ tasks_control_delete_cmd (BonoboUIComponent *uic,
tasks = E_TASKS (data);
e_tasks_delete_selected (tasks);
}
+
+/* Callback used for the tasks settings command */
+static void
+tasks_control_settings_cmd (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+ ETasks *tasks;
+ static CalPrefsDialog *prefs_dialog = NULL;
+
+ tasks = E_TASKS (data);
+
+ if (!prefs_dialog)
+ prefs_dialog = cal_prefs_dialog_new (CAL_PREFS_DIALOG_PAGE_TASKS);
+ else
+ cal_prefs_dialog_show (prefs_dialog, CAL_PREFS_DIALOG_PAGE_TASKS);
+}