GtkPathBar: Define children with a GtkBuilder template

This commit is contained in:
Tristan Van Berkom 2013-03-30 16:35:39 +09:00
parent 0f3ef7eea6
commit 42f53ab58e
6 changed files with 351 additions and 311 deletions

View File

@ -1111,6 +1111,7 @@ COMPOSITE_TEMPLATES = \
gtklockbutton.ui \
gtkmessagedialog.ui \
gtkpagesetupunixdialog.ui \
gtkpathbar.ui \
gtkprintunixdialog.ui \
gtkrecentchooserdefault.ui \
gtkscalebutton.ui \

View File

@ -26,6 +26,7 @@
<file compressed="true">gtklockbutton.ui</file>
<file compressed="true">gtkmessagedialog.ui</file>
<file compressed="true">gtkpagesetupunixdialog.ui</file>
<file compressed="true">gtkpathbar.ui</file>
<file compressed="true">gtkprintunixdialog.ui</file>
<file compressed="true">gtkrecentchooserdefault.ui</file>
<file compressed="true">gtkscalebutton.ui</file>

File diff suppressed because it is too large Load Diff

View File

@ -23,8 +23,9 @@
G_BEGIN_DECLS
typedef struct _GtkPathBar GtkPathBar;
typedef struct _GtkPathBarClass GtkPathBarClass;
typedef struct _GtkPathBar GtkPathBar;
typedef struct _GtkPathBarClass GtkPathBarClass;
typedef struct _GtkPathBarPrivate GtkPathBarPrivate;
#define GTK_TYPE_PATH_BAR (gtk_path_bar_get_type ())
@ -38,35 +39,7 @@ struct _GtkPathBar
{
GtkContainer parent;
GtkFileSystem *file_system;
GFile *root_file;
GFile *home_file;
GFile *desktop_file;
GCancellable *get_info_cancellable;
GdkPixbuf *root_icon;
GdkPixbuf *home_icon;
GdkPixbuf *desktop_icon;
GdkWindow *event_window;
GList *button_list;
GList *first_scrolled_button;
GList *fake_root;
GtkWidget *up_slider_button;
GtkWidget *down_slider_button;
guint settings_signal_id;
gint icon_size;
gint16 slider_width;
gint16 spacing;
gint16 button_offset;
guint timer;
guint slider_visible : 1;
guint need_timer : 1;
guint ignore_click : 1;
guint scrolling_up : 1;
guint scrolling_down : 1;
GtkPathBarPrivate *priv;
};
struct _GtkPathBarClass

47
gtk/gtkpathbar.ui Normal file
View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk30">
<!-- interface-requires gtk+ 3.10 -->
<object class="GtkButton" id="down_slider_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="focus_on_click">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="down_slider_button-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Down Path</property>
</object>
</child>
<signal name="button-press-event" handler="gtk_path_bar_slider_button_press" swapped="no"/>
<signal name="button-release-event" handler="gtk_path_bar_slider_button_release" swapped="no"/>
<signal name="focus-out-event" handler="gtk_path_bar_slider_down_defocus" swapped="no"/>
<signal name="unmap" handler="on_slider_unmap" swapped="no"/>
<child>
<object class="GtkArrow" id="arrow2">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
<object class="GtkButton" id="up_slider_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="focus_on_click">False</property>
<child internal-child="accessible">
<object class="AtkObject" id="up_slider_button-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Up Path</property>
</object>
</child>
<signal name="button-press-event" handler="gtk_path_bar_slider_button_press" swapped="no"/>
<signal name="button-release-event" handler="gtk_path_bar_slider_button_release" swapped="no"/>
<signal name="focus-out-event" handler="gtk_path_bar_slider_up_defocus" swapped="no"/>
<signal name="unmap" handler="on_slider_unmap" swapped="no"/>
<child>
<object class="GtkArrow" id="arrow1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="arrow_type">left</property>
</object>
</child>
</object>
</interface>

View File

@ -190,6 +190,7 @@ test_file_chooser_widget_basic (void)
{
GtkWidget *widget;
/* This test also tests the internal GtkPathBar widget */
g_test_log_set_fatal_handler (ignore_gvfs_warning, NULL);
widget = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);