aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-02-10 05:22:29 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-02-10 05:22:29 +0800
commit928749075ce314f9907399771c10f4d541f48229 (patch)
tree80f4f87e1178b5ced2f5011cb35b29739ad884a0
parenteeb0091ac1b0e39b1e20d242fd5bc906b2039c1f (diff)
downloadgsoc2013-evolution-928749075ce314f9907399771c10f4d541f48229.tar
gsoc2013-evolution-928749075ce314f9907399771c10f4d541f48229.tar.gz
gsoc2013-evolution-928749075ce314f9907399771c10f4d541f48229.tar.bz2
gsoc2013-evolution-928749075ce314f9907399771c10f4d541f48229.tar.lz
gsoc2013-evolution-928749075ce314f9907399771c10f4d541f48229.tar.xz
gsoc2013-evolution-928749075ce314f9907399771c10f4d541f48229.tar.zst
gsoc2013-evolution-928749075ce314f9907399771c10f4d541f48229.zip
Set the correct drop-down menu item. (message_tag_followup_encode): Return
2002-02-09 Jeffrey Stedfast <fejj@ximian.com> * message-tag-followup.c (set_widget_values): Set the correct drop-down menu item. (message_tag_followup_encode): Return NULL if the type is NONE. (clear_clicked): Set the drop-down menu to None. (type_changed): Hide the None menu item. (construct): Create a None menu item and set it as the default. svn path=/trunk/; revision=15637
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/message-tag-followup.c27
-rw-r--r--mail/message-tag-followup.h2
3 files changed, 34 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index ea6260731e..79a9b3c2a0 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2002-02-09 Jeffrey Stedfast <fejj@ximian.com>
+
+ * message-tag-followup.c (set_widget_values): Set the correct
+ drop-down menu item.
+ (message_tag_followup_encode): Return NULL if the type is NONE.
+ (clear_clicked): Set the drop-down menu to None.
+ (type_changed): Hide the None menu item.
+ (construct): Create a None menu item and set it as the default.
+
2002-02-08 Jeffrey Stedfast <fejj@ximian.com>
* message-tag-followup.[c,h]: New flag-for-followup tag editor
diff --git a/mail/message-tag-followup.c b/mail/message-tag-followup.c
index 3465dd4e69..5c46418391 100644
--- a/mail/message-tag-followup.c
+++ b/mail/message-tag-followup.c
@@ -110,6 +110,7 @@ message_tag_followup_init (MessageTagFollowUp *editor)
editor->value = NULL;
editor->type = NULL;
+ editor->none = NULL;
editor->target_date = NULL;
editor->completed = NULL;
editor->clear = NULL;
@@ -149,8 +150,14 @@ static void
set_widget_values (MessageTagFollowUp *followup)
{
time_t completed;
+ GtkWidget *item;
+ GList *items;
+
+ items = GTK_MENU_SHELL (followup->type)->children;
+ item = g_list_nth_data (items, followup->tag->type);
gtk_option_menu_set_history (followup->type, followup->tag->type);
+ gtk_signal_emit_by_name (GTK_OBJECT (followup->type), "activate", followup);
e_date_edit_set_time (followup->target_date, followup->tag->target_date);
@@ -212,6 +219,9 @@ message_tag_followup_encode (struct _FollowUpTag *tag)
{
g_return_val_if_fail (tag != NULL, NULL);
+ if (tag->type == FLAG_NONE)
+ return NULL;
+
return g_strdup_printf ("%s:%lx:%lx", available_flags[tag->type].name,
(unsigned long) tag->target_date,
(unsigned long) tag->completed);
@@ -222,7 +232,10 @@ clear_clicked (GtkButton *button, gpointer user_data)
{
MessageTagFollowUp *followup = user_data;
- /* FIXME: set dropdown == None?? */
+ gtk_widget_show (followup->none);
+ gtk_option_menu_set_history (followup->type, FLAG_NONE);
+ gtk_signal_emit_by_name (GTK_OBJECT (followup->none), "activate", followup);
+
e_date_edit_set_time (followup->target_date, time (NULL));
gtk_toggle_button_set_active (followup->completed, FALSE);
}
@@ -239,11 +252,14 @@ completed_toggled (GtkToggleButton *button, gpointer user_data)
}
static void
-type_changed (GtkMenuItem *item, gpointer user_data)
+type_changed (GtkWidget *item, gpointer user_data)
{
MessageTagFollowUp *followup = user_data;
followup->tag->type = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item), "value"));
+
+ if (item != followup->none)
+ gtk_widget_hide (followup->none);
}
static void
@@ -291,8 +307,8 @@ construct (MessageTagEditor *editor)
followup->type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "followup_type"));
gtk_option_menu_remove_menu (followup->type);
menu = gtk_menu_new ();
- for (i = 0; i < FLAG_NONE; i++) {
- item = gtk_menu_item_new_with_label (available_flags[i].i18n_name);
+ for (i = 0; i <= FLAG_NONE; i++) {
+ item = gtk_menu_item_new_with_label (_(available_flags[i].i18n_name));
gtk_object_set_data (GTK_OBJECT (item), "value",
GINT_TO_POINTER (available_flags[i].value));
gtk_signal_connect (GTK_OBJECT (item), "activate",
@@ -300,7 +316,10 @@ construct (MessageTagEditor *editor)
gtk_menu_append (GTK_MENU (menu), item);
gtk_widget_show (item);
}
+ followup->none = item;
gtk_option_menu_set_menu (followup->type, menu);
+ gtk_signal_emit_by_name (GTK_OBJECT (item), "activate", followup);
+ gtk_option_menu_set_history (followup->type, FLAG_NONE);
followup->target_date = E_DATE_EDIT (glade_xml_get_widget (gui, "target_date"));
e_date_edit_set_time (followup->target_date, time (NULL));
diff --git a/mail/message-tag-followup.h b/mail/message-tag-followup.h
index cb5b7857e1..2f61679664 100644
--- a/mail/message-tag-followup.h
+++ b/mail/message-tag-followup.h
@@ -70,6 +70,8 @@ struct _MessageTagFollowUp {
char *value;
GtkOptionMenu *type;
+ GtkWidget *none;
+
EDateEdit *target_date;
GtkToggleButton *completed;
GtkButton *clear;