aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-11-06 04:12:44 +0800
committerChris Lahey <clahey@src.gnome.org>2001-11-06 04:12:44 +0800
commitc81e771e3bcafa9913f3b01a4f3d000e0933e883 (patch)
tree6afe176966f193ec59d0078c1f9a0eb72ef9cb2a /widgets/misc
parent514e14b2c6fe46d3a786517cfd546a9ac2080af9 (diff)
downloadgsoc2013-evolution-c81e771e3bcafa9913f3b01a4f3d000e0933e883.tar
gsoc2013-evolution-c81e771e3bcafa9913f3b01a4f3d000e0933e883.tar.gz
gsoc2013-evolution-c81e771e3bcafa9913f3b01a4f3d000e0933e883.tar.bz2
gsoc2013-evolution-c81e771e3bcafa9913f3b01a4f3d000e0933e883.tar.lz
gsoc2013-evolution-c81e771e3bcafa9913f3b01a4f3d000e0933e883.tar.xz
gsoc2013-evolution-c81e771e3bcafa9913f3b01a4f3d000e0933e883.tar.zst
gsoc2013-evolution-c81e771e3bcafa9913f3b01a4f3d000e0933e883.zip
Based on a patch by Damon Chaplin <damon@ximian.com>
2001-11-05 Christopher James Lahey <clahey@ximian.com> Based on a patch by Damon Chaplin <damon@ximian.com> * e-cell-date-edit.c: Connect to the button_press signal on the popup and do the grab correctly so that this dialog behaves properly when the user clicks it away. Also, changed all instances of setting of popup_shown field of ECellPopup to call e_cell_popup_set_shown. Fixes Ximian bug #14016. svn path=/trunk/; revision=14594
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/ChangeLog10
-rw-r--r--widgets/misc/e-cell-date-edit.c40
2 files changed, 43 insertions, 7 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 254cdf9bfb..a9c6d0eacd 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,13 @@
+2001-11-05 Christopher James Lahey <clahey@ximian.com>
+
+Based on a patch by Damon Chaplin <damon@ximian.com>
+
+ * e-cell-date-edit.c: Connect to the button_press signal on the
+ popup and do the grab correctly so that this dialog behaves
+ properly when the user clicks it away. Also, changed all
+ instances of setting of popup_shown field of ECellPopup to call
+ e_cell_popup_set_shown. Fixes Ximian bug #14016.
+
2001-10-31 <NotZed@Ximian.com>
* e-filter-bar.c (build_items): Snotty code so we only disconnect
diff --git a/widgets/misc/e-cell-date-edit.c b/widgets/misc/e-cell-date-edit.c
index 88203d006d..4d775617ea 100644
--- a/widgets/misc/e-cell-date-edit.c
+++ b/widgets/misc/e-cell-date-edit.c
@@ -77,6 +77,9 @@ static void e_cell_date_edit_rebuild_time_list (ECellDateEdit *ecde);
static int e_cell_date_edit_key_press (GtkWidget *popup_window,
GdkEventKey *event,
ECellDateEdit *ecde);
+static int e_cell_date_edit_button_press (GtkWidget *popup_window,
+ GdkEventButton *event,
+ ECellDateEdit *ecde);
static void e_cell_date_edit_on_ok_clicked (GtkWidget *button,
ECellDateEdit *ecde);
static void e_cell_date_edit_show_time_invalid_warning (ECellDateEdit *ecde);
@@ -92,6 +95,7 @@ static void e_cell_date_edit_on_time_selected (GtkList *list,
ECellDateEdit *ecde);
static void e_cell_date_edit_hide_popup (ECellDateEdit *ecde);
+
/* Our arguments. */
enum {
ARG_0,
@@ -263,6 +267,10 @@ e_cell_date_edit_init (ECellDateEdit *ecde)
"key_press_event",
GTK_SIGNAL_FUNC (e_cell_date_edit_key_press),
ecde);
+ gtk_signal_connect (GTK_OBJECT (ecde->popup_window),
+ "button_press_event",
+ GTK_SIGNAL_FUNC (e_cell_date_edit_button_press),
+ ecde);
}
@@ -435,8 +443,12 @@ e_cell_date_edit_do_popup (ECellPopup *ecp,
time = event->key.time;
}
+ gdk_keyboard_grab (ecde->popup_window->window, TRUE, time);
gtk_grab_add (ecde->popup_window);
+ /* Set the focus to the first widget. */
+ gtk_widget_grab_focus (ecde->time_entry);
+
return TRUE;
}
@@ -554,10 +566,7 @@ e_cell_date_edit_show_popup (ECellDateEdit *ecde,
gdk_window_resize (ecde->popup_window->window, width, height);
gtk_widget_show (ecde->popup_window);
- /* Set the focus to the first widget. */
- gtk_widget_grab_focus (ecde->time_entry);
-
- E_CELL_POPUP (ecde)->popup_shown = TRUE;
+ e_cell_popup_set_shown (E_CELL_POPUP (ecde), TRUE);
}
@@ -657,6 +666,25 @@ e_cell_date_edit_key_press (GtkWidget *popup_window,
}
+/* This handles button press events in the popup window. If the button is
+ pressed outside the popup, we hide it and do not change the cell contents.
+*/
+static int
+e_cell_date_edit_button_press (GtkWidget *popup_window,
+ GdkEventButton *event,
+ ECellDateEdit *ecde)
+{
+ GtkWidget *event_widget;
+
+ event_widget = gtk_get_event_widget ((GdkEvent*) event);
+ if (gtk_widget_get_toplevel (event_widget) != popup_window) {
+ e_cell_date_edit_hide_popup (ecde);
+ }
+
+ return TRUE;
+}
+
+
/* Clears the time list and rebuilds it using the lower_hour, upper_hour
and use_24_hour_format settings. */
static void
@@ -891,7 +919,7 @@ e_cell_date_edit_hide_popup (ECellDateEdit *ecde)
{
gtk_grab_remove (ecde->popup_window);
gtk_widget_hide (ecde->popup_window);
- E_CELL_POPUP (ecde)->popup_shown = FALSE;
+ e_cell_popup_set_shown (E_CELL_POPUP (ecde), FALSE);
}
@@ -939,5 +967,3 @@ e_cell_date_edit_set_get_time_callback (ECellDateEdit *ecde,
ecde->time_callback_data = data;
ecde->time_callback_destroy = destroy;
}
-
-