[gedit/wip/browser-menu] filebrowser: port to GMenu and use a Template for the UI
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/browser-menu] filebrowser: port to GMenu and use a Template for the UI
- Date: Wed, 17 Apr 2013 12:29:53 +0000 (UTC)
commit cc137d7320d810921e284175472991c0c5fcd458
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Apr 16 21:34:12 2013 +0200
filebrowser: port to GMenu and use a Template for the UI
plugins/filebrowser/gedit-file-browser-menus.ui | 83 ++
plugins/filebrowser/gedit-file-browser-messages.c | 22 +-
plugins/filebrowser/gedit-file-browser-plugin.c | 128 +---
plugins/filebrowser/gedit-file-browser-plugin.h | 4 +-
plugins/filebrowser/gedit-file-browser-store.c | 15 +-
.../filebrowser/gedit-file-browser-widget-ui.xml | 56 --
plugins/filebrowser/gedit-file-browser-widget.c | 834 +++++++++------------
plugins/filebrowser/gedit-file-browser-widget.h | 5 +-
plugins/filebrowser/gedit-file-browser-widget.ui | 275 +++++++
.../filebrowser/gedit-file-browser.gresource.xml | 3 +-
10 files changed, 734 insertions(+), 691 deletions(-)
---
diff --git a/plugins/filebrowser/gedit-file-browser-menus.ui b/plugins/filebrowser/gedit-file-browser-menus.ui
new file mode 100644
index 0000000..376d936
--- /dev/null
+++ b/plugins/filebrowser/gedit-file-browser-menus.ui
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <menu id="dir-menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Open</attribute>
+ <attribute name="action">open</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Set Root to Active Document</attribute>
+ <attribute name="action">set_active_root</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_New Folder</attribute>
+ <attribute name="action">new_folder</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">New F_ile</attribute>
+ <attribute name="action">new_file</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Rename...</attribute>
+ <attribute name="action">rename</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Move to Trash</attribute>
+ <attribute name="action">move_to_trash</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Delete</attribute>
+ <attribute name="action">delete</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Re_fresh View</attribute>
+ <attribute name="action">refresh_view</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_View Folder</attribute>
+ <attribute name="action">view_folder</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Open in Terminal</attribute>
+ <attribute name="action">open_in_terminal</attribute>
+ </item>
+ </section>
+ <submenu>
+ <attribute name="label" translatable="yes">_Filter</attribute>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Show _Hidden</attribute>
+ <attribute name="action">show_hidden</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Show _Binary</attribute>
+ <attribute name="action">show_binary</attribute>
+ </item>
+ </section>
+ </submenu>
+ </menu>
+ <menu id="bookmarks-menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Set Root to Active Document</attribute>
+ <attribute name="action">set_active_root</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_View Folder</attribute>
+ <attribute name="action">bookmark_open</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
diff --git a/plugins/filebrowser/gedit-file-browser-messages.c
b/plugins/filebrowser/gedit-file-browser-messages.c
index d149b5a..d21d201 100644
--- a/plugins/filebrowser/gedit-file-browser-messages.c
+++ b/plugins/filebrowser/gedit-file-browser-messages.c
@@ -66,7 +66,7 @@ window_data_new (GeditWindow *window,
GeditFileBrowserWidget *widget)
{
WindowData *data = g_slice_new (WindowData);
- GtkUIManager *manager;
+ //GtkUIManager *manager;
GList *groups;
data->bus = gedit_window_get_message_bus (window);
@@ -81,13 +81,13 @@ window_data_new (GeditWindow *window,
(GDestroyNotify)g_free,
NULL);
- manager = gedit_file_browser_widget_get_ui_manager (widget);
+ /*manager = gedit_file_browser_widget_get_ui_manager (widget);
data->merge_ids = NULL;
data->merged_actions = gtk_action_group_new ("MessageMergedActions");
groups = gtk_ui_manager_get_action_groups (manager);
- gtk_ui_manager_insert_action_group (manager, data->merged_actions, g_list_length (groups));
+ gtk_ui_manager_insert_action_group (manager, data->merged_actions, g_list_length (groups));*/
g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, data);
@@ -104,20 +104,20 @@ static void
window_data_free (GeditWindow *window)
{
WindowData *data = get_window_data (window);
- GtkUIManager *manager;
+ //GtkUIManager *manager;
GList *item;
g_hash_table_destroy (data->row_tracking);
g_hash_table_destroy (data->filters);
- manager = gedit_file_browser_widget_get_ui_manager (data->widget);
+ /*manager = gedit_file_browser_widget_get_ui_manager (data->widget);
gtk_ui_manager_remove_action_group (manager, data->merged_actions);
for (item = data->merge_ids; item; item = item->next)
gtk_ui_manager_remove_ui (manager, GPOINTER_TO_INT (item->data));
g_list_free (data->merge_ids);
- g_object_unref (data->merged_actions);
+ g_object_unref (data->merged_actions);*/
g_slice_free (WindowData, data);
@@ -587,7 +587,7 @@ message_add_context_item_cb (GeditMessageBus *bus,
GeditMessage *message,
WindowData *data)
{
- GtkAction *action = NULL;
+ /*GtkAction *action = NULL;
gchar *path = NULL;
gchar *name;
GtkUIManager *manager;
@@ -632,7 +632,7 @@ message_add_context_item_cb (GeditMessageBus *bus,
g_object_unref (action);
g_free (path);
- g_free (name);
+ g_free (name);*/
}
static void
@@ -641,17 +641,17 @@ message_remove_context_item_cb (GeditMessageBus *bus,
WindowData *data)
{
guint merge_id = 0;
- GtkUIManager *manager;
+ //GtkUIManager *manager;
g_object_get (message, "id", &merge_id, NULL);
if (merge_id == 0)
return;
- manager = gedit_file_browser_widget_get_ui_manager (data->widget);
+ /*manager = gedit_file_browser_widget_get_ui_manager (data->widget);
data->merge_ids = g_list_remove (data->merge_ids, GINT_TO_POINTER (merge_id));
- gtk_ui_manager_remove_ui (manager, merge_id);
+ gtk_ui_manager_remove_ui (manager, merge_id);*/
}
static void
diff --git a/plugins/filebrowser/gedit-file-browser-plugin.c b/plugins/filebrowser/gedit-file-browser-plugin.c
index 1aa68fc..30fa726 100644
--- a/plugins/filebrowser/gedit-file-browser-plugin.c
+++ b/plugins/filebrowser/gedit-file-browser-plugin.c
@@ -69,9 +69,6 @@ struct _GeditFileBrowserPluginPrivate
GeditWindow *window;
GeditFileBrowserWidget *tree_widget;
- gulong merge_id;
- GtkActionGroup *action_group;
- GtkActionGroup *single_selection_action_group;
gboolean auto_root;
gulong end_loading_handle;
gboolean confirm_trash;
@@ -119,7 +116,7 @@ static gboolean on_confirm_no_trash_cb (GeditFileBrowserWidget *widget,
G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditFileBrowserPlugin,
gedit_file_browser_plugin,
- PEAS_TYPE_EXTENSION_BASE,
+ G_TYPE_OBJECT,
0,
G_IMPLEMENT_INTERFACE_DYNAMIC (GEDIT_TYPE_WINDOW_ACTIVATABLE,
gedit_window_activatable_iface_init) \
@@ -159,8 +156,6 @@ settings_try_new (const gchar *schema)
static void
gedit_file_browser_plugin_init (GeditFileBrowserPlugin *plugin)
{
-
-
plugin->priv = GEDIT_FILE_BROWSER_PLUGIN_GET_PRIVATE (plugin);
plugin->priv->settings = g_settings_new (FILEBROWSER_BASE_SETTINGS);
@@ -256,9 +251,9 @@ prepare_auto_root (GeditFileBrowserPlugin *plugin)
}
priv->end_loading_handle = g_signal_connect (store,
- "end-loading",
- G_CALLBACK (on_end_loading_cb),
- plugin);
+ "end-loading",
+ G_CALLBACK (on_end_loading_cb),
+ plugin);
}
static void
@@ -413,14 +408,14 @@ set_root_from_doc (GeditFileBrowserPlugin *plugin,
g_object_unref (file);
}
-
+/*
static void
on_action_set_active_root (GtkAction *action,
GeditFileBrowserPlugin *plugin)
{
set_root_from_doc (plugin,
gedit_window_get_active_document (plugin->priv->window));
-}
+}*/
static gchar *
get_terminal (GeditFileBrowserPlugin *plugin)
@@ -492,7 +487,7 @@ on_action_open_terminal (GtkAction *action,
g_object_unref (file);
}
}
-
+/*
static void
on_selection_changed_cb (GtkTreeSelection *selection,
GeditFileBrowserPlugin *plugin)
@@ -534,95 +529,7 @@ on_selection_changed_cb (GtkTreeSelection *selection,
gtk_action_group_get_action (priv->single_selection_action_group,
"OpenTerminal"),
sensitive);
-}
-
-#define POPUP_UI "" \
-"<ui>" \
-" <popup name=\"FilePopup\">" \
-" <placeholder name=\"FilePopup_Opt1\">" \
-" <menuitem action=\"SetActiveRoot\"/>" \
-" </placeholder>" \
-" <placeholder name=\"FilePopup_Opt4\">" \
-" <menuitem action=\"OpenTerminal\"/>" \
-" </placeholder>" \
-" </popup>" \
-" <popup name=\"BookmarkPopup\">" \
-" <placeholder name=\"BookmarkPopup_Opt1\">" \
-" <menuitem action=\"SetActiveRoot\"/>" \
-" </placeholder>" \
-" </popup>" \
-"</ui>"
-
-static GtkActionEntry extra_actions[] =
-{
- {"SetActiveRoot", GTK_STOCK_JUMP_TO, N_("_Set Root to Active Document"),
- NULL,
- N_("Set the root to the active document location"),
- G_CALLBACK (on_action_set_active_root)}
-};
-
-static GtkActionEntry extra_single_selection_actions[] = {
- {"OpenTerminal", "utilities-terminal", N_("_Open in Terminal"),
- NULL,
- N_("Open a terminal at the currently opened directory"),
- G_CALLBACK (on_action_open_terminal)}
-};
-
-static void
-add_popup_ui (GeditFileBrowserPlugin *plugin)
-{
- GeditFileBrowserPluginPrivate *priv = plugin->priv;
- GtkUIManager *manager;
- GtkActionGroup *action_group;
- GError *error = NULL;
-
- manager = gedit_file_browser_widget_get_ui_manager (priv->tree_widget);
-
- action_group = gtk_action_group_new ("FileBrowserPluginExtra");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- extra_actions,
- G_N_ELEMENTS (extra_actions),
- plugin);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- priv->action_group = action_group;
-
- action_group = gtk_action_group_new ("FileBrowserPluginSingleSelectionExtra");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- extra_single_selection_actions,
- G_N_ELEMENTS (extra_single_selection_actions),
- plugin);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- priv->single_selection_action_group = action_group;
-
- priv->merge_id = gtk_ui_manager_add_ui_from_string (manager,
- POPUP_UI,
- -1,
- &error);
-
- if (priv->merge_id == 0)
- {
- g_warning("Unable to merge UI: %s", error->message);
- g_error_free(error);
- }
-}
-
-static void
-remove_popup_ui (GeditFileBrowserPlugin *plugin)
-{
- GeditFileBrowserPluginPrivate *priv = plugin->priv;
- GtkUIManager *manager;
-
- manager = gedit_file_browser_widget_get_ui_manager (priv->tree_widget);
- gtk_ui_manager_remove_ui (manager, priv->merge_id);
-
- gtk_ui_manager_remove_action_group (manager, priv->action_group);
- g_object_unref (priv->action_group);
-
- gtk_ui_manager_remove_action_group (manager, priv->single_selection_action_group);
- g_object_unref (priv->single_selection_action_group);
-}
+}*/
static void
gedit_file_browser_plugin_update_state (GeditWindowActivatable *activatable)
@@ -631,10 +538,8 @@ gedit_file_browser_plugin_update_state (GeditWindowActivatable *activatable)
GeditDocument *doc;
doc = gedit_window_get_active_document (priv->window);
-
- gtk_action_set_sensitive (gtk_action_group_get_action (priv->action_group,
- "SetActiveRoot"),
- doc != NULL && !gedit_document_is_untitled (doc));
+ /*gedit_file_browser_widget_set_active_root_enabled (priv->tree_widget,
+ doc != NULL && !gedit_document_is_untitled
(doc));*/
}
static void
@@ -646,13 +551,10 @@ gedit_file_browser_plugin_activate (GeditWindowActivatable *activatable)
GtkWidget *image;
GdkPixbuf *pixbuf;
GeditFileBrowserStore *store;
- gchar *data_dir;
priv = plugin->priv;
- data_dir = peas_extension_base_get_data_dir (PEAS_EXTENSION_BASE (activatable));
- priv->tree_widget = GEDIT_FILE_BROWSER_WIDGET (gedit_file_browser_widget_new (data_dir));
- g_free (data_dir);
+ priv->tree_widget = GEDIT_FILE_BROWSER_WIDGET (gedit_file_browser_widget_new ());
g_signal_connect (priv->tree_widget,
"location-activated",
@@ -671,12 +573,12 @@ gedit_file_browser_plugin_activate (GeditWindowActivatable *activatable)
G_CALLBACK (on_confirm_no_trash_cb),
priv->window);
- g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW
+ /*g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW
(gedit_file_browser_widget_get_browser_view
(priv->tree_widget))),
"changed",
G_CALLBACK (on_selection_changed_cb),
- plugin);
+ plugin);*/
g_settings_bind (priv->settings,
FILEBROWSER_FILTER_PATTERN,
@@ -706,8 +608,6 @@ gedit_file_browser_plugin_activate (GeditWindowActivatable *activatable)
image);
gtk_widget_show (GTK_WIDGET (priv->tree_widget));
- add_popup_ui (plugin);
-
/* Install nautilus preferences */
install_nautilus_prefs (plugin);
@@ -780,8 +680,6 @@ gedit_file_browser_plugin_deactivate (GeditWindowActivatable *activatable)
priv->confirm_trash_handle);
}
- remove_popup_ui (plugin);
-
panel = gedit_window_get_side_panel (priv->window);
gedit_panel_remove_item (panel, GTK_WIDGET (priv->tree_widget));
}
diff --git a/plugins/filebrowser/gedit-file-browser-plugin.h b/plugins/filebrowser/gedit-file-browser-plugin.h
index b78adfc..4d63f64 100644
--- a/plugins/filebrowser/gedit-file-browser-plugin.h
+++ b/plugins/filebrowser/gedit-file-browser-plugin.h
@@ -45,7 +45,7 @@ typedef struct _GeditFileBrowserPluginClass GeditFileBrowserPluginClass;
struct _GeditFileBrowserPlugin
{
- PeasExtensionBase parent_instance;
+ GObject parent_instance;
/* < private > */
GeditFileBrowserPluginPrivate *priv;
@@ -53,7 +53,7 @@ struct _GeditFileBrowserPlugin
struct _GeditFileBrowserPluginClass
{
- PeasExtensionBaseClass parent_class;
+ GObjectClass parent_class;
};
/*
diff --git a/plugins/filebrowser/gedit-file-browser-store.c b/plugins/filebrowser/gedit-file-browser-store.c
index abf8589..5e91e2a 100644
--- a/plugins/filebrowser/gedit-file-browser-store.c
+++ b/plugins/filebrowser/gedit-file-browser-store.c
@@ -313,6 +313,9 @@ gedit_file_browser_store_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_ROOT:
+ gedit_file_browser_store_set_root (obj, G_FILE (g_value_get_object (value)));
+ break;
case PROP_FILTER_MODE:
gedit_file_browser_store_set_filter_mode (obj,
g_value_get_flags (value));
@@ -338,7 +341,7 @@ gedit_file_browser_store_class_init (GeditFileBrowserStoreClass *klass)
"Root",
"The root location",
G_TYPE_FILE,
- G_PARAM_READABLE));
+ G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_VIRTUAL_ROOT,
g_param_spec_object ("virtual-root",
@@ -2968,13 +2971,9 @@ model_mount_root (GeditFileBrowserStore *model,
GeditFileBrowserStore *
gedit_file_browser_store_new (GFile *root)
{
- GeditFileBrowserStore *obj =
- GEDIT_FILE_BROWSER_STORE (g_object_new
- (GEDIT_TYPE_FILE_BROWSER_STORE,
- NULL));
-
- gedit_file_browser_store_set_root (obj, root);
- return obj;
+ return GEDIT_FILE_BROWSER_STORE (g_object_new (GEDIT_TYPE_FILE_BROWSER_STORE,
+ "root", root,
+ NULL));
}
void
diff --git a/plugins/filebrowser/gedit-file-browser-widget.c b/plugins/filebrowser/gedit-file-browser-widget.c
index b5d643f..c4b02f8 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.c
+++ b/plugins/filebrowser/gedit-file-browser-widget.c
@@ -120,19 +120,16 @@ struct _GeditFileBrowserWidgetPrivate
GHashTable *bookmarks_hash;
+ GMenuModel *dir_menu;
+ GMenuModel *bookmarks_menu;
+
GtkWidget *combo;
GtkTreeStore *combo_model;
+ GtkCellRenderer *indent_renderer;
GtkWidget *filter_entry;
- GtkUIManager *manager;
- GtkActionGroup *action_group;
- GtkActionGroup *action_group_selection;
- GtkActionGroup *action_group_file_selection;
- GtkActionGroup *action_group_single_selection;
- GtkActionGroup *action_group_single_most_selection;
- GtkActionGroup *action_group_sensitive;
- GtkActionGroup *bookmark_action_group;
+ GSimpleActionGroup *action_group;
GSList *signal_pool;
@@ -197,36 +194,50 @@ static void on_bookmarks_row_deleted (GtkTreeModel *model,
static void on_filter_mode_changed (GeditFileBrowserStore *model,
GParamSpec *param,
GeditFileBrowserWidget *obj);
-static void on_action_directory_previous (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_directory_next (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_directory_up (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_directory_new (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_file_open (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_file_new (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_file_rename (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_file_delete (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_file_move_to_trash (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_directory_refresh (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_directory_open (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_filter_hidden (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_filter_binary (GtkAction *action,
- GeditFileBrowserWidget *obj);
-static void on_action_bookmark_open (GtkAction *action,
- GeditFileBrowserWidget *obj);
-
-G_DEFINE_DYNAMIC_TYPE (GeditFileBrowserWidget, gedit_file_browser_widget, GTK_TYPE_BOX)
+static void previous_location_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void next_location_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void up_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void new_folder_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void open_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void new_file_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void rename_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void delete_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void move_to_trash_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void refresh_view_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void view_folder_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void show_hidden_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void show_binary_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+static void bookmark_open_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
+
+G_DEFINE_DYNAMIC_TYPE (GeditFileBrowserWidget, gedit_file_browser_widget, GTK_TYPE_GRID)
static void
free_name_icon (gpointer data)
@@ -333,23 +344,18 @@ static void
gedit_file_browser_widget_finalize (GObject *object)
{
GeditFileBrowserWidget *obj = GEDIT_FILE_BROWSER_WIDGET (object);
- GList *loc;
remove_path_items (obj);
gedit_file_browser_store_set_filter_func (obj->priv->file_store,
NULL, NULL);
- g_object_unref (obj->priv->manager);
g_object_unref (obj->priv->file_store);
g_object_unref (obj->priv->bookmarks_store);
g_object_unref (obj->priv->combo_model);
- g_slist_free_full (obj->priv->filter_funcs, (GDestroyNotify) filter_func_free);
-
- for (loc = obj->priv->locations; loc; loc = loc->next)
- location_free ((Location *) (loc->data));
+ g_slist_free_full (obj->priv->filter_funcs, (GDestroyNotify)filter_func_free);
- g_list_free (obj->priv->locations);
+ g_list_free_full (obj->priv->locations, (GDestroyNotify)location_free);
g_hash_table_destroy (obj->priv->bookmarks_hash);
@@ -360,6 +366,9 @@ gedit_file_browser_widget_finalize (GObject *object)
g_free (obj->priv->filter_pattern_str);
+ g_clear_object (&obj->priv->dir_menu);
+ g_clear_object (&obj->priv->bookmarks_menu);
+
G_OBJECT_CLASS (gedit_file_browser_widget_parent_class)->finalize (object);
}
@@ -412,6 +421,7 @@ static void
gedit_file_browser_widget_class_init (GeditFileBrowserWidgetClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = gedit_file_browser_widget_finalize;
@@ -473,6 +483,14 @@ gedit_file_browser_widget_class_init (GeditFileBrowserWidgetClass *klass)
1,
G_TYPE_POINTER);
+ /* Bind class to template */
+ gtk_widget_class_set_template_from_resource (widget_class,
+
"/org/gnome/gedit/plugins/file-browser/ui/gedit-file-browser-widget.ui");
+ gtk_widget_class_bind_child (widget_class, GeditFileBrowserWidgetPrivate, combo);
+ gtk_widget_class_bind_child (widget_class, GeditFileBrowserWidgetPrivate, indent_renderer);
+ gtk_widget_class_bind_child (widget_class, GeditFileBrowserWidgetPrivate, treeview);
+ gtk_widget_class_bind_child (widget_class, GeditFileBrowserWidgetPrivate, filter_entry);
+
g_type_class_add_private (object_class,
sizeof (GeditFileBrowserWidgetPrivate));
}
@@ -580,8 +598,8 @@ insert_path_item (GeditFileBrowserWidget *obj,
COLUMN_ICON, icon,
COLUMN_NAME, unescape,
COLUMN_FILE, file,
- COLUMN_ID, PATH_ID,
- -1);
+ COLUMN_ID, PATH_ID,
+ -1);
if (icon)
g_object_unref (icon);
@@ -761,7 +779,7 @@ indent_cell_data_func (GtkCellLayout *cell_layout,
}
else
{
- indent = g_strnfill (num *2, ' ');
+ indent = g_strnfill (num * 2, ' ');
g_object_set (cell, "text", indent, NULL);
g_free (indent);
@@ -769,258 +787,16 @@ indent_cell_data_func (GtkCellLayout *cell_layout,
}
static void
-create_combo (GeditFileBrowserWidget *obj)
-{
- GtkCellRenderer *renderer;
-
- obj->priv->combo_model = gtk_tree_store_new (N_COLUMNS,
- G_TYPE_UINT,
- GDK_TYPE_PIXBUF,
- G_TYPE_STRING,
- G_TYPE_FILE,
- G_TYPE_UINT);
- obj->priv->combo =
- gtk_combo_box_new_with_model (GTK_TREE_MODEL
- (obj->priv->combo_model));
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (obj->priv->combo),
- renderer, FALSE);
- gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT
- (obj->priv->combo), renderer,
- indent_cell_data_func, obj, NULL);
-
-
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (obj->priv->combo),
- renderer, FALSE);
- gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (obj->priv->combo),
- renderer, "pixbuf", COLUMN_ICON);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (obj->priv->combo),
- renderer, TRUE);
- gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (obj->priv->combo),
- renderer, "text", COLUMN_NAME);
-
- g_object_set (renderer, "ellipsize-set", TRUE,
- "ellipsize", PANGO_ELLIPSIZE_END, NULL);
-
- gtk_box_pack_start (GTK_BOX (obj), GTK_WIDGET (obj->priv->combo),
- FALSE, FALSE, 0);
-
- fill_combo_model (obj);
- g_signal_connect (obj->priv->combo, "changed",
- G_CALLBACK (on_combo_changed), obj);
-
- gtk_widget_show (obj->priv->combo);
-}
-
-static GtkActionEntry toplevel_actions[] =
-{
- {"FilterMenuAction", NULL, N_("_Filter")}
-};
-
-static const GtkActionEntry tree_actions_selection[] =
-{
- {"FileMoveToTrash", "gnome-stock-trash", N_("_Move to Trash"), NULL,
- N_("Move selected file or folder to trash"),
- G_CALLBACK (on_action_file_move_to_trash)},
- {"FileDelete", GTK_STOCK_DELETE, N_("_Delete"), NULL,
- N_("Delete selected file or folder"),
- G_CALLBACK (on_action_file_delete)}
-};
-
-static const GtkActionEntry tree_actions_file_selection[] =
-{
- {"FileOpen", GTK_STOCK_OPEN, NULL, NULL,
- N_("Open selected file"),
- G_CALLBACK (on_action_file_open)}
-};
-
-static const GtkActionEntry tree_actions[] =
-{
- {"DirectoryUp", GTK_STOCK_GO_UP, N_("Up"), NULL,
- N_("Open the parent folder"), G_CALLBACK (on_action_directory_up)}
-};
-
-static const GtkActionEntry tree_actions_single_most_selection[] =
-{
- {"DirectoryNew", GTK_STOCK_ADD, N_("_New Folder"), NULL,
- N_("Add new empty folder"),
- G_CALLBACK (on_action_directory_new)},
- {"FileNew", GTK_STOCK_NEW, N_("New F_ile"), NULL,
- N_("Add new empty file"), G_CALLBACK (on_action_file_new)}
-};
-
-static const GtkActionEntry tree_actions_single_selection[] =
-{
- {"FileRename", NULL, N_("_Rename..."), NULL,
- N_("Rename selected file or folder"),
- G_CALLBACK (on_action_file_rename)}
-};
-
-static const GtkActionEntry tree_actions_sensitive[] =
-{
- {"DirectoryPrevious", GTK_STOCK_GO_BACK, N_("_Previous Location"),
- NULL,
- N_("Go to the previous visited location"),
- G_CALLBACK (on_action_directory_previous)},
- {"DirectoryNext", GTK_STOCK_GO_FORWARD, N_("_Next Location"), NULL,
- N_("Go to the next visited location"), G_CALLBACK (on_action_directory_next)},
- {"DirectoryRefresh", GTK_STOCK_REFRESH, N_("Re_fresh View"), NULL,
- N_("Refresh the view"), G_CALLBACK (on_action_directory_refresh)},
- {"DirectoryOpen", GTK_STOCK_OPEN, N_("_View Folder"), NULL,
- N_("View folder in file manager"),
- G_CALLBACK (on_action_directory_open)}
-};
-
-static const GtkToggleActionEntry tree_actions_toggle[] =
-{
- {"FilterHidden", GTK_STOCK_DIALOG_AUTHENTICATION,
- N_("Show _Hidden"), NULL,
- N_("Show hidden files and folders"),
- G_CALLBACK (on_action_filter_hidden), FALSE},
- {"FilterBinary", NULL, N_("Show _Binary"), NULL,
- N_("Show binary files"), G_CALLBACK (on_action_filter_binary),
- FALSE}
-};
-
-static const GtkActionEntry bookmark_actions[] =
-{
- {"BookmarkOpen", GTK_STOCK_OPEN, N_("_View Folder"), NULL,
- N_("View folder in file manager"), G_CALLBACK (on_action_bookmark_open)}
-};
-
-static void
-create_toolbar (GeditFileBrowserWidget *obj,
- const gchar *data_dir)
-{
- GtkUIManager *manager;
- GError *error = NULL;
- GtkActionGroup *action_group;
- GtkWidget *toolbar;
- GtkAction *action;
-
- manager = gtk_ui_manager_new ();
- obj->priv->manager = manager;
-
- gtk_ui_manager_add_ui_from_resource (manager,
-
"/org/gnome/gedit/plugins/file-browser/ui/gedit-file-browser-widget-ui.xml",
- &error);
- if (error != NULL)
- {
- g_warning ("Could not add ui definition: %s", error->message);
- g_error_free (error);
- return;
- }
-
- action_group = gtk_action_group_new ("FileBrowserWidgetActionGroupToplevel");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- toplevel_actions,
- G_N_ELEMENTS (toplevel_actions),
- obj);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
-
- action_group = gtk_action_group_new ("FileBrowserWidgetActionGroup");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- tree_actions,
- G_N_ELEMENTS (tree_actions),
- obj);
- gtk_action_group_add_toggle_actions (action_group,
- tree_actions_toggle,
- G_N_ELEMENTS (tree_actions_toggle),
- obj);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- obj->priv->action_group = action_group;
-
- action_group = gtk_action_group_new ("FileBrowserWidgetSelectionActionGroup");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- tree_actions_selection,
- G_N_ELEMENTS (tree_actions_selection),
- obj);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- obj->priv->action_group_selection = action_group;
-
- action_group = gtk_action_group_new ("FileBrowserWidgetFileSelectionActionGroup");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- tree_actions_file_selection,
- G_N_ELEMENTS (tree_actions_file_selection),
- obj);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- obj->priv->action_group_file_selection = action_group;
-
- action_group = gtk_action_group_new ("FileBrowserWidgetSingleSelectionActionGroup");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- tree_actions_single_selection,
- G_N_ELEMENTS (tree_actions_single_selection),
- obj);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- obj->priv->action_group_single_selection = action_group;
-
- action_group = gtk_action_group_new ("FileBrowserWidgetSingleMostSelectionActionGroup");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- tree_actions_single_most_selection,
- G_N_ELEMENTS (tree_actions_single_most_selection),
- obj);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- obj->priv->action_group_single_most_selection = action_group;
-
- action_group = gtk_action_group_new ("FileBrowserWidgetSensitiveActionGroup");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- tree_actions_sensitive,
- G_N_ELEMENTS (tree_actions_sensitive),
- obj);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- obj->priv->action_group_sensitive = action_group;
-
- action_group = gtk_action_group_new ("FileBrowserWidgetBookmarkActionGroup");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group,
- bookmark_actions,
- G_N_ELEMENTS (bookmark_actions),
- obj);
- gtk_ui_manager_insert_action_group (manager, action_group, 0);
- obj->priv->bookmark_action_group = action_group;
-
- action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
- "DirectoryPrevious");
- gtk_action_set_sensitive (action, FALSE);
-
- action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
- "DirectoryNext");
- gtk_action_set_sensitive (action, FALSE);
-
- toolbar = gtk_ui_manager_get_widget (manager, "/ToolBar");
- gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
- gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
- gtk_box_pack_start (GTK_BOX (obj), toolbar, FALSE, FALSE, 0);
- gtk_widget_show (toolbar);
-
- set_enable_delete (obj, obj->priv->enable_delete);
-}
-
-static void
set_enable_delete (GeditFileBrowserWidget *obj,
gboolean enable)
{
- GtkAction *action;
+ GAction *action;
obj->priv->enable_delete = enable;
- if (obj->priv->action_group_selection == NULL)
- return;
-
- action = gtk_action_group_get_action (obj->priv->action_group_selection,
- "FileDelete");
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "delete");
- g_object_set (action, "visible", enable, "sensitive", enable, NULL);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enable);
}
static gboolean
@@ -1127,15 +903,81 @@ on_end_loading (GeditFileBrowserStore *model,
gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (obj)), NULL);
}
+static GActionEntry browser_entries[] = {
+ { "open", open_activated, NULL, NULL, NULL },
+ //{ "set_active_root", set_active_root_activated, NULL, NULL, NULL },
+ { "new_folder", new_folder_activated, NULL, NULL, NULL },
+ { "new_file", new_file_activated, NULL, NULL, NULL },
+ { "rename", rename_activated, NULL, NULL, NULL },
+ { "move_to_trash", move_to_trash_activated, NULL, NULL, NULL },
+ { "delete", delete_activated, NULL, NULL, NULL },
+ { "refresh_view", refresh_view_activated, NULL, NULL, NULL },
+ { "view_folder", view_folder_activated, NULL, NULL, NULL },
+ //{ "open_in_terminal", open_in_terminal_activated, NULL, NULL, NULL },
+ { "show_hidden", show_hidden_activated, NULL, "true", NULL },
+ { "show_binary", show_binary_activated, NULL, "true", NULL },
+ { "bookmark_open", bookmark_open_activated, NULL, NULL, NULL },
+ { "previous_location", previous_location_activated, NULL, NULL, NULL },
+ { "next_location", next_location_activated, NULL, NULL, NULL },
+ { "up", up_activated, NULL, NULL, NULL }
+};
+
static void
-create_tree (GeditFileBrowserWidget *obj)
+gedit_file_browser_widget_init (GeditFileBrowserWidget *obj)
{
- GtkWidget *sw;
+ GtkBuilder *builder;
+ GError *error = NULL;
+
+ obj->priv = GEDIT_FILE_BROWSER_WIDGET_GET_PRIVATE (obj);
+
+ obj->priv->filter_pattern_str = g_strdup ("");
+ obj->priv->bookmarks_hash = g_hash_table_new_full (g_file_hash,
+ (GEqualFunc)g_file_equal,
+ g_object_unref,
+ free_name_icon);
+
+ obj->priv->busy_cursor = gdk_cursor_new (GDK_WATCH);
+
+ builder = gtk_builder_new ();
+ if (!gtk_builder_add_from_resource (builder,
+
"/org/gnome/gedit/plugins/file-browser/ui/gedit-file-browser-menus.ui",
+ &error))
+ {
+ g_warning ("loading menu builder file: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ obj->priv->dir_menu = G_MENU_MODEL (g_object_ref (gtk_builder_get_object (builder,
"dir-menu")));
+ obj->priv->bookmarks_menu = G_MENU_MODEL (g_object_ref (gtk_builder_get_object (builder,
"bookmarks-menu")));
+ }
+
+ g_object_unref (builder);
+
+ obj->priv->action_group = g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (obj->priv->action_group),
+ browser_entries,
+ G_N_ELEMENTS (browser_entries),
+ obj);
+
+ set_enable_delete (obj, obj->priv->enable_delete);
+
+ gtk_widget_init_template (GTK_WIDGET (obj));
+
+ /* combo */
+ obj->priv->combo_model = GTK_TREE_STORE (g_object_ref (gtk_combo_box_get_model (GTK_COMBO_BOX
(obj->priv->combo))));
+
+ gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (obj->priv->combo),
+ obj->priv->indent_renderer,
+ indent_cell_data_func, obj, NULL);
+
+ fill_combo_model (obj);
+ g_signal_connect (obj->priv->combo, "changed",
+ G_CALLBACK (on_combo_changed), obj);
+ /* tree view */
obj->priv->file_store = gedit_file_browser_store_new (NULL);
obj->priv->bookmarks_store = gedit_file_bookmarks_store_new ();
- obj->priv->treeview =
- GEDIT_FILE_BROWSER_VIEW (gedit_file_browser_view_new ());
gedit_file_browser_view_set_restore_expand_state (obj->priv->treeview, TRUE);
@@ -1146,17 +988,6 @@ create_tree (GeditFileBrowserWidget *obj)
(GeditFileBrowserStoreFilterFunc) filter_real,
obj);
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
- GTK_SHADOW_ETCHED_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_container_add (GTK_CONTAINER (sw),
- GTK_WIDGET (obj->priv->treeview));
- gtk_box_pack_start (GTK_BOX (obj), sw, TRUE, TRUE, 0);
-
g_signal_connect (obj->priv->treeview, "notify::model",
G_CALLBACK (on_model_set), obj);
g_signal_connect (obj->priv->treeview, "error",
@@ -1189,46 +1020,13 @@ create_tree (GeditFileBrowserWidget *obj)
init_bookmarks_hash (obj);
- gtk_widget_show (sw);
- gtk_widget_show (GTK_WIDGET (obj->priv->treeview));
-}
-
-static void
-create_filter (GeditFileBrowserWidget *obj)
-{
- GtkWidget *entry;
-
- entry = gtk_entry_new ();
- gtk_entry_set_placeholder_text (GTK_ENTRY (entry), _("Match Filename"));
-
- obj->priv->filter_entry = entry;
-
- g_signal_connect_swapped (entry, "activate",
+ /* filter */
+ g_signal_connect_swapped (obj->priv->filter_entry, "activate",
G_CALLBACK (on_entry_filter_activate),
obj);
- g_signal_connect_swapped (entry, "focus_out_event",
+ g_signal_connect_swapped (obj->priv->filter_entry, "focus_out_event",
G_CALLBACK (on_entry_filter_activate),
obj);
-
- gtk_box_pack_start (GTK_BOX (obj), entry, FALSE, FALSE, 0);
-}
-
-static void
-gedit_file_browser_widget_init (GeditFileBrowserWidget *obj)
-{
- obj->priv = GEDIT_FILE_BROWSER_WIDGET_GET_PRIVATE (obj);
-
- obj->priv->filter_pattern_str = g_strdup ("");
- obj->priv->bookmarks_hash = g_hash_table_new_full (g_file_hash,
- (GEqualFunc)g_file_equal,
- g_object_unref,
- free_name_icon);
-
- gtk_box_set_spacing (GTK_BOX (obj), 3);
- gtk_orientable_set_orientation (GTK_ORIENTABLE (obj),
- GTK_ORIENTATION_VERTICAL);
-
- obj->priv->busy_cursor = gdk_cursor_new (GDK_WATCH);
}
/* Private */
@@ -1236,38 +1034,28 @@ gedit_file_browser_widget_init (GeditFileBrowserWidget *obj)
static void
update_sensitivity (GeditFileBrowserWidget *obj)
{
- GtkTreeModel *model =
- gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
- GtkAction *action;
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
+ GAction *action;
gint mode;
if (GEDIT_IS_FILE_BROWSER_STORE (model))
{
- gtk_action_group_set_sensitive (obj->priv->action_group,
- TRUE);
- gtk_action_group_set_sensitive (obj->priv->bookmark_action_group,
- FALSE);
-
mode = gedit_file_browser_store_get_filter_mode (GEDIT_FILE_BROWSER_STORE (model));
- action = gtk_action_group_get_action (obj->priv->action_group,
- "FilterHidden");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- !(mode &
- GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN));
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "show_hidden");
+
+ g_action_change_state (action,
+ g_variant_new_boolean (!(mode &
+
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN)));
}
else if (GEDIT_IS_FILE_BOOKMARKS_STORE (model))
{
- gtk_action_group_set_sensitive (obj->priv->action_group,
- FALSE);
- gtk_action_group_set_sensitive (obj->priv->bookmark_action_group,
- TRUE);
-
/* Set the filter toggle to normal up state, just for visual pleasure */
- action = gtk_action_group_get_action (obj->priv->action_group,
- "FilterHidden");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- FALSE);
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "show_hidden");
+
+ g_action_change_state (action, g_variant_new_boolean (FALSE));
}
on_selection_changed (gtk_tree_view_get_selection
@@ -1300,15 +1088,16 @@ popup_menu (GeditFileBrowserWidget *obj,
GtkTreeModel *model)
{
GtkWidget *menu;
+ GMenuModel *menu_model;
if (GEDIT_IS_FILE_BROWSER_STORE (model))
- menu = gtk_ui_manager_get_widget (obj->priv->manager, "/FilePopup");
+ menu_model = obj->priv->dir_menu;
else if (GEDIT_IS_FILE_BOOKMARKS_STORE (model))
- menu = gtk_ui_manager_get_widget (obj->priv->manager, "/BookmarkPopup");
+ menu_model = obj->priv->bookmarks_menu;
else
return FALSE;
- g_return_val_if_fail (menu != NULL, FALSE);
+ menu = gtk_menu_new_from_model (menu_model);
if (event != NULL)
{
@@ -1396,7 +1185,8 @@ rename_selected_file (GeditFileBrowserWidget *obj)
}
static GList *
-get_deletable_files (GeditFileBrowserWidget *obj) {
+get_deletable_files (GeditFileBrowserWidget *obj)
+{
GtkTreeSelection *selection;
GtkTreeModel *model;
GList *rows;
@@ -1561,6 +1351,8 @@ jump_to_location (GeditFileBrowserWidget *obj,
static void
clear_next_locations (GeditFileBrowserWidget *obj)
{
+ GAction *action;
+
if (obj->priv->current_location == NULL)
return;
@@ -1571,28 +1363,30 @@ clear_next_locations (GeditFileBrowserWidget *obj)
obj->priv->current_location->prev);
}
- gtk_action_set_sensitive (gtk_action_group_get_action (obj->priv->action_group_sensitive,
- "DirectoryNext"),
- FALSE);
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "next_location");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
}
static void
update_filter_mode (GeditFileBrowserWidget *obj,
- GtkAction *action,
+ GSimpleAction *action,
GeditFileBrowserStoreFilterMode mode)
{
GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
if (GEDIT_IS_FILE_BROWSER_STORE (model))
{
- gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+ GVariant *state = g_action_get_state (G_ACTION (action));
gint now = gedit_file_browser_store_get_filter_mode (GEDIT_FILE_BROWSER_STORE (model));
- if (active)
+ if (g_variant_get_boolean(state))
now &= ~mode;
else
now |= mode;
+ g_variant_unref (state);
+
gedit_file_browser_store_set_filter_mode (GEDIT_FILE_BROWSER_STORE (model),
now);
}
@@ -1677,15 +1471,9 @@ set_filter_pattern_real (GeditFileBrowserWidget *obj,
/* Public */
GtkWidget *
-gedit_file_browser_widget_new (const gchar *data_dir)
+gedit_file_browser_widget_new (void)
{
- GeditFileBrowserWidget *obj =
- g_object_new (GEDIT_TYPE_FILE_BROWSER_WIDGET, NULL);
-
- create_toolbar (obj, data_dir);
- create_combo (obj);
- create_tree (obj);
- create_filter (obj);
+ GeditFileBrowserWidget *obj = g_object_new (GEDIT_TYPE_FILE_BROWSER_WIDGET, NULL);
gedit_file_browser_widget_show_bookmarks (obj);
@@ -1790,12 +1578,6 @@ gedit_file_browser_widget_get_browser_view (GeditFileBrowserWidget *obj)
return obj->priv->treeview;
}
-GtkUIManager *
-gedit_file_browser_widget_get_ui_manager (GeditFileBrowserWidget *obj)
-{
- return obj->priv->manager;
-}
-
GtkWidget *
gedit_file_browser_widget_get_filter_entry (GeditFileBrowserWidget *obj)
{
@@ -2429,7 +2211,7 @@ on_virtual_root_changed (GeditFileBrowserStore *model,
if (gedit_file_browser_store_get_iter_root (model, &root))
{
- GtkAction *action;
+ GAction *action;
if (!obj->priv->changing_location)
{
@@ -2461,22 +2243,22 @@ on_virtual_root_changed (GeditFileBrowserStore *model,
}
}
- action = gtk_action_group_get_action (obj->priv->action_group,
- "DirectoryUp");
- gtk_action_set_sensitive (action,
- !virtual_root_is_root (obj, model));
-
- action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
- "DirectoryPrevious");
- gtk_action_set_sensitive (action,
- obj->priv->current_location != NULL &&
- obj->priv->current_location->next != NULL);
-
- action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
- "DirectoryNext");
- gtk_action_set_sensitive (action,
- obj->priv->current_location != NULL &&
- obj->priv->current_location->prev != NULL);
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "up");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+ !virtual_root_is_root (obj, model));
+
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "previous_location");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+ obj->priv->current_location != NULL &&
+ obj->priv->current_location->next != NULL);
+
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "next_location");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+ obj->priv->current_location != NULL &&
+ obj->priv->current_location->prev != NULL);
}
check_current_item (obj, TRUE);
@@ -2507,13 +2289,13 @@ on_model_set (GObject *gobject, GParamSpec *arg1,
/* Add the current location to the back menu */
if (obj->priv->current_location)
{
- GtkAction *action;
+ GAction *action;
obj->priv->current_location = NULL;
- action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
- "DirectoryPrevious");
- gtk_action_set_sensitive (action, TRUE);
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "previous_location");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
}
gtk_widget_hide (obj->priv->filter_entry);
@@ -2618,14 +2400,14 @@ static gboolean
do_change_directory (GeditFileBrowserWidget *obj,
GdkEventKey *event)
{
- GtkAction *action = NULL;
+ GAction *action = NULL;
if ((event->state &
(~GDK_CONTROL_MASK & ~GDK_SHIFT_MASK & ~GDK_MOD1_MASK)) ==
event->state && event->keyval == GDK_KEY_BackSpace)
{
- action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
- "DirectoryPrevious");
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "previous_location");
}
else if (!((event->state & GDK_MOD1_MASK) &&
(event->state & (~GDK_CONTROL_MASK & ~GDK_SHIFT_MASK)) == event->state))
@@ -2636,16 +2418,16 @@ do_change_directory (GeditFileBrowserWidget *obj,
switch (event->keyval)
{
case GDK_KEY_Left:
- action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
- "DirectoryPrevious");
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "previous_location");
break;
case GDK_KEY_Right:
- action = gtk_action_group_get_action (obj->priv->action_group_sensitive,
- "DirectoryNext");
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "next_location");
break;
case GDK_KEY_Up:
- action = gtk_action_group_get_action (obj->priv->action_group,
- "DirectoryUp");
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "up");
break;
default:
break;
@@ -2653,7 +2435,7 @@ do_change_directory (GeditFileBrowserWidget *obj,
if (action != NULL)
{
- gtk_action_activate (action);
+ g_action_activate (action, g_variant_new_boolean (TRUE));
return TRUE;
}
@@ -2712,6 +2494,7 @@ on_selection_changed (GtkTreeSelection *selection,
GeditFileBrowserWidget *obj)
{
GtkTreeModel *model;
+ GAction *action;
guint selected = 0;
guint files = 0;
guint dirs = 0;
@@ -2725,14 +2508,30 @@ on_selection_changed (GtkTreeSelection *selection,
&dirs);
}
- gtk_action_group_set_sensitive (obj->priv->action_group_selection,
- selected > 0);
- gtk_action_group_set_sensitive (obj->priv->action_group_file_selection,
- (selected > 0) && (selected == files));
- gtk_action_group_set_sensitive (obj->priv->action_group_single_selection,
- selected == 1);
- gtk_action_group_set_sensitive (obj->priv->action_group_single_most_selection,
- selected <= 1);
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "move_to_trash");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selected > 0);
+
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "delete");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selected > 0);
+
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "open");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+ (selected > 0) && (selected == files));
+
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "rename");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selected == 1);
+
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "new_folder");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selected <= 1);
+
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "new_file");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selected <= 1);
}
static gboolean
@@ -2782,48 +2581,63 @@ on_filter_mode_changed (GeditFileBrowserStore *model,
GParamSpec *param,
GeditFileBrowserWidget *obj)
{
- gint mode;
- GtkToggleAction *action;
+ GAction *action;
+ GVariant *variant;
gboolean active;
+ gint mode;
mode = gedit_file_browser_store_get_filter_mode (model);
- action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group,
- "FilterHidden"));
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "show_hidden");
active = !(mode & GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN);
+ variant = g_action_get_state (action);
+
+ if (active != g_variant_get_boolean (variant))
+ {
+ g_action_change_state (action, g_variant_new_boolean (active));
+ }
- if (active != gtk_toggle_action_get_active (action))
- gtk_toggle_action_set_active (action, active);
+ g_variant_unref (variant);
- action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (obj->priv->action_group,
- "FilterBinary"));
+ action = g_simple_action_group_lookup (obj->priv->action_group,
+ "show_binary");
active = !(mode & GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY);
+ variant = g_action_get_state (action);
+
+ if (active != g_variant_get_boolean (variant))
+ {
+ g_action_change_state (action, g_variant_new_boolean (active));
+ }
- if (active != gtk_toggle_action_get_active (action))
- gtk_toggle_action_set_active (action, active);
+ g_variant_unref (variant);
}
static void
-on_action_directory_next (GtkAction *action,
- GeditFileBrowserWidget *obj)
+next_location_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- gedit_file_browser_widget_history_forward (obj);
+ gedit_file_browser_widget_history_forward (GEDIT_FILE_BROWSER_WIDGET (user_data));
}
static void
-on_action_directory_previous (GtkAction *action,
- GeditFileBrowserWidget *obj)
+previous_location_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- gedit_file_browser_widget_history_back (obj);
+ gedit_file_browser_widget_history_back (GEDIT_FILE_BROWSER_WIDGET (user_data));
}
static void
-on_action_directory_up (GtkAction *action,
- GeditFileBrowserWidget *obj)
+up_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
GtkTreeModel *model;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return;
@@ -2832,33 +2646,37 @@ on_action_directory_up (GtkAction *action,
}
static void
-on_action_directory_new (GtkAction *action,
- GeditFileBrowserWidget *obj)
+new_folder_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
GtkTreeModel *model;
GtkTreeIter parent;
GtkTreeIter iter;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return;
- if (!gedit_file_browser_widget_get_selected_directory (obj, &parent))
+ if (!gedit_file_browser_widget_get_selected_directory (widget, &parent))
return;
if (gedit_file_browser_store_new_directory (GEDIT_FILE_BROWSER_STORE (model),
&parent, &iter))
{
- gedit_file_browser_view_start_rename (obj->priv->treeview,
+ gedit_file_browser_view_start_rename (widget->priv->treeview,
&iter);
}
}
static void
-on_action_file_open (GtkAction *action,
- GeditFileBrowserWidget *obj)
+open_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
GtkTreeModel *model;
GtkTreeSelection *selection;
GList *rows;
@@ -2866,8 +2684,8 @@ on_action_file_open (GtkAction *action,
GtkTreeIter iter;
GtkTreePath *path;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return;
@@ -2879,7 +2697,7 @@ on_action_file_open (GtkAction *action,
path = (GtkTreePath *)(row->data);
if (gtk_tree_model_get_iter (model, &iter, path))
- file_open (obj, model, &iter);
+ file_open (widget, model, &iter);
gtk_tree_path_free (path);
}
@@ -2888,61 +2706,77 @@ on_action_file_open (GtkAction *action,
}
static void
-on_action_file_new (GtkAction *action,
- GeditFileBrowserWidget *obj)
+new_file_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
GtkTreeModel *model;
GtkTreeIter parent;
GtkTreeIter iter;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return;
- if (!gedit_file_browser_widget_get_selected_directory (obj, &parent))
+ if (!gedit_file_browser_widget_get_selected_directory (widget, &parent))
return;
if (gedit_file_browser_store_new_file (GEDIT_FILE_BROWSER_STORE (model),
&parent, &iter))
{
- gedit_file_browser_view_start_rename (obj->priv->treeview,
+ gedit_file_browser_view_start_rename (widget->priv->treeview,
&iter);
}
}
static void
-on_action_file_rename (GtkAction *action,
- GeditFileBrowserWidget *obj)
+rename_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- rename_selected_file (obj);
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
+
+ rename_selected_file (widget);
}
static void
-on_action_file_delete (GtkAction *action,
- GeditFileBrowserWidget *obj)
+delete_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- delete_selected_files (obj, FALSE);
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
+
+ delete_selected_files (widget, FALSE);
}
static void
-on_action_file_move_to_trash (GtkAction *action,
- GeditFileBrowserWidget *obj)
+move_to_trash_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- delete_selected_files (obj, TRUE);
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
+
+ delete_selected_files (widget, TRUE);
}
static void
-on_action_directory_refresh (GtkAction *action,
- GeditFileBrowserWidget *obj)
+refresh_view_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- gedit_file_browser_widget_refresh (obj);
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
+
+ gedit_file_browser_widget_refresh (widget);
}
static void
-on_action_directory_open (GtkAction *action,
- GeditFileBrowserWidget *obj)
+view_folder_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
GtkTreeModel *model;
GtkTreeSelection *selection;
GList *rows;
@@ -2951,8 +2785,8 @@ on_action_directory_open (GtkAction *action,
GtkTreeIter iter;
GtkTreePath *path;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
if (!GEDIT_IS_FILE_BROWSER_STORE (model))
return;
@@ -2964,54 +2798,66 @@ on_action_directory_open (GtkAction *action,
path = (GtkTreePath *)(row->data);
if (gtk_tree_model_get_iter (model, &iter, path))
- directory_opened |= directory_open (obj, model, &iter);
+ {
+ directory_opened |= directory_open (widget, model, &iter);
+ }
gtk_tree_path_free (path);
}
if (!directory_opened &&
- gedit_file_browser_widget_get_selected_directory (obj, &iter))
+ gedit_file_browser_widget_get_selected_directory (widget, &iter))
{
- directory_open (obj, model, &iter);
+ directory_open (widget, model, &iter);
}
g_list_free (rows);
}
static void
-on_action_filter_hidden (GtkAction *action,
- GeditFileBrowserWidget *obj)
+show_hidden_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- update_filter_mode (obj,
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
+
+ update_filter_mode (widget,
action,
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN);
}
static void
-on_action_filter_binary (GtkAction *action,
- GeditFileBrowserWidget *obj)
+show_binary_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- update_filter_mode (obj,
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
+
+ update_filter_mode (widget,
action,
GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY);
}
static void
-on_action_bookmark_open (GtkAction *action,
- GeditFileBrowserWidget *obj)
+bookmark_open_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ GeditFileBrowserWidget *widget = GEDIT_FILE_BROWSER_WIDGET (user_data);
GtkTreeModel *model;
GtkTreeSelection *selection;
GtkTreeIter iter;
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (obj->priv->treeview));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (obj->priv->treeview));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget->priv->treeview));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget->priv->treeview));
if (!GEDIT_IS_FILE_BOOKMARKS_STORE (model))
return;
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
- bookmark_open (obj, model, &iter);
+ {
+ bookmark_open (widget, model, &iter);
+ }
}
void
diff --git a/plugins/filebrowser/gedit-file-browser-widget.h b/plugins/filebrowser/gedit-file-browser-widget.h
index 8938bf6..24785f9 100644
--- a/plugins/filebrowser/gedit-file-browser-widget.h
+++ b/plugins/filebrowser/gedit-file-browser-widget.h
@@ -72,7 +72,7 @@ struct _GeditFileBrowserWidgetClass
GType gedit_file_browser_widget_get_type (void) G_GNUC_CONST;
-GtkWidget *gedit_file_browser_widget_new (const gchar *data_dir);
+GtkWidget *gedit_file_browser_widget_new (void);
void gedit_file_browser_widget_show_bookmarks (GeditFileBrowserWidget *obj);
void gedit_file_browser_widget_show_files (GeditFileBrowserWidget *obj);
@@ -98,9 +98,6 @@ gedit_file_browser_widget_get_browser_view (GeditFileBrowserWidget *obj);
GtkWidget *
gedit_file_browser_widget_get_filter_entry (GeditFileBrowserWidget *obj);
-GtkUIManager *
-gedit_file_browser_widget_get_ui_manager (GeditFileBrowserWidget *obj);
-
gulong gedit_file_browser_widget_add_filter (GeditFileBrowserWidget *obj,
GeditFileBrowserWidgetFilterFunc func,
gpointer user_data,
diff --git a/plugins/filebrowser/gedit-file-browser-widget.ui
b/plugins/filebrowser/gedit-file-browser-widget.ui
new file mode 100644
index 0000000..0506cf8
--- /dev/null
+++ b/plugins/filebrowser/gedit-file-browser-widget.ui
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.6 -->
+ <object class="GtkTreeStore" id="combo_model">
+ <columns>
+ <!-- column-name indent -->
+ <column type="guint"/>
+ <!-- column-name icon -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ <!-- column-name file -->
+ <column type="GFile"/>
+ <!-- column-name id -->
+ <column type="guint"/>
+ </columns>
+ </object>
+ <template class="GeditFileBrowserWidget" parent="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkToolbar" id="toolbar1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="toolbar_style">icons</property>
+ <property name="icon_size">1</property>
+ <style>
+ <class name="inline-toolbar"/>
+ </style>
+ <child>
+ <object class="GtkToolItem" id="toolbutton1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">browser.previous_location</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">go-previous-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">browser.next_location</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">go-next-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolItem" id="toolbutton2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="box2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="button3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">browser.up</property>
+ <child>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">go-up-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolItem" id="toolbutton3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="box3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="button4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">browser.refresh_view</property>
+ <child>
+ <object class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">view-refresh-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolItem" id="toolbutton4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox" id="box4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="button5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">browser.show_hidden</property>
+ <child>
+ <object class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_size">1</property>
+ <property name="icon_name">changes-prevent-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">combo_model</property>
+ <child>
+ <object class="GtkCellRendererText" id="indent_renderer"/>
+ </child>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="icon_renderer"/>
+ <attributes>
+ <attribute name="pixbuf">1</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="name_renderer">
+ <property name="ellipsize">end</property>
+ </object>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GeditFileBrowserView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="filter_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="placeholder_text">Match Filename</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </template>
+</interface>
diff --git a/plugins/filebrowser/gedit-file-browser.gresource.xml
b/plugins/filebrowser/gedit-file-browser.gresource.xml
index 7adf4ed..950bb0d 100644
--- a/plugins/filebrowser/gedit-file-browser.gresource.xml
+++ b/plugins/filebrowser/gedit-file-browser.gresource.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/gedit/plugins/file-browser/ui">
- <file preprocess="xml-stripblanks">gedit-file-browser-widget-ui.xml</file>
+ <file preprocess="xml-stripblanks">gedit-file-browser-menus.ui</file>
+ <file preprocess="xml-stripblanks">gedit-file-browser-widget.ui</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]