filebrowser: Migrate to GSettings

This commit is contained in:
Stefano Karapetsas 2013-01-24 21:05:58 +01:00
parent 698c1a83b5
commit 0a745cb559
4 changed files with 129 additions and 322 deletions

View File

@ -65,27 +65,18 @@ pluma-file-browser-marshal.c: pluma-file-browser-marshal.list $(GLIB_GENMARSHAL)
plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin) plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
schemasdir = $(MATECONF_SCHEMA_FILE_DIR) @INTLTOOL_XML_NOMERGE_RULE@
schemas_in_files = pluma-file-browser.schemas.in gsettings_SCHEMAS = org.mate.pluma.plugins.filebrowser.gschema.xml
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) @GSETTINGS_RULES@
@INTLTOOL_SCHEMAS_RULE@
if MATECONF_SCHEMAS_INSTALL %.gschema.xml.in: %.gschema.xml.in.in Makefile
install-data-local: $(AM_V_GEN) $(SED) -e 's^\@GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' < $< > $@
if test -z "$(DESTDIR)" ; then \
for p in $(schemas_DATA) ; do \
MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $(top_builddir)/plugins/filebrowser/$$p ; \
done \
fi
else
install-data-local:
endif
EXTRA_DIST = \ EXTRA_DIST = \
$(ui_DATA) \ $(ui_DATA) \
$(plugin_in_files) \ $(plugin_in_files) \
$(schemas_in_files) \ $(gsettings_SCHEMAS_in_in) \
pluma-file-browser-enum-types.h.template \ pluma-file-browser-enum-types.h.template \
pluma-file-browser-enum-types.c.template \ pluma-file-browser-enum-types.c.template \
pluma-file-browser-enum-register.c.template \ pluma-file-browser-enum-register.c.template \
@ -93,12 +84,14 @@ EXTRA_DIST = \
CLEANFILES = \ CLEANFILES = \
$(plugin_DATA) \ $(plugin_DATA) \
$(schemas_DATA) \ $(gsettings_SCHEMAS_in) \
$(gsettings_SCHEMAS) \
$(BUILT_SOURCES) $(BUILT_SOURCES)
DISTCLEANFILES = \ DISTCLEANFILES = \
$(plugin_DATA) \ $(plugin_DATA) \
$(schemas_DATA) \ $(gsettings_SCHEMAS_in) \
$(gsettings_SCHEMAS) \
$(BUILT_SOURCES) $(BUILT_SOURCES)
-include $(top_srcdir)/git.mk -include $(top_srcdir)/git.mk

View File

@ -0,0 +1,43 @@
<?xml version="1.0"?>
<schemalist>
<schema id="org.mate.pluma.plugins.filebrowser" path="/org/mate/pluma/plugins/filebrowser/">
<key name="open-at-first-doc" type="b">
<default>true</default>
<_summary>Set Location to First Document</_summary>
<_description>If TRUE the file browser plugin will view the directory of the first opened document given that the file browser hasn't been used yet. (Thus this generally applies to opening a document from the command line or opening it with Caja, etc.)</_description>
</key>
<key name="filter-mode" type="s">
<default>'hidden_and_binary'</default>
<_summary>File Browser Filter Mode</_summary>
<_description>This value determines what files get filtered from the file browser. Valid values are: none (filter nothing), hidden (filter hidden files), binary (filter binary files) and hidden_and_binary (filter both hidden and binary files).</_description>
</key>
<key name="filter-pattern" type="s">
<default>''</default>
<_summary>File Browser Filter Pattern</_summary>
<_description>The filter pattern to filter the file browser with. This filter works on top of the filter_mode.</_description>
</key>
<child name="on-load" schema="org.mate.pluma.plugins.filebrowser.on-load"/>
</schema>
<schema id="org.mate.pluma.plugins.filebrowser.on-load" path="/org/mate/pluma/plugins/filebrowser/on-load/">
<key name="tree-view" type="b">
<default>true</default>
<_summary>Open With Tree View</_summary>
<_description>Open the tree view when the file browser plugin gets loaded instead of the bookmarks view</_description>
</key>
<key name="root" type="s">
<default>''</default>
<_summary>File Browser Root Directory</_summary>
<_description>The file browser root directory to use when loading the file browser plugin and onload/tree_view is TRUE.</_description>
</key>
<key name="virtual-root" type="s">
<default>''</default>
<_summary>File Browser Virtual Root Directory</_summary>
<_description>The file browser virtual root directory to use when loading the file browser plugin when onload/tree_view is TRUE. The virtual root must always be below the actual root.</_description>
</key>
<key name="enable-remote" type="b">
<default>false</default>
<_summary>Enable Restore of Remote Locations</_summary>
<_description>Sets whether to enable restoring of remote locations.</_description>
</key>
</schema>
</schemalist>

View File

@ -29,7 +29,7 @@
#include <pluma/pluma-app.h> #include <pluma/pluma-app.h>
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>
#include <pluma/pluma-debug.h> #include <pluma/pluma-debug.h>
#include <mateconf/mateconf-client.h> #include <gio/gio.h>
#include <string.h> #include <string.h>
#include "pluma-file-browser-enum-types.h" #include "pluma-file-browser-enum-types.h"
@ -40,18 +40,21 @@
#include "pluma-file-browser-messages.h" #include "pluma-file-browser-messages.h"
#define WINDOW_DATA_KEY "PlumaFileBrowserPluginWindowData" #define WINDOW_DATA_KEY "PlumaFileBrowserPluginWindowData"
#define FILE_BROWSER_BASE_KEY "/apps/pluma/plugins/filebrowser"
#define CAJA_CLICK_POLICY_BASE_KEY "/apps/caja/preferences" #define FILE_BROWSER_SCHEMA "org.mate.pluma.plugins.filebrowser"
#define CAJA_CLICK_POLICY_KEY "click_policy" #define FILE_BROWSER_ONLOAD_SCHEMA "org.mate.pluma.plugins.filebrowser.on-load"
#define CAJA_ENABLE_DELETE_KEY "enable_delete" #define CAJA_SCHEMA "org.mate.caja.preferences"
#define CAJA_CONFIRM_TRASH_KEY "confirm_trash" #define CAJA_CLICK_POLICY_KEY "click-policy"
#define TERMINAL_EXEC_KEY "/desktop/mate/applications/terminal/exec" #define CAJA_ENABLE_DELETE_KEY "enable-delete"
#define CAJA_CONFIRM_TRASH_KEY "confirm-trash"
#define TERMINAL_SCHEMA "org.mate.applications-terminal"
#define TERMINAL_EXEC_KEY "exec"
#define PLUMA_FILE_BROWSER_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_FILE_BROWSER_PLUGIN, PlumaFileBrowserPluginPrivate)) #define PLUMA_FILE_BROWSER_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), PLUMA_TYPE_FILE_BROWSER_PLUGIN, PlumaFileBrowserPluginPrivate))
struct _PlumaFileBrowserPluginPrivate struct _PlumaFileBrowserPluginPrivate
{ {
gpointer dummy; gpointer *dummy;
}; };
typedef struct _PlumaFileBrowserPluginData typedef struct _PlumaFileBrowserPluginData
@ -64,9 +67,10 @@ typedef struct _PlumaFileBrowserPluginData
gulong end_loading_handle; gulong end_loading_handle;
gboolean confirm_trash; gboolean confirm_trash;
guint click_policy_handle; GSettings *settings;
guint enable_delete_handle; GSettings *onload_settings;
guint confirm_trash_handle; GSettings *caja_settings;
GSettings *terminal_settings;
} PlumaFileBrowserPluginData; } PlumaFileBrowserPluginData;
static void on_uri_activated_cb (PlumaFileBrowserWidget * widget, static void on_uri_activated_cb (PlumaFileBrowserWidget * widget,
@ -170,32 +174,18 @@ restore_default_location (PlumaFileBrowserPluginData *data)
gchar * virtual_root; gchar * virtual_root;
gboolean bookmarks; gboolean bookmarks;
gboolean remote; gboolean remote;
MateConfClient * client;
client = mateconf_client_get_default (); bookmarks = !g_settings_get_boolean (data->onload_settings, "tree-view");
if (!client)
return;
bookmarks = !mateconf_client_get_bool (client,
FILE_BROWSER_BASE_KEY "/on_load/tree_view",
NULL);
if (bookmarks) { if (bookmarks) {
g_object_unref (client);
pluma_file_browser_widget_show_bookmarks (data->tree_widget); pluma_file_browser_widget_show_bookmarks (data->tree_widget);
return; return;
} }
root = mateconf_client_get_string (client, root = g_settings_get_string (data->onload_settings, "root");
FILE_BROWSER_BASE_KEY "/on_load/root", virtual_root = g_settings_get_string (data->onload_settings, "virtual-root");
NULL);
virtual_root = mateconf_client_get_string (client,
FILE_BROWSER_BASE_KEY "/on_load/virtual_root",
NULL);
remote = mateconf_client_get_bool (client, remote = g_settings_get_boolean (data->onload_settings, "enable-remote");
FILE_BROWSER_BASE_KEY "/on_load/enable_remote",
NULL);
if (root != NULL && *root != '\0') { if (root != NULL && *root != '\0') {
GFile *file; GFile *file;
@ -219,7 +209,6 @@ restore_default_location (PlumaFileBrowserPluginData *data)
g_object_unref (file); g_object_unref (file);
} }
g_object_unref (client);
g_free (root); g_free (root);
g_free (virtual_root); g_free (virtual_root);
} }
@ -227,19 +216,12 @@ restore_default_location (PlumaFileBrowserPluginData *data)
static void static void
restore_filter (PlumaFileBrowserPluginData * data) restore_filter (PlumaFileBrowserPluginData * data)
{ {
MateConfClient * client;
gchar *filter_mode; gchar *filter_mode;
PlumaFileBrowserStoreFilterMode mode; PlumaFileBrowserStoreFilterMode mode;
gchar *pattern; gchar *pattern;
client = mateconf_client_get_default ();
if (!client)
return;
/* Get filter_mode */ /* Get filter_mode */
filter_mode = mateconf_client_get_string (client, filter_mode = g_settings_get_string (data->settings, "filter-mode");
FILE_BROWSER_BASE_KEY "/filter_mode",
NULL);
/* Filter mode */ /* Filter mode */
mode = pluma_file_browser_store_filter_mode_get_default (); mode = pluma_file_browser_store_filter_mode_get_default ();
@ -264,14 +246,11 @@ restore_filter (PlumaFileBrowserPluginData * data)
pluma_file_browser_widget_get_browser_store (data->tree_widget), pluma_file_browser_widget_get_browser_store (data->tree_widget),
mode); mode);
pattern = mateconf_client_get_string (client, pattern = g_settings_get_string (data->settings, "filter-pattern");
FILE_BROWSER_BASE_KEY "/filter_pattern",
NULL);
pluma_file_browser_widget_set_filter_pattern (data->tree_widget, pluma_file_browser_widget_set_filter_pattern (data->tree_widget,
pattern); pattern);
g_object_unref (client);
g_free (filter_mode); g_free (filter_mode);
g_free (pattern); g_free (pattern);
} }
@ -286,64 +265,48 @@ click_policy_from_string (gchar const *click_policy)
} }
static void static void
on_click_policy_changed (MateConfClient *client, on_click_policy_changed (GSettings *settings,
guint cnxn_id, gchar *key,
MateConfEntry *entry,
gpointer user_data) gpointer user_data)
{ {
MateConfValue *value;
PlumaFileBrowserPluginData * data; PlumaFileBrowserPluginData * data;
gchar const *click_policy; gchar *click_policy;
PlumaFileBrowserViewClickPolicy policy = PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE; PlumaFileBrowserViewClickPolicy policy = PLUMA_FILE_BROWSER_VIEW_CLICK_POLICY_DOUBLE;
PlumaFileBrowserView *view; PlumaFileBrowserView *view;
data = (PlumaFileBrowserPluginData *)(user_data); data = (PlumaFileBrowserPluginData *)(user_data);
value = mateconf_entry_get_value (entry);
if (value && value->type == MATECONF_VALUE_STRING) {
click_policy = mateconf_value_get_string (value);
click_policy = g_settings_get_string (settings, key);
policy = click_policy_from_string (click_policy); policy = click_policy_from_string (click_policy);
}
view = pluma_file_browser_widget_get_browser_view (data->tree_widget); view = pluma_file_browser_widget_get_browser_view (data->tree_widget);
pluma_file_browser_view_set_click_policy (view, policy); pluma_file_browser_view_set_click_policy (view, policy);
g_free (click_policy);
} }
static void static void
on_enable_delete_changed (MateConfClient *client, on_enable_delete_changed (GSettings *settings,
guint cnxn_id, gchar *key,
MateConfEntry *entry,
gpointer user_data) gpointer user_data)
{ {
MateConfValue *value;
PlumaFileBrowserPluginData *data; PlumaFileBrowserPluginData *data;
gboolean enable = FALSE; gboolean enable = FALSE;
data = (PlumaFileBrowserPluginData *)(user_data); data = (PlumaFileBrowserPluginData *)(user_data);
value = mateconf_entry_get_value (entry); enable = g_settings_get_boolean (settings, key);
if (value && value->type == MATECONF_VALUE_BOOL)
enable = mateconf_value_get_bool (value);
g_object_set (G_OBJECT (data->tree_widget), "enable-delete", enable, NULL); g_object_set (G_OBJECT (data->tree_widget), "enable-delete", enable, NULL);
} }
static void static void
on_confirm_trash_changed (MateConfClient *client, on_confirm_trash_changed (GSettings *settings,
guint cnxn_id, gchar *key,
MateConfEntry *entry,
gpointer user_data) gpointer user_data)
{ {
MateConfValue *value;
PlumaFileBrowserPluginData *data; PlumaFileBrowserPluginData *data;
gboolean enable = FALSE; gboolean enable = FALSE;
data = (PlumaFileBrowserPluginData *)(user_data); enable = g_settings_get_boolean (settings, key);
value = mateconf_entry_get_value (entry);
if (value && value->type == MATECONF_VALUE_BOOL)
enable = mateconf_value_get_bool (value);
data->confirm_trash = enable; data->confirm_trash = enable;
} }
@ -351,25 +314,13 @@ on_confirm_trash_changed (MateConfClient *client,
static void static void
install_caja_prefs (PlumaFileBrowserPluginData *data) install_caja_prefs (PlumaFileBrowserPluginData *data)
{ {
MateConfClient *client;
gchar *pref; gchar *pref;
gboolean prefb; gboolean prefb;
PlumaFileBrowserViewClickPolicy policy; PlumaFileBrowserViewClickPolicy policy;
PlumaFileBrowserView *view; PlumaFileBrowserView *view;
client = mateconf_client_get_default ();
if (!client)
return;
mateconf_client_add_dir (client,
CAJA_CLICK_POLICY_BASE_KEY,
MATECONF_CLIENT_PRELOAD_NONE,
NULL);
/* Get click_policy */ /* Get click_policy */
pref = mateconf_client_get_string (client, pref = g_settings_get_string (data->caja_settings, CAJA_CLICK_POLICY_KEY);
CAJA_CLICK_POLICY_BASE_KEY "/" CAJA_CLICK_POLICY_KEY,
NULL);
policy = click_policy_from_string (pref); policy = click_policy_from_string (pref);
@ -377,46 +328,32 @@ install_caja_prefs (PlumaFileBrowserPluginData *data)
pluma_file_browser_view_set_click_policy (view, policy); pluma_file_browser_view_set_click_policy (view, policy);
if (pref) { if (pref) {
data->click_policy_handle = g_signal_connect (data->caja_settings,
mateconf_client_notify_add (client, "changed::" CAJA_CLICK_POLICY_KEY,
CAJA_CLICK_POLICY_BASE_KEY "/" CAJA_CLICK_POLICY_KEY, G_CALLBACK (on_click_policy_changed),
on_click_policy_changed, data);
data,
NULL,
NULL);
g_free (pref); g_free (pref);
} }
/* Get enable_delete */ /* Get enable_delete */
prefb = mateconf_client_get_bool (client, prefb = g_settings_get_boolean (data->caja_settings, CAJA_ENABLE_DELETE_KEY);
CAJA_CLICK_POLICY_BASE_KEY "/" CAJA_ENABLE_DELETE_KEY,
NULL);
g_object_set (G_OBJECT (data->tree_widget), "enable-delete", prefb, NULL); g_object_set (G_OBJECT (data->tree_widget), "enable-delete", prefb, NULL);
data->enable_delete_handle = g_signal_connect (data->caja_settings,
mateconf_client_notify_add (client, "changed::" CAJA_ENABLE_DELETE_KEY,
CAJA_CLICK_POLICY_BASE_KEY "/" CAJA_ENABLE_DELETE_KEY, G_CALLBACK (on_enable_delete_changed),
on_enable_delete_changed, data);
data,
NULL,
NULL);
/* Get confirm_trash */ /* Get confirm_trash */
prefb = mateconf_client_get_bool (client, prefb = g_settings_get_boolean (data->caja_settings, CAJA_CONFIRM_TRASH_KEY);
CAJA_CLICK_POLICY_BASE_KEY "/" CAJA_CONFIRM_TRASH_KEY,
NULL);
data->confirm_trash = prefb; data->confirm_trash = prefb;
data->confirm_trash_handle = g_signal_connect (data->caja_settings,
mateconf_client_notify_add (client, "changed::" CAJA_CONFIRM_TRASH_KEY,
CAJA_CLICK_POLICY_BASE_KEY "/" CAJA_CONFIRM_TRASH_KEY, G_CALLBACK (on_confirm_trash_changed),
on_confirm_trash_changed, data);
data,
NULL,
NULL);
g_object_unref (client);
} }
static void static void
@ -463,16 +400,12 @@ on_action_set_active_root (GtkAction * action,
} }
static gchar * static gchar *
get_terminal (void) get_terminal (PlumaFileBrowserPluginData * data)
{ {
MateConfClient * client;
gchar * terminal; gchar * terminal;
client = mateconf_client_get_default (); terminal = g_settings_get_string (data->terminal_settings,
terminal = mateconf_client_get_string (client, TERMINAL_EXEC_KEY);
TERMINAL_EXEC_KEY,
NULL);
g_object_unref (client);
if (terminal == NULL) { if (terminal == NULL) {
const gchar *term = g_getenv ("TERM"); const gchar *term = g_getenv ("TERM");
@ -516,7 +449,7 @@ on_action_open_terminal (GtkAction * action,
if (wd == NULL) if (wd == NULL)
return; return;
terminal = get_terminal (); terminal = get_terminal (data);
file = g_file_new_for_uri (wd); file = g_file_new_for_uri (wd);
local = g_file_get_path (file); local = g_file_get_path (file);
@ -696,6 +629,11 @@ impl_activate (PlumaPlugin * plugin, PlumaWindow * window)
data->tree_widget = PLUMA_FILE_BROWSER_WIDGET (pluma_file_browser_widget_new (data_dir)); data->tree_widget = PLUMA_FILE_BROWSER_WIDGET (pluma_file_browser_widget_new (data_dir));
g_free (data_dir); g_free (data_dir);
data->settings = g_settings_new (FILE_BROWSER_SCHEMA);
data->onload_settings = g_settings_new (FILE_BROWSER_ONLOAD_SCHEMA);
data->caja_settings = g_settings_new (CAJA_SCHEMA);
data->terminal_settings = g_settings_new (TERMINAL_SCHEMA);
g_signal_connect (data->tree_widget, g_signal_connect (data->tree_widget,
"uri-activated", "uri-activated",
G_CALLBACK (on_uri_activated_cb), window); G_CALLBACK (on_uri_activated_cb), window);
@ -790,7 +728,6 @@ impl_deactivate (PlumaPlugin * plugin, PlumaWindow * window)
{ {
PlumaFileBrowserPluginData * data; PlumaFileBrowserPluginData * data;
PlumaPanel * panel; PlumaPanel * panel;
MateConfClient *client;
data = get_plugin_data (window); data = get_plugin_data (window);
@ -802,19 +739,11 @@ impl_deactivate (PlumaPlugin * plugin, PlumaWindow * window)
G_CALLBACK (on_tab_added_cb), G_CALLBACK (on_tab_added_cb),
data); data);
client = mateconf_client_get_default (); g_object_unref (data->settings);
mateconf_client_remove_dir (client, CAJA_CLICK_POLICY_BASE_KEY, NULL); g_object_unref (data->onload_settings);
g_object_unref (data->caja_settings);
g_object_unref (data->terminal_settings);
if (data->click_policy_handle)
mateconf_client_notify_remove (client, data->click_policy_handle);
if (data->enable_delete_handle)
mateconf_client_notify_remove (client, data->enable_delete_handle);
if (data->confirm_trash_handle)
mateconf_client_notify_remove (client, data->confirm_trash_handle);
g_object_unref (client);
remove_popup_ui (window); remove_popup_ui (window);
panel = pluma_window_get_side_panel (window); panel = pluma_window_get_side_panel (window);
@ -922,19 +851,15 @@ on_model_set_cb (PlumaFileBrowserView * widget,
{ {
PlumaFileBrowserPluginData * data = get_plugin_data (window); PlumaFileBrowserPluginData * data = get_plugin_data (window);
GtkTreeModel * model; GtkTreeModel * model;
MateConfClient * client;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (pluma_file_browser_widget_get_browser_view (data->tree_widget))); model = gtk_tree_view_get_model (GTK_TREE_VIEW (pluma_file_browser_widget_get_browser_view (data->tree_widget)));
if (model == NULL) if (model == NULL)
return; return;
client = mateconf_client_get_default (); g_settings_set_boolean (data->onload_settings,
mateconf_client_set_bool (client, "tree-view",
FILE_BROWSER_BASE_KEY "/on_load/tree_view", PLUMA_IS_FILE_BROWSER_STORE (model));
PLUMA_IS_FILE_BROWSER_STORE (model),
NULL);
g_object_unref (client);
} }
static void static void
@ -942,41 +867,21 @@ on_filter_mode_changed_cb (PlumaFileBrowserStore * model,
GParamSpec * param, GParamSpec * param,
PlumaWindow * window) PlumaWindow * window)
{ {
MateConfClient * client; PlumaFileBrowserPluginData * data = get_plugin_data (window);
PlumaFileBrowserStoreFilterMode mode; PlumaFileBrowserStoreFilterMode mode;
client = mateconf_client_get_default ();
if (!client)
return;
mode = pluma_file_browser_store_get_filter_mode (model); mode = pluma_file_browser_store_get_filter_mode (model);
if ((mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN) && if ((mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN) &&
(mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY)) { (mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY)) {
mateconf_client_set_string (client, g_settings_set_string (data->settings, "filter-mode", "hidden_and_binary");
FILE_BROWSER_BASE_KEY "/filter_mode",
"hidden_and_binary",
NULL);
} else if (mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN) { } else if (mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN) {
mateconf_client_set_string (client, g_settings_set_string (data->settings, "filter-mode", "hidden");
FILE_BROWSER_BASE_KEY "/filter_mode",
"hidden",
NULL);
} else if (mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY) { } else if (mode & PLUMA_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY) {
mateconf_client_set_string (client, g_settings_set_string (data->settings, "filter-mode", "binary");
FILE_BROWSER_BASE_KEY "/filter_mode",
"binary",
NULL);
} else { } else {
mateconf_client_set_string (client, g_settings_set_string (data->settings, "filter-mode", "none");
FILE_BROWSER_BASE_KEY "/filter_mode",
"none",
NULL);
} }
g_object_unref (client);
} }
static void static void
@ -1048,26 +953,15 @@ on_filter_pattern_changed_cb (PlumaFileBrowserWidget * widget,
GParamSpec * param, GParamSpec * param,
PlumaWindow * window) PlumaWindow * window)
{ {
MateConfClient * client; PlumaFileBrowserPluginData * data = get_plugin_data (window);
gchar * pattern; gchar * pattern;
client = mateconf_client_get_default ();
if (!client)
return;
g_object_get (G_OBJECT (widget), "filter-pattern", &pattern, NULL); g_object_get (G_OBJECT (widget), "filter-pattern", &pattern, NULL);
if (pattern == NULL) if (pattern == NULL)
mateconf_client_set_string (client, g_settings_set_string (data->settings, "filter-pattern", "");
FILE_BROWSER_BASE_KEY "/filter_pattern",
"",
NULL);
else else
mateconf_client_set_string (client, g_settings_set_string (data->settings, "filter-pattern", pattern);
FILE_BROWSER_BASE_KEY "/filter_pattern",
pattern,
NULL);
g_free (pattern); g_free (pattern);
} }
@ -1080,43 +974,27 @@ on_virtual_root_changed_cb (PlumaFileBrowserStore * store,
PlumaFileBrowserPluginData * data = get_plugin_data (window); PlumaFileBrowserPluginData * data = get_plugin_data (window);
gchar * root; gchar * root;
gchar * virtual_root; gchar * virtual_root;
MateConfClient * client;
root = pluma_file_browser_store_get_root (store); root = pluma_file_browser_store_get_root (store);
if (!root) if (!root)
return; return;
client = mateconf_client_get_default (); g_settings_set_string (data->onload_settings, "root", root);
if (!client)
return;
mateconf_client_set_string (client,
FILE_BROWSER_BASE_KEY "/on_load/root",
root,
NULL);
virtual_root = pluma_file_browser_store_get_virtual_root (store); virtual_root = pluma_file_browser_store_get_virtual_root (store);
if (!virtual_root) { if (!virtual_root) {
/* Set virtual to same as root then */ /* Set virtual to same as root then */
mateconf_client_set_string (client, g_settings_set_string (data->onload_settings, "virtual-root", root);
FILE_BROWSER_BASE_KEY "/on_load/virtual_root",
root,
NULL);
} else { } else {
mateconf_client_set_string (client, g_settings_set_string (data->onload_settings, "virtual-root", virtual_root);
FILE_BROWSER_BASE_KEY "/on_load/virtual_root",
virtual_root,
NULL);
} }
g_signal_handlers_disconnect_by_func (window, g_signal_handlers_disconnect_by_func (window,
G_CALLBACK (on_tab_added_cb), G_CALLBACK (on_tab_added_cb),
data); data);
g_object_unref (client);
g_free (root); g_free (root);
g_free (virtual_root); g_free (virtual_root);
} }
@ -1126,18 +1004,10 @@ on_tab_added_cb (PlumaWindow * window,
PlumaTab * tab, PlumaTab * tab,
PlumaFileBrowserPluginData * data) PlumaFileBrowserPluginData * data)
{ {
MateConfClient *client;
gboolean open; gboolean open;
gboolean load_default = TRUE; gboolean load_default = TRUE;
client = mateconf_client_get_default (); open = g_settings_get_boolean (data->settings, "open-at-first-doc");
if (!client)
return;
open = mateconf_client_get_bool (client,
FILE_BROWSER_BASE_KEY "/open_at_first_doc",
NULL);
if (open) { if (open) {
PlumaDocument *doc; PlumaDocument *doc;
@ -1159,8 +1029,6 @@ on_tab_added_cb (PlumaWindow * window,
if (load_default) if (load_default)
restore_default_location (data); restore_default_location (data);
g_object_unref (client);
/* Disconnect this signal, it's only called once */ /* Disconnect this signal, it's only called once */
g_signal_handlers_disconnect_by_func (window, g_signal_handlers_disconnect_by_func (window,
G_CALLBACK (on_tab_added_cb), G_CALLBACK (on_tab_added_cb),

View File

@ -1,97 +0,0 @@
<mateconfschemafile>
<schemalist>
<schema>
<key>/schemas/apps/pluma/plugins/filebrowser/on_load/tree_view</key>
<applyto>/apps/pluma/plugins/filebrowser/on_load/tree_view</applyto>
<owner>pluma</owner>
<type>bool</type>
<default>TRUE</default>
<locale name="C">
<short>Open With Tree View</short>
<long>Open the tree view when the file browser plugin gets loaded instead of the bookmarks view</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/pluma/plugins/filebrowser/on_load/root</key>
<applyto>/apps/pluma/plugins/filebrowser/on_load/root</applyto>
<owner>pluma</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>File Browser Root Directory</short>
<long>The file browser root directory to use when loading the file
browser plugin and onload/tree_view is TRUE.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/pluma/plugins/filebrowser/on_load/virtual_root</key>
<applyto>/apps/pluma/plugins/filebrowser/on_load/virtual_root</applyto>
<owner>pluma</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>File Browser Virtual Root Directory</short>
<long>The file browser virtual root directory to use when loading the
file browser plugin when onload/tree_view is TRUE. The virtual root
must always be below the actual root.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/pluma/plugins/filebrowser/on_load/enable_remote</key>
<applyto>/apps/pluma/plugins/filebrowser/on_load/enable_remote</applyto>
<owner>pluma</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short>Enable Restore of Remote Locations</short>
<long>Sets whether to enable restoring of remote locations.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/pluma/plugins/filebrowser/open_at_first_doc</key>
<applyto>/apps/pluma/plugins/filebrowser/open_at_first_doc</applyto>
<owner>pluma</owner>
<type>bool</type>
<default>TRUE</default>
<locale name="C">
<short>Set Location to First Document</short>
<long>If TRUE the file browser plugin will view the directory of
the first opened document given that the file browser hasn't been
used yet. (Thus this generally applies to opening a document from
the command line or opening it with Caja, etc.)</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/pluma/plugins/filebrowser/filter_mode</key>
<applyto>/apps/pluma/plugins/filebrowser/filter_mode</applyto>
<owner>pluma</owner>
<type>string</type>
<default>hidden_and_binary</default>
<locale name="C">
<short>File Browser Filter Mode</short>
<long>This value determines what files get filtered from the file
browser. Valid values are: none (filter nothing),
hidden (filter hidden files), binary (filter binary files) and
hidden_and_binary (filter both hidden and binary files).</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/pluma/plugins/filebrowser/filter_pattern</key>
<applyto>/apps/pluma/plugins/filebrowser/filter_pattern</applyto>
<owner>pluma</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>File Browser Filter Pattern</short>
<long>The filter pattern to filter the file browser with. This filter
works on top of the filter_mode.</long>
</locale>
</schema>
</schemalist>
</mateconfschemafile>