gnome-panel r11039 - trunk/applets/clock



Author: vuntz
Date: Thu Apr 10 12:07:17 2008
New Revision: 11039
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11039&view=rev

Log:
2008-04-10  Vincent Untz  <vuntz gnome org>

	* clock.c: (run_find_location): pre-fill the find location entry if it
	was empty and the user typed something in the name entry of the
	previous dialog
	(edit_clear): also collapse the find location treeview when resetting
	the state of the find window


Modified:
   trunk/applets/clock/ChangeLog
   trunk/applets/clock/clock.c

Modified: trunk/applets/clock/clock.c
==============================================================================
--- trunk/applets/clock/clock.c	(original)
+++ trunk/applets/clock/clock.c	Thu Apr 10 12:07:17 2008
@@ -3413,12 +3413,22 @@
 run_find_location (GtkButton *button, ClockData *cd)
 {
         GtkWidget *edit_window = glade_xml_get_widget (cd->glade_xml, "edit-location-window");
+	GtkWidget *name_entry = glade_xml_get_widget (cd->glade_xml, "edit-location-name-entry");
         GtkWidget *window;
+	const char *find;
 
 	fill_location_tree (cd);
         window = glade_xml_get_widget (cd->glade_xml, "find-location-window");
 
-	gtk_tree_view_collapse_all (GTK_TREE_VIEW (cd->location_tree));
+	/* prefill the find entry if it's empty */
+	find = gtk_entry_get_text (GTK_ENTRY (cd->find_location_entry));
+	if (!find || !find[0]) {
+		const char *location;
+
+		location = gtk_entry_get_text (GTK_ENTRY (name_entry));
+		gtk_entry_set_text (GTK_ENTRY (cd->find_location_entry),
+				    location);
+	}
 	gtk_widget_grab_focus (cd->find_location_entry);
 
         gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (edit_window));
@@ -3600,8 +3610,10 @@
         gtk_combo_box_set_active (GTK_COMBO_BOX (lat_combo), -1);
         gtk_combo_box_set_active (GTK_COMBO_BOX (lon_combo), -1);
 
-	if (cd->find_location_entry)
-		gtk_entry_set_text (GTK_ENTRY (cd->find_location_entry), "");
+	/* reset the state of the find window */
+	gtk_entry_set_text (GTK_ENTRY (cd->find_location_entry), "");
+
+	gtk_tree_view_collapse_all (GTK_TREE_VIEW (cd->location_tree));
 
 	adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scroll));
 	gtk_adjustment_set_value (adjustment, 0);



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