[evolution-patches] Bug 46351, Calendar:Accesskey for Time_z_one doesn't work



hi, JP Rosevear
 
   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 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/17 04:13:23
@@ -1,3 +1,17 @@
+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.
+        (e_timezone_entry_mnemonic_activate): new function.  override the 
+          member function of GtkWidget to handle mnemonic_activate signal 
+          of custom class ETimezoneEntry.
+        (e_timezone_entry_init):set the flags of private button to  
+          GTK_CAN_FOCUSE|GTK_CAN_DEFAULT
+        (e_timezone_entry_new):set the flags of ETimezoneEntry to GTK_CAN_FOCUS
+        (e_timezone_entry_class_init):set the function pointer of GtkWidget's 
+          mnemonic_activate to e_timezone_entry_mnemonic_activate.
 
 -----------------tag A11Y_M2--------------
 
Index: gui/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
--- gui/e-timezone-entry.c	2003/09/26 06:34:29	1.1.1.1
+++ gui/e-timezone-entry.c	2003/11/17 04:13:23
@@ -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,
@@ -130,6 +135,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);
@@ -158,6 +164,8 @@
 
 	tentry = g_object_new (e_timezone_entry_get_type (), NULL);
 
+	GTK_WIDGET_SET_FLAGS (GTK_WIDGET(tentry), GTK_CAN_FOCUS);
+
 	return GTK_WIDGET (tentry);
 }
 
@@ -297,3 +305,40 @@
 	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;
+}
Index: gui/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
--- gui/e-timezone-entry.h	2003/09/26 06:34:29	1.1.1.1
+++ gui/e-timezone-entry.h	2003/11/17 04:13:23
@@ -34,7 +34,9 @@
 
 #include <gtk/gtkhbox.h>
 #include <cal-client/cal-client.h>
- 
+
+#include <gtk/gtkbutton.h>
+
 G_BEGIN_DECLS
 
 
@@ -69,6 +71,7 @@
 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. */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]