Compare commits

...

15 Commits

Author SHA1 Message Date
Federico Mena Quintero
5cf75fc899 Use drag-motion in the arrow buttons to scroll when hovering
Code copied from Nautilus.  I think we'll have to tweak the timers a bit;
they seem a bit short right now.
2013-05-03 11:04:52 -05:00
Federico Mena Quintero
2c59c98b39 Copy style context bits from Nautilus
We were missing GTK_STYLE_CLASS_LINKED for the entire pathbar, and
a 'text-button' style class for each path button.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-05-03 10:16:12 -05:00
Federico Mena Quintero
9f8013ef95 Turn path_bar->priv->foo into priv->foo
Madness lies otherwise.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-29 17:54:15 -05:00
Federico Mena Quintero
ddf41dc993 Turn a gint16 into gint
Because, I mean, really.
2013-04-29 17:32:04 -05:00
Federico Mena Quintero
f5801794dd Remove the 'spacing' field since it is always zero anyway
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-29 17:30:08 -05:00
Federico Mena Quintero
dfb71eadd5 Reorder the toplevel declarations a bit
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-29 17:27:44 -05:00
Federico Mena Quintero
1711baad58 Initialize home/desktop/root in init(), not in set_file_system()
We want to get rid of that gtk_path_bar_set_file_system() API, so we'll
initialize the basic folders at initialization time.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-29 17:12:37 -05:00
Federico Mena Quintero
b8c3395baa Add a 'location' property to the path bar
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-29 14:55:53 -05:00
Federico Mena Quintero
82612ba291 Add gtk_path_bar_get_location()
The old state was stored implicitly in the path bar's buttons.  Now we keep
an additional field in the object's structure that actually contains
the currently-shown location.

Also, with this commit the path bar acquires the capability of showing a NULL path,
i.e. with no buttons at all.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-29 14:46:14 -05:00
Federico Mena Quintero
28a1759230 Rename _gtk_path_bar_set_file to gtk_path_bar_set_location
For consistency with GtkPlacesSidebar, and this is not a private function anymore.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-29 14:22:31 -05:00
Federico Mena Quintero
5a386accc0 Don't use a marshaler function for ::open-location, since we are in 2013
This is not a frequently-emitted, time-critical signal anyway.
2013-04-29 13:13:45 -05:00
Federico Mena Quintero
2fca8c83b4 Rename ::path-clicked to ::open-location for consistency with GtkPlacesSidebar
Eventually this signal will also pass an open-flags argument.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-29 13:13:25 -05:00
Federico Mena Quintero
a7c410c0c2 Add an open-flags property
For consistency with GtkPlacesSidebar, we'll use the exact same property
to set the open flags available.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-29 13:13:13 -05:00
Federico Mena Quintero
3596f5b6c8 Add gtk_path_bar_new()
What do you know, we never had it...

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-24 20:49:10 -04:00
Federico Mena Quintero
b06fa99e99 Make GtkPathBar public
Moved its header file around in Makefile.am, and added it
to gtk.h.
2013-04-24 20:31:05 -04:00
6 changed files with 759 additions and 368 deletions

View File

@@ -295,6 +295,7 @@ gtk_public_h_sources = \
gtkpagesetup.h \
gtkpaned.h \
gtkpapersize.h \
gtkpathbar.h \
gtkplacessidebar.h \
gtkplug.h \
gtkprintcontext.h \
@@ -514,7 +515,6 @@ gtk_private_h_sources = \
gtknumerableiconprivate.h \
gtkorientableprivate.h \
gtkpango.h \
gtkpathbar.h \
gtkpressandholdprivate.h \
gtkprintoperation-private.h \
gtkprintutils.h \

View File

@@ -145,6 +145,7 @@
#include <gtk/gtkpagesetup.h>
#include <gtk/gtkpapersize.h>
#include <gtk/gtkpaned.h>
#include <gtk/gtkpathbar.h>
#include <gtk/gtkplacessidebar.h>
#include <gtk/gtkprintcontext.h>
#include <gtk/gtkprintoperation.h>

View File

@@ -504,11 +504,11 @@ static void list_row_activated (GtkTreeView *tree_view,
GtkTreeViewColumn *column,
GtkFileChooserDefault *impl);
static void path_bar_clicked (GtkPathBar *path_bar,
GFile *file,
GFile *child,
gboolean child_is_hidden,
GtkFileChooserDefault *impl);
static void path_bar_open_location_cb (GtkPathBar *path_bar,
GFile *file,
GFile *child,
gboolean child_is_hidden,
GtkFileChooserDefault *impl);
static void update_cell_renderer_attributes (GtkFileChooserDefault *impl);
@@ -2522,7 +2522,7 @@ put_recent_folder_in_pathbar (GtkFileChooserDefault *impl, GtkTreeIter *iter)
gtk_tree_model_get (GTK_TREE_MODEL (priv->recent_model), iter,
MODEL_COL_FILE, &file,
-1);
_gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), file, FALSE);
gtk_path_bar_set_location (GTK_PATH_BAR (priv->browse_path_bar), file, FALSE);
g_object_unref (file);
}
@@ -4615,7 +4615,7 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
if (! _gtk_file_info_consider_as_directory (info))
goto out;
_gtk_path_bar_set_file (GTK_PATH_BAR (priv->browse_path_bar), data->file, data->keep_trail);
gtk_path_bar_set_location (GTK_PATH_BAR (priv->browse_path_bar), data->file, data->keep_trail);
if (priv->current_folder != data->file)
{
@@ -7014,11 +7014,11 @@ list_row_activated (GtkTreeView *tree_view,
}
static void
path_bar_clicked (GtkPathBar *path_bar,
GFile *file,
GFile *child_file,
gboolean child_is_hidden,
GtkFileChooserDefault *impl)
path_bar_open_location_cb (GtkPathBar *path_bar,
GFile *file,
GFile *child_file,
gboolean child_is_hidden,
GtkFileChooserDefault *impl)
{
if (child_file)
pending_select_files_add (impl, child_file);
@@ -7507,7 +7507,7 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
gtk_widget_class_bind_callback (widget_class, filter_combo_changed);
gtk_widget_class_bind_callback (widget_class, location_button_toggled_cb);
gtk_widget_class_bind_callback (widget_class, new_folder_button_clicked);
gtk_widget_class_bind_callback (widget_class, path_bar_clicked);
gtk_widget_class_bind_callback (widget_class, path_bar_open_location_cb);
gtk_widget_class_bind_callback (widget_class, places_sidebar_open_location_cb);
gtk_widget_class_bind_callback (widget_class, places_sidebar_show_error_message_cb);
}

View File

@@ -79,7 +79,7 @@
<object class="GtkPathBar" id="browse_path_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="path-clicked" handler="path_bar_clicked" after="yes" swapped="no"/>
<signal name="open-location" handler="path_bar_open_location_cb" after="yes" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>

File diff suppressed because it is too large Load Diff

View File

@@ -18,8 +18,13 @@
#ifndef __GTK_PATH_BAR_H__
#define __GTK_PATH_BAR_H__
#include "gtkcontainer.h"
#include "gtkfilesystem.h"
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkcontainer.h>
#include <gtk/gtkfilesystem.h>
#include <gtk/gtkplacessidebar.h>
G_BEGIN_DECLS
@@ -46,18 +51,26 @@ struct _GtkPathBarClass
{
GtkContainerClass parent_class;
void (* path_clicked) (GtkPathBar *path_bar,
GFile *file,
GFile *child_file,
gboolean child_is_hidden);
void (* open_location) (GtkPathBar *path_bar,
GFile *file,
GFile *child_file,
gboolean child_is_hidden);
};
GType gtk_path_bar_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_path_bar_new (void);
GtkPlacesOpenFlags gtk_path_bar_get_open_flags (GtkPathBar *path_bar);
void gtk_path_bar_set_open_flags (GtkPathBar *path_bar, GtkPlacesOpenFlags flags);
void gtk_path_bar_set_location (GtkPathBar *path_bar,
GFile *location,
gboolean keep_trail);
GFile *gtk_path_bar_get_location (GtkPathBar *path_bar);
void _gtk_path_bar_set_file_system (GtkPathBar *path_bar,
GtkFileSystem *file_system);
void _gtk_path_bar_set_file (GtkPathBar *path_bar,
GFile *file,
gboolean keep_trail);
void _gtk_path_bar_up (GtkPathBar *path_bar);
void _gtk_path_bar_down (GtkPathBar *path_bar);