empathy r2769 - trunk/libempathy-gtk



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

Log:
Set the chooser in "editing mode" when you start editing it

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:53:13 2009
@@ -275,10 +275,30 @@
 		gtk_entry_set_icon_sensitive (GTK_ENTRY (entry),
 				GTK_ENTRY_ICON_PRIMARY,
 				TRUE);
+
+		// FIXME - move the focus somewhere
 	}
 }
 
 static void
+entry_icon_release_cb (EmpathyPresenceChooser	*self,
+		       GtkEntryIconPosition	 icon_pos,
+		       GdkEvent		*event,
+		       GtkEntry		*entry)
+{
+	set_status_editing (self, FALSE);
+}
+
+static void
+entry_activate_cb (EmpathyPresenceChooser	*self,
+		   GtkEntry			*entry)
+{
+	g_print ("ACTIVATE! (form of a dragon)\n");
+	
+	set_status_editing (self, FALSE);
+}
+
+static void
 changed_cb (GtkComboBox *self, gpointer user_data)
 {
 	g_print ("Changed\n");
@@ -290,7 +310,8 @@
 	GtkTreeModel *model = gtk_combo_box_get_model (self);
 	if (!gtk_combo_box_get_active_iter (self, &iter))
 	{
-		g_print ("not an iter!\n");
+		/* the combo is being edited to a custom entry */
+		set_status_editing (self, TRUE);
 		return;
 	}
 
@@ -310,6 +331,12 @@
 		gtk_widget_grab_focus (entry);
 		set_status_editing (self, TRUE);
 	}
+	else
+	{
+		/* just in case we were setting a new status when
+		 * things were changed */
+		set_status_editing (self, FALSE);
+	}
 
 	g_free (icon_name);
 }
@@ -333,6 +360,12 @@
 	GtkWidget *entry = gtk_bin_get_child (GTK_BIN (chooser));
 	gtk_entry_set_icon_activatable (GTK_ENTRY (entry),
 			GTK_ENTRY_ICON_PRIMARY, FALSE);
+	g_signal_connect_object (entry, "icon-release",
+			G_CALLBACK (entry_icon_release_cb), chooser,
+			G_CONNECT_SWAPPED);
+	g_signal_connect_object (entry, "activate",
+			G_CALLBACK (entry_activate_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]