aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/event-editor.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2001-01-06 03:01:25 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-01-06 03:01:25 +0800
commit9177914543e3bd828cb6e88ec035a5f7648bcebe (patch)
tree0f6774e70e487e777ea9eec74f26047b257c057a /calendar/gui/event-editor.c
parent3b1cd946dfefa0b86331583076936ce7f89c4e26 (diff)
downloadgsoc2013-evolution-9177914543e3bd828cb6e88ec035a5f7648bcebe.tar.gz
gsoc2013-evolution-9177914543e3bd828cb6e88ec035a5f7648bcebe.tar.zst
gsoc2013-evolution-9177914543e3bd828cb6e88ec035a5f7648bcebe.zip
get categories button (init_widgets): listen for button click
2001-01-05 JP Rosevear <jpr@helixcode.com> * gui/event-editor.c (get_widgets): get categories button (init_widgets): listen for button click (fill_widgets): fill in the categories area (dialog_to_comp_object): set the cal component categories (categories_clicked): throw up the categories dialog and update when ok is clicked * gui/event-editor-dialog.glade: Add categories and contacts buttons and fields * gui/dialogs/task-editor-dialog.glade: Rename button svn path=/trunk/; revision=7270
Diffstat (limited to 'calendar/gui/event-editor.c')
-rw-r--r--calendar/gui/event-editor.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c
index ea2f78ae10..f3adb24c91 100644
--- a/calendar/gui/event-editor.c
+++ b/calendar/gui/event-editor.c
@@ -29,6 +29,7 @@
#include <e-util/e-dialog-widgets.h>
#include <widgets/misc/e-dateedit.h>
#include <gal/widgets/e-unicode.h>
+#include <gal/widgets/e-categories.h>
#include <cal-util/timeutil.h>
#include "dialogs/delete-comp.h"
#include "calendar-config.h"
@@ -110,6 +111,9 @@ struct _EventEditorPrivate {
GtkWidget *classification_private;
GtkWidget *classification_confidential;
+ GtkWidget *categories;
+ GtkWidget *categories_btn;
+
GtkWidget *recurrence_summary;
GtkWidget *recurrence_starting_date;
@@ -188,6 +192,7 @@ static void field_changed (GtkWidget *widget,
static void event_editor_set_changed (EventEditor *ee,
gboolean changed);
static gboolean prompt_to_save_changes (EventEditor *ee);
+static void categories_clicked (GtkWidget *button, EventEditor *ee);
@@ -941,6 +946,9 @@ get_widgets (EventEditor *ee)
priv->classification_private = GW ("classification-private");
priv->classification_confidential = GW ("classification-confidential");
+ priv->categories = GW ("categories");
+ priv->categories_btn = GW ("categories-button");
+
priv->recurrence_summary = GW ("recurrence-summary");
priv->recurrence_starting_date = GW ("recurrence-starting-date");
@@ -1091,6 +1099,10 @@ init_widgets (EventEditor *ee)
gtk_signal_connect (GTK_OBJECT (priv->recurrence_summary), "changed",
GTK_SIGNAL_FUNC (summary_changed_cb), priv->general_summary);
+ /* Categories button */
+ gtk_signal_connect (GTK_OBJECT (priv->categories_btn), "clicked",
+ GTK_SIGNAL_FUNC (categories_clicked), ee);
+
/* Start dates in the main and recurrence pages */
gtk_signal_connect (GTK_OBJECT (priv->start_time), "changed",
@@ -1860,7 +1872,8 @@ fill_widgets (EventEditor *ee)
CalComponentDateTime d;
GSList *l;
time_t dtstart, dtend;
-
+ const char *categories;
+
priv = ee->priv;
clear_widgets (ee);
@@ -1960,6 +1973,10 @@ fill_widgets (EventEditor *ee)
*/
}
+ /* Categories */
+ cal_component_get_categories (priv->comp, &categories);
+ e_dialog_editable_set (priv->categories, categories);
+
/* Recurrences */
fill_recurrence_widgets (ee);
@@ -2235,7 +2252,7 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp)
CalComponentDateTime date;
time_t t;
gboolean all_day_event;
- char *str;
+ char *cat, *str;
priv = ee->priv;
@@ -2302,9 +2319,15 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp)
} else {
/* FIXME: What do we do here? */
}
-
g_free (date.value);
+ /* Categories */
+ cat = e_dialog_editable_get (priv->categories);
+ cal_component_set_categories (comp, cat);
+
+ if (cat)
+ g_free (cat);
+
#if 0
ico->dalarm.enabled = e_dialog_toggle_get (priv->alarm_display);
ico->aalarm.enabled = e_dialog_toggle_get (priv->alarm_program);
@@ -3271,3 +3294,28 @@ prompt_to_save_changes (EventEditor *ee)
break;
}
}
+
+static void
+categories_clicked (GtkWidget *button, EventEditor *ee)
+{
+ char *categories;
+ GnomeDialog *dialog;
+ int result;
+ GtkWidget *entry;
+
+ entry = ee->priv->categories;
+ categories = e_utf8_gtk_entry_get_text (GTK_ENTRY (entry));
+
+ dialog = GNOME_DIALOG (e_categories_new (categories));
+ result = gnome_dialog_run (dialog);
+ g_free (categories);
+
+ if (result == 0) {
+ gtk_object_get (GTK_OBJECT (dialog),
+ "categories", &categories,
+ NULL);
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), categories);
+ g_free (categories);
+ }
+ gtk_object_destroy (GTK_OBJECT (dialog));
+}