[evolution-patches] Enable "Alt+Down Arrow" to show the popup for e-combo-cell-editable, for bug 46359



Hi,
Here is a patch for bug 46359 to enable "Alt+Down Arrow" to show the popup for e-combo-cell-editable.
   Please review it.
   Thanks!
      Harry
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/ChangeLog,v
retrieving revision 1.342
diff -u -p -r1.342 ChangeLog
--- ChangeLog	12 Jan 2005 14:03:41 -0000	1.342
+++ ChangeLog	17 Jan 2005 08:48:45 -0000
@@ -1,3 +1,16 @@
+2005-01-17  Harry Lu  <harry lu sun com>
+
+	Fix for 46359, enable "Alt+Down Arrow" to show the popup for
+	e-combo-cell-editable.c.
+
+	* e-combo-cell-editable.c: (show_popup): rewrite it to a more 
+	generic function.
+	(button_clicked_cb): call the new show_popup function.
+	(entry_key_press_event_cb): show popup if "Alt+Down Arrow".
+	(ecce_grab_focus): new function.
+	(ecce_class_init): add grab_focus handler so that the entry 
+	can get focus.
+
 2005-01-12 Chenthill Palanisamy <pchenthill novell com>
 
 	* e-send-options.c: (e_send_options_get_widgets_data),
Index: e-combo-cell-editable.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-combo-cell-editable.c,v
retrieving revision 1.1
diff -u -p -r1.1 e-combo-cell-editable.c
--- e-combo-cell-editable.c	30 Sep 2003 22:35:10 -0000	1.1
+++ e-combo-cell-editable.c	17 Jan 2005 08:48:47 -0000
@@ -225,9 +225,11 @@ position_popup (EComboCellEditable *ecce
 }
 
 static void
-show_popup (EComboCellEditable *ecce, gint x, gint y, gint offset)
+show_popup (EComboCellEditable *ecce)
 {
 	gint row;
+	GtkAllocation  alloc;
+	gint x, y;
 
 	if (!ecce->priv->list)
 		return;
@@ -236,7 +238,11 @@ show_popup (EComboCellEditable *ecce, gi
 	row = lookup_row (ecce->priv->list, e_combo_cell_editable_get_text (ecce));
 	set_cursor (ecce->priv->tree_view, row);
 
-	position_popup (ecce, x, y, offset);
+	gtk_editable_select_region (GTK_EDITABLE (ecce->priv->entry), 0, 0);
+	gdk_window_get_origin (GTK_WIDGET (ecce)->window, &x, &y);
+	alloc = GTK_WIDGET (ecce)->allocation;
+
+	position_popup (ecce, x, y + alloc.height, alloc.height);
 
 	gtk_grab_add (GTK_WIDGET (ecce->priv->popup));
 	gtk_widget_grab_focus (GTK_WIDGET (ecce->priv->tree_view));
@@ -246,21 +252,12 @@ show_popup (EComboCellEditable *ecce, gi
 static void
 button_clicked_cb (GtkButton *btn, EComboCellEditable *ecce)
 {
-	GtkAllocation  alloc;
-	gint x, y;
-	
 	if (ecce->priv->popup) {
 		kill_popup (ecce);
 		return;
 	}
-	
-	gtk_editable_select_region (GTK_EDITABLE (ecce->priv->entry), 0, 0);
-
-	gdk_window_get_origin (GTK_WIDGET (ecce)->window, &x, &y);
-	
-	alloc = GTK_WIDGET (ecce)->allocation;
 
-	show_popup (ecce, x, y + alloc.height, alloc.height);
+	show_popup (ecce);
 }
 
 static void
@@ -280,6 +277,14 @@ entry_key_press_event_cb (GtkEntry *entr
 		return TRUE;
 	}
 
+	if (key_event->state & GDK_MOD1_MASK
+		&& key_event->keyval == GDK_Down) {
+		if (!ecce->priv->popup)
+			show_popup (ecce);
+
+		return TRUE;
+	}
+
 	return FALSE;
 }
 
@@ -336,9 +341,21 @@ ecce_init (EComboCellEditable *ecce)
 }
 
 static void
+ecce_grab_focus (GtkWidget *widget)
+{
+	EComboCellEditable *ecce = E_COMBO_CELL_EDITABLE (widget);
+
+	gtk_widget_grab_focus (GTK_WIDGET (ecce->priv->entry));
+}
+
+static void
 ecce_class_init (GObjectClass *klass)
 {
+	GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
+
 	klass->finalize = ecce_finalize;
+	
+	widget_class->grab_focus = ecce_grab_focus;
 	
 	parent_class = GTK_EVENT_BOX_CLASS (g_type_class_peek_parent (klass));
 }


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