Compare commits

...

5 Commits

Author SHA1 Message Date
Federico Mena Quintero
0ba4952eb1 Fix compilation
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-15 18:30:10 -05:00
Tristan Van Berkom
74f5c44efc Load the file chooser's widgets from the .ui file
This is Tristan's *excellent* work, minus the old code for the shortcuts bar - that is all done
in GtkPlacesSidebar now.

The UI gets loaded from a Glade resource; most of the old code to create the UI by hand is gone.

There is still code for save_widgets_create(); this needs to be moved into the UI file, but it
is not a big deal.

gtk_file_chooser_default_init() calls a new post_process_ui() that takes care of all the things
that cannot be done directly in Glade.
2013-04-12 20:42:24 -05:00
Federico Mena Quintero
6fc6e9d8f7 Add .ui file for GtkFileChooserDefault 2013-04-12 19:58:16 -05:00
Federico Mena Quintero
7f1ef86476 For now, add GtkPlacesSidebar to the Glade catalog for private widgets
Although GtkPlacesSidebar is a public widget, we can't have that in Glade's general catalog
as this branch is not merged into GTK+ proper yet.  We'll move the widget to Glade's
catalog when this is done.
2013-04-12 19:57:35 -05:00
Federico Mena Quintero
b7fbed8bc0 INCOMPLETE COMMIT: re-instate Tristan's patch to gtkfilechooserdefault 2013-04-12 12:29:40 -05:00
6 changed files with 814 additions and 650 deletions

View File

@@ -1110,6 +1110,7 @@ COMPOSITE_TEMPLATES = \
gtkcoloreditor.ui \
gtkdialog.ui \
gtkfilechooserbutton.ui \
gtkfilechooserdefault.ui \
gtkfilechooserdialog.ui \
gtkfontbutton.ui \
gtkfontchooserdialog.ui \

View File

@@ -22,6 +22,7 @@
<property id="size" disabled="True"/>
</properties>
</glade-widget-class>
<glade-widget-class name="GtkPlacesSidebar" generic-name="placessidebar" title="Places Sidebar"/>
</glade-widget-classes>
<glade-widget-group name="gtk-private" title="Private GTK+ Classes">
@@ -32,5 +33,6 @@
<glade-widget-class-ref name="GtkScaleButtonScale"/>
<glade-widget-class-ref name="ShortcutsPaneModelFilter"/>
<glade-widget-class-ref name="GtkPrinterOptionWidget"/>
<glade-widget-class-ref name="GtkPlacesSidebar"/>
</glade-widget-group>
</glade-catalog>

View File

@@ -19,6 +19,7 @@
<file compressed="true">gtkcoloreditor.ui</file>
<file compressed="true">gtkdialog.ui</file>
<file compressed="true">gtkfilechooserbutton.ui</file>
<file compressed="true">gtkfilechooserdefault.ui</file>
<file compressed="true">gtkfilechooserdialog.ui</file>
<file compressed="true">gtkfontbutton.ui</file>
<file compressed="true">gtkfontchooserdialog.ui</file>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,415 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk30">
<!-- interface-requires gtk+ 3.10 -->
<!-- interface-requires gtkprivate 3.10 -->
<object class="GtkImage" id="location_button_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-edit</property>
</object>
<template class="GtkFileChooserDefault" parent="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="browse_widgets_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="browse_header_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="location_entry_box">
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="location_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Location:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="browse_path_bar_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkToggleButton" id="location_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Type a file name</property>
<property name="image">location_button_image</property>
<child internal-child="accessible">
<object class="AtkObject" id="location_button-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Type a file name</property>
</object>
</child>
<signal name="toggled" handler="location_button_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<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"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkInfoBar" id="browse_select_a_folder_info_bar">
<property name="app_paintable">True</property>
<property name="can_focus">False</property>
<child internal-child="content_area">
<object class="GtkBox" id="infobar-content_area1">
<property name="can_focus">False</property>
<property name="border_width">8</property>
<property name="spacing">16</property>
<child>
<object class="GtkImage" id="browse_select_a_folder_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-directory</property>
<property name="icon_size">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="browse_select_a_folder_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">message</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="infobar-action_area1">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkImage" id="browse_special_mode_icon">
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="browse_special_mode_label">
<property name="can_focus">False</property>
<property name="label">special</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browse_new_folder_button">
<property name="label" translatable="yes">Create Fo_lder</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="new_folder_button_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">5</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkPaned" id="browse_widgets_hpaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkPlacesSidebar" id="places_sidebar">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<signal name="open-location" handler="places_sidebar_open_location_cb" swapped="no"/>
<signal name="show-error-message" handler="places_sidebar_show_error_message_cb" swapped="no"/>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">False</property>
</packing>
</child>
<child>
<object class="GtkBox" id="browse_files_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="list_and_preview_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkScrolledWindow" id="browse_files_swin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vscrollbar_policy">always</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="browse_files_tree_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="rules_hint">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="browse_files_tree_view-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">Files</property>
</object>
</child>
<signal name="button-press-event" handler="list_button_press_event_cb" swapped="no"/>
<signal name="drag-data-received" handler="file_list_drag_data_received_cb" swapped="no"/>
<signal name="drag-drop" handler="file_list_drag_drop_cb" swapped="no"/>
<signal name="drag-motion" handler="file_list_drag_motion_cb" swapped="no"/>
<signal name="key-press-event" handler="browse_files_key_press_event_cb" swapped="no"/>
<signal name="popup-menu" handler="list_popup_menu_cb" swapped="no"/>
<signal name="query-tooltip" handler="file_list_query_tooltip_cb" swapped="no"/>
<signal name="row-activated" handler="list_row_activated" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection2">
<signal name="changed" handler="list_selection_changed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="list_name_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Name</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererPixbuf" id="list_pixbuf_renderer"/>
</child>
<child>
<object class="GtkCellRendererText" id="list_name_renderer">
<property name="ellipsize">end</property>
<signal name="edited" handler="renderer_edited_cb" swapped="no"/>
<signal name="editing-canceled" handler="renderer_editing_canceled_cb" swapped="no"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="list_size_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Size</property>
<child>
<object class="GtkCellRendererText" id="list_size_renderer">
<property name="alignment">right</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="list_mtime_column">
<property name="resizable">True</property>
<property name="title" translatable="yes">Modifed</property>
<child>
<object class="GtkCellRendererText" id="list_mtime_renderer"/>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="preview_box">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="filter_combo_hbox">
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkComboBoxText" id="filter_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Select which types of files are shown</property>
<property name="focus_on_click">False</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<signal name="changed" handler="filter_combo_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="extra_align">
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</template>
<object class="GtkSizeGroup" id="browse_path_bar_size_group">
<property name="mode">vertical</property>
<widgets>
<widget name="location_button"/>
<widget name="browse_path_bar"/>
<widget name="browse_select_a_folder_info_bar"/>
<widget name="browse_special_mode_icon"/>
<widget name="browse_special_mode_label"/>
<widget name="browse_new_folder_button"/>
</widgets>
</object>
</interface>

View File

@@ -37,6 +37,9 @@ test_dialog_basic (void)
dialog = gtk_dialog_new();
g_assert (GTK_IS_DIALOG (dialog));
g_assert (gtk_dialog_get_action_area (GTK_DIALOG (dialog)) != NULL);
g_assert (gtk_dialog_get_content_area (GTK_DIALOG (dialog)) != NULL);
gtk_widget_destroy (dialog);
}
@@ -158,6 +161,13 @@ test_app_chooser_dialog_basic (void)
widget = gtk_app_chooser_dialog_new_for_content_type (NULL, 0, "text/plain");
g_assert (GTK_IS_APP_CHOOSER_DIALOG (widget));
/* GtkAppChooserDialog bug, if destroyed before spinning
* the main context then app_chooser_online_get_default_ready_cb()
* will be eventually called and segfault.
*/
g_timeout_add (500, main_loop_quit_cb, NULL);
gtk_main();
gtk_widget_destroy (widget);
}