empathy r2791 - trunk/libempathy-gtk



Author: xclaesse
Date: Fri Apr 10 16:54:31 2009
New Revision: 2791
URL: http://svn.gnome.org/viewvc/empathy?rev=2791&view=rev

Log:
Editing mode on click

From: Davyd Madeley <davyd madeley id au>

Modified:
   trunk/libempathy-gtk/empathy-presence-chooser.c

Modified: trunk/libempathy-gtk/empathy-presence-chooser.c
==============================================================================
--- trunk/libempathy-gtk/empathy-presence-chooser.c	(original)
+++ trunk/libempathy-gtk/empathy-presence-chooser.c	Fri Apr 10 16:54:31 2009
@@ -362,6 +362,25 @@
 	return FALSE; /* send this event elsewhere */
 }
 
+static gboolean
+entry_button_press_event_cb (EmpathyPresenceChooser *self,
+                             GdkEventButton         *event,
+			     GtkWidget              *entry)
+{
+	EmpathyPresenceChooserPriv *priv = GET_PRIV (self);
+
+	if (!priv->editing_status && event->button == 1)
+	{
+		set_status_editing (self, TRUE);
+		gtk_widget_grab_focus (entry);
+		gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
 static void
 text_changed_cb (EmpathyPresenceChooser *self, gpointer user_data)
 {
@@ -525,7 +544,9 @@
 	g_signal_connect_object (entry, "key-press-event",
 			G_CALLBACK (entry_key_press_event_cb), chooser,
 			G_CONNECT_SWAPPED);
-	// FIXME - should this also happen when the user presses TAB ?
+	g_signal_connect_object (entry, "button-press-event",
+			G_CALLBACK (entry_button_press_event_cb), chooser,
+			G_CONNECT_SWAPPED);
 
 	GtkCellRenderer *renderer;
 	gtk_cell_layout_clear (GTK_CELL_LAYOUT (chooser));



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