Commit f8b3e6fe authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Add _gtk_path_bar_up()/ _gtk_path_bar_down().

Sun Mar 14 21:03:15 2004  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
        _gtk_path_bar_down().

        * gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
        _gtk_path_bar_down() as bindings for Alt-Up
        and new Alt-Down. (Partly based on a patch by
        Mark McLoughlin, #136987)
parent dfa36bb4
Sun Mar 14 21:03:15 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
_gtk_path_bar_down().
* gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
_gtk_path_bar_down() as bindings for Alt-Up
and new Alt-Down. (Partly based on a patch by
Mark McLoughlin, #136987)
2004-03-14 Federico Mena Quintero <federico@ximian.com> 2004-03-14 Federico Mena Quintero <federico@ximian.com>
Fixes #136185, patch by Morten Welinder, with some changes. Fixes #136185, patch by Morten Welinder, with some changes.
......
Sun Mar 14 21:03:15 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
_gtk_path_bar_down().
* gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
_gtk_path_bar_down() as bindings for Alt-Up
and new Alt-Down. (Partly based on a patch by
Mark McLoughlin, #136987)
2004-03-14 Federico Mena Quintero <federico@ximian.com> 2004-03-14 Federico Mena Quintero <federico@ximian.com>
Fixes #136185, patch by Morten Welinder, with some changes. Fixes #136185, patch by Morten Welinder, with some changes.
......
Sun Mar 14 21:03:15 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
_gtk_path_bar_down().
* gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
_gtk_path_bar_down() as bindings for Alt-Up
and new Alt-Down. (Partly based on a patch by
Mark McLoughlin, #136987)
2004-03-14 Federico Mena Quintero <federico@ximian.com> 2004-03-14 Federico Mena Quintero <federico@ximian.com>
Fixes #136185, patch by Morten Welinder, with some changes. Fixes #136185, patch by Morten Welinder, with some changes.
......
Sun Mar 14 21:03:15 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
_gtk_path_bar_down().
* gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
_gtk_path_bar_down() as bindings for Alt-Up
and new Alt-Down. (Partly based on a patch by
Mark McLoughlin, #136987)
2004-03-14 Federico Mena Quintero <federico@ximian.com> 2004-03-14 Federico Mena Quintero <federico@ximian.com>
Fixes #136185, patch by Morten Welinder, with some changes. Fixes #136185, patch by Morten Welinder, with some changes.
......
Sun Mar 14 21:03:15 2004 Owen Taylor <otaylor@redhat.com>
* gtk/gtkpathbar.[ch]: Add _gtk_path_bar_up()/
_gtk_path_bar_down().
* gtk/gtkfilechooserdefault.c: Use _gtk_path_bar_up()/
_gtk_path_bar_down() as bindings for Alt-Up
and new Alt-Down. (Partly based on a patch by
Mark McLoughlin, #136987)
2004-03-14 Federico Mena Quintero <federico@ximian.com> 2004-03-14 Federico Mena Quintero <federico@ximian.com>
Fixes #136185, patch by Morten Welinder, with some changes. Fixes #136185, patch by Morten Welinder, with some changes.
......
...@@ -138,6 +138,7 @@ struct _GtkFileChooserDefault ...@@ -138,6 +138,7 @@ struct _GtkFileChooserDefault
GtkFilePath *current_volume_path; GtkFilePath *current_volume_path;
GtkFilePath *current_folder; GtkFilePath *current_folder;
GtkFilePath *lowest_folder;
GtkFilePath *preview_path; GtkFilePath *preview_path;
char *preview_display_name; char *preview_display_name;
...@@ -168,6 +169,7 @@ struct _GtkFileChooserDefault ...@@ -168,6 +169,7 @@ struct _GtkFileChooserDefault
enum { enum {
LOCATION_POPUP, LOCATION_POPUP,
UP_FOLDER, UP_FOLDER,
DOWN_FOLDER,
HOME_FOLDER, HOME_FOLDER,
LAST_SIGNAL LAST_SIGNAL
}; };
...@@ -306,6 +308,7 @@ static void gtk_file_chooser_default_initial_focus (GtkFileCh ...@@ -306,6 +308,7 @@ static void gtk_file_chooser_default_initial_focus (GtkFileCh
static void location_popup_handler (GtkFileChooserDefault *impl); static void location_popup_handler (GtkFileChooserDefault *impl);
static void up_folder_handler (GtkFileChooserDefault *impl); static void up_folder_handler (GtkFileChooserDefault *impl);
static void down_folder_handler (GtkFileChooserDefault *impl);
static void home_folder_handler (GtkFileChooserDefault *impl); static void home_folder_handler (GtkFileChooserDefault *impl);
static void update_appearance (GtkFileChooserDefault *impl); static void update_appearance (GtkFileChooserDefault *impl);
...@@ -486,6 +489,14 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class) ...@@ -486,6 +489,14 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
NULL, NULL, NULL, NULL,
_gtk_marshal_VOID__VOID, _gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
signals[DOWN_FOLDER] =
_gtk_binding_signal_new ("down-folder",
G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
G_CALLBACK (down_folder_handler),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[HOME_FOLDER] = signals[HOME_FOLDER] =
_gtk_binding_signal_new ("home-folder", _gtk_binding_signal_new ("home-folder",
G_OBJECT_CLASS_TYPE (class), G_OBJECT_CLASS_TYPE (class),
...@@ -511,6 +522,15 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class) ...@@ -511,6 +522,15 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
"up-folder", "up-folder",
0); 0);
gtk_binding_entry_add_signal (binding_set,
GDK_Down, GDK_MOD1_MASK,
"down-folder",
0);
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Down, GDK_MOD1_MASK,
"down-folder",
0);
gtk_binding_entry_add_signal (binding_set, gtk_binding_entry_add_signal (binding_set,
GDK_Home, GDK_MOD1_MASK, GDK_Home, GDK_MOD1_MASK,
"home-folder", "home-folder",
...@@ -4941,24 +4961,14 @@ location_popup_handler (GtkFileChooserDefault *impl) ...@@ -4941,24 +4961,14 @@ location_popup_handler (GtkFileChooserDefault *impl)
static void static void
up_folder_handler (GtkFileChooserDefault *impl) up_folder_handler (GtkFileChooserDefault *impl)
{ {
GtkFilePath *parent_path; _gtk_path_bar_up (GTK_PATH_BAR (impl->browse_path_bar));
GError *error; }
error = NULL; /* Handler for the "down-folder" keybinding signal */
if (gtk_file_system_get_parent (impl->file_system, impl->current_folder, &parent_path, &error)) static void
{ down_folder_handler (GtkFileChooserDefault *impl)
if (parent_path) /* If we were on a root, parent_path will be NULL */ {
{ _gtk_path_bar_down (GTK_PATH_BAR (impl->browse_path_bar));
change_folder_and_display_error (impl, parent_path);
gtk_file_path_free (parent_path);
}
}
else
{
error_dialog (impl,
_("Could not go to the parent folder of %s:\n%s"),
impl->current_folder, error);
}
} }
/* Handler for the "home-folder" keybinding signal */ /* Handler for the "home-folder" keybinding signal */
......
...@@ -1073,3 +1073,57 @@ _gtk_path_bar_set_file_system (GtkPathBar *path_bar, ...@@ -1073,3 +1073,57 @@ _gtk_path_bar_set_file_system (GtkPathBar *path_bar,
path_bar->root_path = gtk_file_system_filename_to_path (path_bar->file_system, "/"); path_bar->root_path = gtk_file_system_filename_to_path (path_bar->file_system, "/");
g_free (desktop); g_free (desktop);
} }
/**
* _gtk_path_bar_up:
* @path_bar: a #GtkPathBar
*
* If the selected button in the pathbar is not the furthest button "up" (in the
* root direction), act as if the user clicked on the next button up.
**/
void
_gtk_path_bar_up (GtkPathBar *path_bar)
{
GList *l;
for (l = path_bar->button_list; l; l = l->next)
{
GtkWidget *button = BUTTON_DATA (l->data)->button;
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
{
if (l->next)
{
GtkWidget *next_button = BUTTON_DATA (l->next->data)->button;
button_clicked_cb (next_button, l->next->data);
}
break;
}
}
}
/**
* _gtk_path_bar_down:
* @path_bar: a #GtkPathBar
*
* If the selected button in the pathbar is not the furthest button "down" (in the
* leaf direction), act as if the user clicked on the next button down.
**/
void
_gtk_path_bar_down (GtkPathBar *path_bar)
{
GList *l;
for (l = path_bar->button_list; l; l = l->next)
{
GtkWidget *button = BUTTON_DATA (l->data)->button;
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
{
if (l->prev)
{
GtkWidget *prev_button = BUTTON_DATA (l->prev->data)->button;
button_clicked_cb (prev_button, l->prev->data);
}
break;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment