summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2011-07-27 17:46:04 -0500
committerFederico Mena Quintero <federico@gnome.org>2011-07-27 18:46:27 -0500
commit6b2cca9168b7ef34d95ef956db9d2651d82ae3d9 (patch)
treecd153509ff394faa015af1e3a3b8b293327dc651
parent4b492443886c15c496c344b46d5ad23d81b3cc10 (diff)
downloadgtk+-6b2cca9168b7ef34d95ef956db9d2651d82ae3d9.tar.gz
Remove the unused, initial-text logic from the location entry
Years ago, when the location entry only appeared in a popup window, it used to appear populated with the current folder's path. We had some logic to do this, but since now the location entry appears in the main dialog, we can do away with that old code. Signed-off-by: Federico Mena Quintero <federico@gnome.org>
-rw-r--r--gtk/gtkfilechooserdefault.c80
1 files changed, 5 insertions, 75 deletions
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 4c383f1ea8..3d825ded8c 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -3707,7 +3707,7 @@ key_is_left_or_right (GdkEventKey *event)
/* Handles key press events on the file list, so that we can trap Enter to
* activate the default button on our own. Also, checks to see if '/' has been
- * pressed. See comment by tree_view_keybinding_cb() for more details.
+ * pressed.
*/
static gboolean
browse_files_key_press_event_cb (GtkWidget *widget,
@@ -4486,53 +4486,6 @@ location_switch_to_path_bar (GtkFileChooserDefault *impl)
gtk_widget_hide (impl->location_entry_box);
}
-/* Sets the full path of the current folder as the text in the location entry. */
-static void
-location_entry_set_initial_text (GtkFileChooserDefault *impl)
-{
- gchar *text, *filename;
-
- if (!impl->current_folder)
- return;
-
- filename = g_file_get_path (impl->current_folder);
-
- if (filename)
- {
- text = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
- g_free (filename);
- }
- else
- text = g_file_get_uri (impl->current_folder);
-
- if (text)
- {
- gboolean need_slash;
- int len;
-
- len = strlen (text);
- need_slash = (text[len - 1] != G_DIR_SEPARATOR);
-
- if (need_slash)
- {
- char *slash_text;
-
- slash_text = g_new (char, len + 2);
- strcpy (slash_text, text);
- slash_text[len] = G_DIR_SEPARATOR;
- slash_text[len + 1] = 0;
-
- g_free (text);
- text = slash_text;
- }
-
- _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), text);
- g_free (text);
- }
-
- g_free (filename);
-}
-
/* Turns on the location entry. Can be called even if we are already in that
* mode.
*/
@@ -10169,34 +10122,11 @@ location_popup_handler (GtkFileChooserDefault *impl,
if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
- LocationMode new_mode;
-
- if (path != NULL)
- {
- /* since the user typed something, we unconditionally want to turn on the entry */
- new_mode = LOCATION_MODE_FILENAME_ENTRY;
- }
- else if (impl->location_mode == LOCATION_MODE_PATH_BAR)
- new_mode = LOCATION_MODE_FILENAME_ENTRY;
- else if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
- new_mode = LOCATION_MODE_PATH_BAR;
- else
- {
- g_assert_not_reached ();
- return;
- }
+ if (!path)
+ return;
- location_mode_set (impl, new_mode, TRUE);
- if (new_mode == LOCATION_MODE_FILENAME_ENTRY)
- {
- if (path != NULL)
- location_set_user_text (impl, path);
- else
- {
- location_entry_set_initial_text (impl);
- gtk_editable_select_region (GTK_EDITABLE (impl->location_entry), 0, -1);
- }
- }
+ location_mode_set (impl, LOCATION_MODE_FILENAME_ENTRY, TRUE);
+ location_set_user_text (impl, path);
}
else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)