[evolution-patches] Fixes Bug 46351
- From: Carl sun <carl sun sun com>
- To: Ettore Perazzoli <ettore ximian com>
- Cc: SCERI EVOLUTION ACC <sceri-evolution-acc sun com>, EVOLUTION PATCH <evolution-patches lists ximian com>
- Subject: [evolution-patches] Fixes Bug 46351
- Date: Wed, 12 Nov 2003 18:14:23 -0800
hi, Ettore
I am writing to tell you that I have fixed the bug 46351, which
occurs in evolution 1.4.4, and the Synopsis is "Accesskey for Time
_z_one doesn't work".
The major modification focus on the file "e-timezone-entry.c" as
follows:
* gui/e-timezone-entry.c (e_timezone_entry_get_private_button): new
function.
access the private button of ETimezoneEntry.
* gui/e-timezone-entry.c (e_timezone_entry_mnemonic_activate): new function.
override the member function of GtkWidget to handle mnemonic_activate signal of
custom class ETimezoneEntry.
* gui/e-timezone-entry.c (e_timezone_entry_init):set the flags of private button
to GTK_CAN_FOCUSE|GTK_CAN_DEFAULT
* gui/e-timezone-entry.c (e_timezone_entry_new):set the flags of ETimezoneEntry
to GTK_CAN_FOCUS
* gui/e-timezone-entry.c (e_timezone_entry_class_init):set the function pointer
of GtkWidget's mnemonic_activate to e_timezone_entry_mnemonic_activate.
As to the more detailed modification, please refer to diff files in the attachment.
It is noted that the expected correct result of the accesskey should be "focus on the '...' button",
rather than "focus on the text entry". please check it.
Cheers,
Carl Sun
Index: ChangeLog
===================================================================
RCS file: /export/src/cvs/evolution/calendar/ChangeLog,v
retrieving revision 1.6
diff -u -r1.6 ChangeLog
--- ChangeLog 2003/10/20 09:20:34 1.6
+++ ChangeLog 2003/11/12 10:00:15
@@ -416,3 +416,15 @@
(query_construct): ditto.
* cal-client/cal-client.c (cal_opened_cb): ditto.
+
+2003-11-11 Carl Sun <carl sun sun com>
+
+ Fixes #46351
+
+ * gui/e-timezone-entry.c (e_timezone_entry_get_private_button): new function. access the private button of ETimezoneEntry.
+ gui/e-timezone-entry.c (e_timezone_entry_mnemonic_activate): new function. override the member function of GtkWidget to handle mnemonic_activate signal of custom class ETimezoneEntry.
+ gui/e-timezone-entry.c (e_timezone_entry_init):set the flags of private button to GTK_CAN_FOCUSE|GTK_CAN_DEFAULT
+ gui/e-timezone-entry.c (e_timezone_entry_new):set the flags of ETimezoneEntry to GTK_CAN_FOCUS
+ gui/e-timezone-entry.c (e_timezone_entry_class_init):set the function pointer of GtkWidget's mnemonic_activate to e_timezone_entry_mnemonic_activate.
+
+
Index: e-timezone-entry.h
===================================================================
RCS file: /export/src/cvs/evolution/calendar/gui/e-timezone-entry.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-timezone-entry.h
--- e-timezone-entry.h 2003/09/26 06:34:29 1.1.1.1
+++ e-timezone-entry.h 2003/11/12 10:05:18
@@ -34,7 +34,9 @@
#include <gtk/gtkhbox.h>
#include <cal-client/cal-client.h>
-
+#include <gtk/gtkentry.h>
+#include <gtk/gtkbutton.h>
+
G_BEGIN_DECLS
@@ -68,7 +70,7 @@
icaltimezone* e_timezone_entry_get_timezone (ETimezoneEntry *tentry);
void e_timezone_entry_set_timezone (ETimezoneEntry *tentry,
icaltimezone *zone);
-
+GtkButton* e_timezone_entry_get_private_button (ETimezoneEntry *tentry);
/* Sets the default timezone. If the current timezone matches this, then the
entry field is hidden. This is useful since most people do not use timezones
so it makes the user interface simpler. */
Index: e-timezone-entry.c
===================================================================
RCS file: /export/src/cvs/evolution/calendar/gui/e-timezone-entry.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-timezone-entry.c
--- e-timezone-entry.c 2003/09/26 06:34:29 1.1.1.1
+++ e-timezone-entry.c 2003/11/12 10:02:16
@@ -69,6 +69,8 @@
static void e_timezone_entry_init (ETimezoneEntry *tentry);
static void e_timezone_entry_destroy (GtkObject *object);
+static gboolean e_timezone_entry_mnemonic_activate (GtkWidget *widget,
+ gboolean group_cycling);
static void on_entry_changed (GtkEntry *entry,
ETimezoneEntry *tentry);
static void on_button_clicked (GtkWidget *widget,
@@ -92,6 +94,9 @@
parent_class = g_type_class_peek_parent (class);
+ GtkWidgetClass *widget_class=GTK_WIDGET_CLASS (class) ;
+ widget_class->mnemonic_activate=e_timezone_entry_mnemonic_activate;
+
timezone_entry_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_LAST,
@@ -107,7 +112,6 @@
class->changed = NULL;
}
-
static void
e_timezone_entry_init (ETimezoneEntry *tentry)
{
@@ -130,6 +134,7 @@
g_signal_connect (priv->entry, "changed", G_CALLBACK (on_entry_changed), tentry);
priv->button = gtk_button_new ();
+ GTK_WIDGET_SET_FLAGS(GTK_WIDGET(priv->button),GTK_CAN_FOCUS|GTK_CAN_DEFAULT);
g_signal_connect (priv->button, "clicked", G_CALLBACK (on_button_clicked), tentry);
gtk_box_pack_start (GTK_BOX (tentry), priv->button, FALSE, FALSE, 6);
gtk_widget_show (priv->button);
@@ -142,7 +147,6 @@
gtk_widget_show (pixmap);
}
-
/**
* e_timezone_entry_new:
*
@@ -151,17 +155,16 @@
*
* Returns: a new #ETimezoneEntry widget.
*/
+
GtkWidget *
e_timezone_entry_new (void)
{
ETimezoneEntry *tentry;
-
tentry = g_object_new (e_timezone_entry_get_type (), NULL);
-
+ GTK_WIDGET_SET_FLAGS(GTK_WIDGET(tentry), GTK_CAN_FOCUS);
return GTK_WIDGET (tentry);
}
-
static void
e_timezone_entry_destroy (GtkObject *object)
{
@@ -180,7 +183,6 @@
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
-
/* The arrow button beside the date field has been clicked, so we show the
popup with the ECalendar in. */
static void
@@ -207,7 +209,6 @@
g_object_unref (timezone_dialog);
}
-
static void
on_entry_changed (GtkEntry *entry,
ETimezoneEntry *tentry)
@@ -215,7 +216,6 @@
gtk_signal_emit (GTK_OBJECT (tentry), timezone_entry_signals[CHANGED]);
}
-
icaltimezone*
e_timezone_entry_get_timezone (ETimezoneEntry *tentry)
{
@@ -228,7 +228,6 @@
return priv->zone;
}
-
void
e_timezone_entry_set_timezone (ETimezoneEntry *tentry,
icaltimezone *zone)
@@ -244,7 +243,6 @@
e_timezone_entry_set_entry (tentry);
}
-
/* Sets the default timezone. If the current timezone matches this, then the
entry field is hidden. This is useful since most people do not use timezones
so it makes the user interface simpler. */
@@ -263,7 +261,6 @@
e_timezone_entry_set_entry (tentry);
}
-
static void
e_timezone_entry_set_entry (ETimezoneEntry *tentry)
{
@@ -297,3 +294,48 @@
g_free (name_buffer);
}
+GtkButton*
+e_timezone_entry_get_private_button (ETimezoneEntry *tentry)
+{
+ ETimezoneEntryPrivate *priv;
+
+ g_return_val_if_fail (E_IS_TIMEZONE_ENTRY (tentry), NULL);
+
+ priv = tentry->priv;
+
+ return priv->button;
+}
+
+static gboolean
+e_timezone_entry_mnemonic_activate (GtkWidget *widget,
+ gboolean group_cycling)
+{
+ GtkContainer *container;
+ GtkButton *button=NULL;
+ container=GTK_CONTAINER(widget);
+
+ if (!group_cycling && GTK_WIDGET_GET_CLASS (widget)->activate_signal)
+ gtk_widget_activate (widget);
+ else if (GTK_WIDGET_CAN_FOCUS (widget))
+ {
+ if(!GTK_WIDGET_HAS_FOCUS(widget))
+ GTK_WIDGET_SET_FLAGS(widget,GTK_HAS_FOCUS);
+
+ button=e_timezone_entry_get_private_button((ETimezoneEntry *)widget);
+ if (button)
+ {
+ GTK_WIDGET_SET_FLAGS(button,GTK_HAS_FOCUS|GTK_CAN_FOCUS);
+ gtk_container_set_focus_child(GTK_CONTAINER(widget),GTK_WIDGET(button));
+ gtk_widget_grab_focus (button);
+ }
+ else
+ gtk_widget_grab_focus (widget);
+ }
+ else
+ {
+ g_warning ("widget `%s' isn't suitable for mnemonic activation",
+ G_OBJECT_TYPE_NAME (widget));
+ gdk_display_beep (gtk_widget_get_display (widget));
+ }
+ return TRUE;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]