[gnome-applets/wip/gnome-3.10+: 11/29] mini-commander: port to GSettings
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/gnome-3.10+: 11/29] mini-commander: port to GSettings
- Date: Thu, 28 Aug 2014 15:51:19 +0000 (UTC)
commit cff5176a7545c39856db18602d5d12c717e6b388
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Mon Jul 7 18:45:45 2014 +0300
mini-commander: port to GSettings
mini-commander/src/Makefile.am | 42 +-
mini-commander/src/command_line.c | 19 +-
mini-commander/src/exec.c | 15 +-
mini-commander/src/gsettings.h | 24 +
mini-commander/src/history.c | 44 +-
mini-commander/src/mc-default-macros.h | 65 ---
mini-commander/src/mc-install-default-macros.c | 181 ------
.../src/mini-commander-global.schemas.in | 31 -
mini-commander/src/mini-commander.schemas.in | 193 -------
mini-commander/src/mini-commander.ui | 297 ++++++----
mini-commander/src/mini-commander_applet.c | 33 +-
mini-commander/src/mini-commander_applet.h | 4 +-
....gnome-applets.mini-commander.gschema.xml.in.in | 80 +++
mini-commander/src/preferences.c | 608 +++++---------------
mini-commander/src/preferences.h | 27 +-
po/POTFILES.in | 1 +
po/POTFILES.skip | 1 +
17 files changed, 511 insertions(+), 1154 deletions(-)
---
diff --git a/mini-commander/src/Makefile.am b/mini-commander/src/Makefile.am
index 2f5810c..b81d01e 100644
--- a/mini-commander/src/Makefile.am
+++ b/mini-commander/src/Makefile.am
@@ -10,9 +10,6 @@ AM_CPPFLAGS = \
libexec_PROGRAMS = mini_commander_applet
-tooldir = $(libexecdir)/gnome-applets
-tool_PROGRAMS = mc-install-default-macros
-
mini_commander_applet_SOURCES = \
about.c \
about.h \
@@ -32,18 +29,11 @@ mini_commander_applet_SOURCES = \
macro.h \
preferences.c \
preferences.h \
- mc-default-macros.h
+ gsettings.h
mini_commander_applet_LDADD = \
$(GNOME_APPLETS_LIBS)
-mc_install_default_macros_SOURCES = \
- mc-install-default-macros.c \
- mc-default-macros.h
-
-mc_install_default_macros_LDADD = \
- $(GNOME_APPLETS_LIBS)
-
builder_DATA = mini-commander.ui
BITMAPS = \
@@ -86,30 +76,34 @@ org.gnome.panel.applet.MiniCommanderAppletFactory.service: $(service_in_files)
-e "s|\ LIBEXECDIR\@|$(libexecdir)|" \
$< > $@
-CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(schemas_DATA)
+gsettings_schemas_in_in = \
+ org.gnome.gnome-applets.mini-commander.gschema.xml.in.in
-schemasdir = @GCONF_SCHEMA_FILE_DIR@
-schemas_in_files = mini-commander.schemas.in mini-commander-global.schemas.in
-schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
+ INTLTOOL_XML_NOMERGE_RULE@
- INTLTOOL_SCHEMAS_RULE@
+gsettings_schemas_in = $(gsettings_schemas_in_in:.xml.in.in=.xml.in)
+gsettings_SCHEMAS = $(gsettings_schemas_in:.xml.in=.xml)
+
+%.gschema.xml.in: %.gschema.xml.in.in Makefile
+ $(AM_V_GEN) $(SED) -e 's^\ GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' < $< > $@
+
+ GSETTINGS_RULES@
+
+CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) \
+ $(gsettings_SCHEMAS_in) \
+ $(gsettings_SCHEMAS) \
+ *.gschema.valid
uidir = $(pkgdatadir)/ui
ui_DATA = mini-commander-applet-menu.xml
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule
$(schemas_DATA) ;
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE)
$(top_builddir)/mini-commander/src/mc-install-default-macros
-endif
-
EXTRA_DIST = \
+ $(gsettings_schemas_in_in) \
org.gnome.applets.MiniCommanderApplet.panel-applet.in.in \
$(service_in_files) \
$(desktop_icons_DATA) \
$(BITMAPS) \
$(ui_DATA) \
- $(builder_DATA) \
- $(schemas_in_files)
+ $(builder_DATA)
-include $(top_srcdir)/git.mk
diff --git a/mini-commander/src/command_line.c b/mini-commander/src/command_line.c
index f229ce7..fc2be9e 100644
--- a/mini-commander/src/command_line.c
+++ b/mini-commander/src/command_line.c
@@ -545,13 +545,22 @@ mc_create_command_entry (MCData *mc)
void
mc_command_update_entry_color (MCData *mc)
{
+ GdkRGBA fg_color;
+ GdkRGBA bg_color;
GdkColor fg;
GdkColor bg;
char *rc_string;
- fg.red = mc->preferences.cmd_line_color_fg_r;
- fg.green = mc->preferences.cmd_line_color_fg_g;
- fg.blue = mc->preferences.cmd_line_color_fg_b;
+ gdk_rgba_parse (&fg_color, mc->preferences.cmd_line_color_fg);
+ gdk_rgba_parse (&bg_color, mc->preferences.cmd_line_color_bg);
+
+ fg.red = fg_color.red;
+ fg.green = fg_color.green;
+ fg.blue = fg_color.blue;
+
+ bg.red = bg_color.red;
+ bg.green = bg_color.green;
+ bg.blue = bg_color.blue;
/* FIXME: wish we had an API for this, see bug #79585 */
rc_string = g_strdup_printf (
@@ -570,10 +579,6 @@ mc_command_update_entry_color (MCData *mc)
gtk_widget_modify_text (mc->entry, GTK_STATE_NORMAL, &fg);
gtk_widget_modify_text (mc->entry, GTK_STATE_PRELIGHT, &fg);
- bg.red = mc->preferences.cmd_line_color_bg_r;
- bg.green = mc->preferences.cmd_line_color_bg_g;
- bg.blue = mc->preferences.cmd_line_color_bg_b;
-
gtk_widget_modify_base (mc->entry, GTK_STATE_NORMAL, &bg);
gtk_widget_modify_base (mc->entry, GTK_STATE_PRELIGHT, &bg);
}
diff --git a/mini-commander/src/exec.c b/mini-commander/src/exec.c
index f0e2c71..375e734 100644
--- a/mini-commander/src/exec.c
+++ b/mini-commander/src/exec.c
@@ -25,14 +25,12 @@
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
#include "exec.h"
#include "macro.h"
#include "preferences.h"
#include "history.h"
-
-#define KEY_AUDIBLE_BELL "/apps/metacity/general/audible_bell"
+#include "gsettings.h"
static void beep (void);
@@ -98,12 +96,11 @@ mc_exec_command (MCData *mc,
static void beep (void)
{
- GConfClient *default_client;
- gboolean audible_bell_set;
+ GSettings *settings = g_settings_new (GNOME_DESKTOP_WM_PREFERENCES);
+ gboolean audible_bell = g_settings_get_boolean (settings, KEY_AUDIBLE_BELL);
- default_client = gconf_client_get_default ();
- audible_bell_set = gconf_client_get_bool (default_client, KEY_AUDIBLE_BELL, NULL);
- if (audible_bell_set) {
+ if (audible_bell)
gdk_beep ();
- }
+
+ g_object_unref (settings);
}
diff --git a/mini-commander/src/gsettings.h b/mini-commander/src/gsettings.h
new file mode 100644
index 0000000..c0be4f1
--- /dev/null
+++ b/mini-commander/src/gsettings.h
@@ -0,0 +1,24 @@
+#ifndef GSETTINGS_H
+#define GSETTINGS_H
+
+#define GNOME_DESKTOP_LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown"
+#define GNOME_DESKTOP_WM_PREFERENCES "org.gnome.desktop.wm.preferences"
+#define MINI_COMMANDER_GLOBAL_SCHEMA "org.gnome.gnome-applets.mini-commander.global"
+#define MINI_COMMANDER_SCHEMA "org.gnome.gnome-applets.mini-commander"
+
+#define KEY_MACRO_PATTERNS "macro-patterns"
+#define KEY_MACRO_COMMANDS "macro-commands"
+
+#define KEY_AUDIBLE_BELL "audible-bell"
+
+#define KEY_SHOW_HANDLE "show-handle"
+#define KEY_SHOW_FRAME "show-frame"
+#define KEY_AUTOCOMPLETE_HISTORY "autocomplete-history"
+#define KEY_NORMAL_SIZE_X "normal-size-x"
+#define KEY_NORMAL_SIZE_Y "normal-size-y"
+#define KEY_SHOW_DEFAULT_THEME "show-default-theme"
+#define KEY_CMD_LINE_COLOR_FG "cmd-line-color-fg"
+#define KEY_CMD_LINE_COLOR_BG "cmd-line-color-bg"
+#define KEY_HISTORY "history"
+
+#endif
diff --git a/mini-commander/src/history.c b/mini-commander/src/history.c
index f78c1df..a5191e4 100644
--- a/mini-commander/src/history.c
+++ b/mini-commander/src/history.c
@@ -26,12 +26,11 @@
#include <string.h>
#include <stdlib.h>
-#include <gconf/gconf.h>
#include <panel-applet.h>
-#include <panel-applet-gconf.h>
#include "history.h"
#include "preferences.h"
+#include "gsettings.h"
static char *history_command[MC_HISTORY_LIST_LENGTH];
static void delete_history_entry(int element_number);
@@ -65,9 +64,7 @@ set_history_entry(int pos, char * entry)
void
append_history_entry(MCData *mcdata, const char * entry, gboolean load_history)
{
- PanelApplet *applet = mcdata->applet;
- GConfValue *history;
- GSList *list = NULL;
+ GArray *history;
int pos, i;
/* remove older dupes */
@@ -97,39 +94,24 @@ append_history_entry(MCData *mcdata, const char * entry, gboolean load_history)
return;
/* If not writable, just keeps the history around for this session */
- if ( ! mc_key_writable (mcdata, "history"))
+ if (!g_settings_is_writable (mcdata->settings, KEY_HISTORY))
return;
/* Save history - this seems like a waste to do it every time it's updated
** but it doesn't seem to work when called on the destroy signal of the applet
*/
- for(i = 0; i < MC_HISTORY_LIST_LENGTH; i++)
- {
- GConfValue *value_entry;
-
- value_entry = gconf_value_new (GCONF_VALUE_STRING);
- if(exists_history_entry(i)) {
- gconf_value_set_string (value_entry, (gchar *) get_history_entry(i));
- list = g_slist_append (list, value_entry);
- }
-
+ history = g_array_new (TRUE, TRUE, sizeof (gchar *));
+
+ for (i = 0; i < MC_HISTORY_LIST_LENGTH; i++) {
+ if (exists_history_entry(i)) {
+ gchar *entry = g_strdup (get_history_entry (i));
+ history = g_array_append_val (history, entry);
+ }
}
- history = gconf_value_new (GCONF_VALUE_LIST);
- if (list) {
- gconf_value_set_list_type (history, GCONF_VALUE_STRING);
- gconf_value_set_list (history, list);
- panel_applet_gconf_set_value (applet, "history", history, NULL);
- }
-
- while (list) {
- GConfValue *value = list->data;
- gconf_value_free (value);
- list = g_slist_next (list);
- }
-
- gconf_value_free (history);
-
+ g_settings_set_strv (mcdata->settings, KEY_HISTORY, (const gchar **) history->data);
+
+ g_array_free (history, TRUE);
}
void
diff --git a/mini-commander/src/mini-commander.ui b/mini-commander/src/mini-commander.ui
index 00ea5a9..87e0383 100644
--- a/mini-commander/src/mini-commander.ui
+++ b/mini-commander/src/mini-commander.ui
@@ -1,40 +1,91 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
+ <requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="adjustment1">
- <property name="value">1</property>
<property name="lower">50</property>
<property name="upper">400</property>
+ <property name="value">1</property>
<property name="step_increment">5</property>
<property name="page_increment">10</property>
</object>
<object class="GtkDialog" id="mc_preferences_dialog">
+ <property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Command Line Preferences</property>
<property name="type_hint">dialog</property>
- <property name="has_separator">False</property>
<child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox2">
+ <object class="GtkBox" id="dialog-vbox2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="help_button">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="done_button">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<object class="GtkNotebook" id="preferences_notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">5</property>
<child>
- <object class="GtkVBox" id="general_page_vbox">
+ <object class="GtkBox" id="general_page_vbox">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">12</property>
+ <property name="orientation">vertical</property>
<property name="spacing">18</property>
<child>
- <object class="GtkVBox" id="vbox10">
+ <object class="GtkBox" id="vbox10">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label24">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Auto Completion</property>
<attributes>
@@ -48,11 +99,13 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox6">
+ <object class="GtkBox" id="hbox6">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label25">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label"> </property>
</object>
<packing>
@@ -68,6 +121,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -78,21 +132,28 @@
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox11">
+ <object class="GtkBox" id="vbox11">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label26">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Size</property>
<attributes>
@@ -106,11 +167,13 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox7">
+ <object class="GtkBox" id="hbox7">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label27">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label"> </property>
</object>
<packing>
@@ -120,12 +183,14 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox1">
+ <object class="GtkBox" id="hbox1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="size_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_Width:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">size_spinner</property>
@@ -137,8 +202,9 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox9">
+ <object class="GtkBox" id="hbox9">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkSpinButton" id="size_spinner">
@@ -161,6 +227,7 @@
<child>
<object class="GtkLabel" id="size_post_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">pixels</property>
<accessibility>
<relation type="label-for" target="size_spinner"/>
@@ -175,31 +242,41 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox12">
+ <object class="GtkBox" id="vbox12">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label28">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Colors</property>
<attributes>
@@ -213,11 +290,13 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox8">
+ <object class="GtkBox" id="hbox8">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label29">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label"> </property>
</object>
<packing>
@@ -229,6 +308,7 @@
<child>
<object class="GtkTable" id="table2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
@@ -240,16 +320,18 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="fg_color_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Command line
_foreground:</property>
<property name="use_underline">True</property>
@@ -260,12 +342,13 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="bg_color_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Command line
_background:</property>
<property name="use_underline">True</property>
@@ -276,7 +359,7 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -293,7 +376,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -310,7 +393,7 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -318,16 +401,22 @@
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
@@ -336,6 +425,7 @@
<child type="tab">
<object class="GtkLabel" id="general_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">General</property>
</object>
<packing>
@@ -343,13 +433,16 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox13">
+ <object class="GtkBox" id="vbox13">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">12</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label30">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Macros:</property>
<property name="use_underline">True</property>
@@ -362,31 +455,37 @@
</packing>
</child>
<child>
- <object class="GtkHBox" id="hbox4">
+ <object class="GtkBox" id="hbox4">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkScrolledWindow" id="macros_scrolled_tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="macros_tree">
<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="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox7">
+ <object class="GtkBox" id="vbox7">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">4</property>
+ <property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="add_button">
@@ -396,16 +495,19 @@
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkHBox" id="hbox3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-add</property>
</object>
<packing>
@@ -417,6 +519,7 @@
<child>
<object class="GtkLabel" id="label20">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_Add Macro...</property>
<property name="use_underline">True</property>
</object>
@@ -445,16 +548,19 @@
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="stock">gtk-delete</property>
</object>
<packing>
@@ -466,6 +572,7 @@
<child>
<object class="GtkLabel" id="label19">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">_Delete Macro</property>
<property name="use_underline">True</property>
</object>
@@ -489,11 +596,14 @@
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -505,6 +615,7 @@
<child type="tab">
<object class="GtkLabel" id="label21">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">Macros</property>
<property name="use_underline">True</property>
</object>
@@ -515,15 +626,37 @@
</child>
</object>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-11">help_button</action-widget>
+ <action-widget response="-7">done_button</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="mc_macro_add_dialog">
+ <property name="visible">False</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Add New Macro</property>
+ <property name="resizable">False</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area2">
+ <object class="GtkButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="help_button">
+ <object class="GtkButton" id="helpbutton1">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -538,12 +671,11 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="done_button">
- <property name="label">gtk-close</property>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="has_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
@@ -553,34 +685,34 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
+ <property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-11">help_button</action-widget>
- <action-widget response="-7">done_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkDialog" id="mc_macro_add_dialog">
- <property name="visible">True</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Add New Macro</property>
- <property name="resizable">False</property>
- <property name="type_hint">dialog</property>
- <property name="has_separator">False</property>
- <child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox3">
- <property name="visible">True</property>
- <property name="spacing">2</property>
<child>
<object class="GtkTable" id="table3">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
@@ -589,6 +721,7 @@
<child>
<object class="GtkLabel" id="pattern_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Pattern:</property>
<property name="use_underline">True</property>
@@ -596,12 +729,13 @@
</object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
<object class="GtkLabel" id="command_label">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Co_mmand:</property>
<property name="use_underline">True</property>
@@ -611,7 +745,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -623,7 +757,7 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -637,69 +771,14 @@
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area3">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="helpbutton1">
- <property name="label">gtk-help</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button1">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button2">
- <property name="label">gtk-add</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
+ <property name="y_options"/>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
diff --git a/mini-commander/src/mini-commander_applet.c b/mini-commander/src/mini-commander_applet.c
index abfc328..6327486 100644
--- a/mini-commander/src/mini-commander_applet.c
+++ b/mini-commander/src/mini-commander_applet.c
@@ -31,12 +31,12 @@
#include <gtk/gtk.h>
#include <panel-applet.h>
-#include <gconf/gconf-client.h>
#include "mini-commander_applet.h"
#include "preferences.h"
#include "command_line.h"
#include "about.h"
#include "help.h"
+#include "gsettings.h"
#include "browser-mini.xpm"
#include "history-mini.xpm"
@@ -272,18 +272,24 @@ static void
mc_destroyed (GtkWidget *widget,
MCData *mc)
{
- GConfClient *client;
- int i;
+ if (mc->global_settings) {
+ g_object_unref (mc->global_settings);
+ mc->global_settings = NULL;
+ }
- client = gconf_client_get_default ();
- for (i = 0; i < MC_NUM_LISTENERS; i++) {
- gconf_client_notify_remove (client, mc->listeners [i]);
- mc->listeners [i] = 0;
+ if (mc->settings) {
+ g_object_unref (mc->settings);
+ mc->settings = NULL;
}
- g_object_unref (client);
mc_macros_free (mc->preferences.macros);
+ if (mc->preferences.cmd_line_color_fg)
+ g_free (mc->preferences.cmd_line_color_fg);
+
+ if (mc->preferences.cmd_line_color_bg)
+ g_free (mc->preferences.cmd_line_color_bg);
+
if (mc->prefs_dialog.dialog)
gtk_widget_destroy (mc->prefs_dialog.dialog);
@@ -327,13 +333,13 @@ static gboolean
mini_commander_applet_fill (PanelApplet *applet)
{
MCData *mc;
- GConfClient *client;
+ GSettings *settings;
GSimpleActionGroup *action_group;
GAction *action;
gchar *ui_path;
- client = gconf_client_get_default ();
- if (gconf_client_get_bool (client, "/desktop/gnome/lockdown/inhibit_command_line", NULL)) {
+ settings = g_settings_new (GNOME_DESKTOP_LOCKDOWN_SCHEMA);
+ if (g_settings_get_boolean (settings, "disable-command-line")) {
GtkWidget *error_dialog;
error_dialog = gtk_message_dialog_new (NULL,
@@ -353,6 +359,7 @@ mini_commander_applet_fill (PanelApplet *applet)
command line is disabled */
exit (1);
}
+ g_object_unref (settings);
g_set_application_name (_("Command Line"));
@@ -361,7 +368,9 @@ mini_commander_applet_fill (PanelApplet *applet)
mc = g_new0 (MCData, 1);
mc->applet = applet;
- panel_applet_add_preferences (applet, "/schemas/apps/mini-commander/prefs", NULL);
+ mc->global_settings = g_settings_new (MINI_COMMANDER_GLOBAL_SCHEMA);
+ mc->settings = panel_applet_settings_new (applet, MINI_COMMANDER_SCHEMA);
+
panel_applet_set_flags (applet, PANEL_APPLET_EXPAND_MINOR);
mc_load_preferences (mc);
command_line_init_stock_icons ();
diff --git a/mini-commander/src/mini-commander_applet.h b/mini-commander/src/mini-commander_applet.h
index a64327c..a8b5a3d 100644
--- a/mini-commander/src/mini-commander_applet.h
+++ b/mini-commander/src/mini-commander_applet.h
@@ -45,6 +45,9 @@ typedef struct _MCData MCData;
struct _MCData {
PanelApplet *applet;
+ GSettings *global_settings;
+ GSettings *settings;
+
GtkWidget *applet_box;
GtkWidget *entry;
@@ -56,7 +59,6 @@ struct _MCData {
MCPreferences preferences;
MCPrefsDialog prefs_dialog;
- guint listeners [MC_NUM_LISTENERS];
gboolean error;
PanelAppletOrient orient;
};
diff --git a/mini-commander/src/org.gnome.gnome-applets.mini-commander.gschema.xml.in.in
b/mini-commander/src/org.gnome.gnome-applets.mini-commander.gschema.xml.in.in
new file mode 100644
index 0000000..43a98a1
--- /dev/null
+++ b/mini-commander/src/org.gnome.gnome-applets.mini-commander.gschema.xml.in.in
@@ -0,0 +1,80 @@
+<schemalist gettext-domain="@GETTEXT_PACKAGE@">
+ <schema id="org.gnome.gnome-applets.mini-commander.global"
path="/org/gnome/gnome-applets/mini-commander/">
+ <key name="macro-patterns" type="as">
+ <default>
+ [
+ '^(https?://.*)$',
+ '^(ftp://.*)',
+ '^(www\\..*)$',
+ '^(ftp\\..*)$',
+ '^av: *(.*)$',
+ '^yahoo: *(.*)$',
+ '^fm: *(.*)$',
+ '^dictionary: *(.*)$',
+ '^google: *(.*)$'
+ ]
+ </default>
+ <_summary>Macro pattern list</_summary>
+ <_description>List of entries containing strings for the macro
patterns.</_description>
+ </key>
+ <key name="macro-commands" type="as">
+ <default>
+ [
+ 'gnome-open \\1',
+ 'gnome-open \\1',
+ 'gnome-open http://\\1',
+ 'gnome-open ftp://\\1',
+ "gnome-open
http://www.altavista.net/cgi-bin/query?pg=q\\&kl=XX\\&q=$(echo '\\1'|sed -e ': p;s/+/%2B/;t p;:
s;s/\\ /+/;t s;: q;s/\\\"/%22/;t q')",
+ "gnome-open http://ink.yahoo.com/bin/query?p=$(echo '\\1'|sed -e ':
p;s/+/%2B/;t p;: s;s/\\ /+/;t s;: q;s/\\\"/%22/;t q')",
+ "gnome-open http://core.freshmeat.net/search.php3?query=$(echo '\\1'|tr \" \"
+)",
+ 'gnome-dictionary "\\1"',
+ 'gnome-open http://www.google.com/search?q=\\1'
+ ]
+ </default>
+ <_summary>Macro command list</_summary>
+ <_description>List of entries containing strings for the macro
commands.</_description>
+ </key>
+ </schema>
+ <schema id="org.gnome.gnome-applets.mini-commander">
+ <key name="show-handle" type="b">
+ <default>false</default>
+ <_summary>Show handle</_summary>
+ <_description>Show a handle so the applet can be detached from the
panel.</_description>
+ </key>
+ <key name="show-frame" type="b">
+ <default>false</default>
+ <_summary>Show frame</_summary>
+ <_description>Show a frame surrounding the applet.</_description>
+ </key>
+ <key name="autocomplete-history" type="b">
+ <default>true</default>
+ <_summary>Perform history autocompletion</_summary>
+ <_description>Attempt to autocomplete a command from the history of commands
entered.</_description>
+ </key>
+ <key name="normal-size-x" type="i">
+ <default>150</default>
+ <_summary>Width</_summary>
+ <_description>Width of the applet</_description>
+ </key>
+ <key name="show-default-theme" type="b">
+ <default>true</default>
+ <_summary>Use the default theme colors</_summary>
+ <_description>Use theme colors instead of custom ones.</_description>
+ </key>
+ <key name="cmd-line-color-fg" type="s">
+ <default>'rgba(255,255,255,1)'</default>
+ <_summary>Foreground color</_summary>
+ <_description></_description>
+ </key>
+ <key name="cmd-line-color-bg" type="s">
+ <default>'rgba(0,0,0,1)'</default>
+ <_summary>Background color</_summary>
+ <_description></_description>
+ </key>
+ <key name="history" type="as">
+ <default>[]</default>
+ <_summary>History list</_summary>
+ <_description>List of entries containing strings for history entries.</_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/mini-commander/src/preferences.c b/mini-commander/src/preferences.c
index 805a0a5..11e086f 100644
--- a/mini-commander/src/preferences.c
+++ b/mini-commander/src/preferences.c
@@ -30,13 +30,11 @@
#include <gtk/gtk.h>
#include <panel-applet.h>
-#include <panel-applet-gconf.h>
-#include <gconf/gconf-client.h>
#include "mini-commander_applet.h"
#include "command_line.h"
#include "history.h"
-#include "mc-default-macros.h"
+#include "gsettings.h"
enum {
COLUMN_PATTERN,
@@ -56,7 +54,6 @@ hard_set_sensitive (GtkWidget *w, gboolean sensitivity)
GINT_TO_POINTER ( ! sensitivity));
}
-
/* set sensitive, but always insensitive if NEVER_SENSITIVE is set */
static void
soft_set_sensitive (GtkWidget *w, gboolean sensitivity)
@@ -67,161 +64,82 @@ soft_set_sensitive (GtkWidget *w, gboolean sensitivity)
gtk_widget_set_sensitive (w, sensitivity);
}
-gboolean
-mc_key_writable (MCData *mc, const char *key)
-{
- gboolean writable;
- char *fullkey;
- static GConfClient *client = NULL;
- if (client == NULL)
- client = gconf_client_get_default ();
-
- fullkey = panel_applet_gconf_get_full_key (mc->applet, key);
-
- writable = gconf_client_key_is_writable (client, fullkey, NULL);
-
- g_free (fullkey);
-
- return writable;
-}
-
-
-/* GConf notification handlers
- */
static void
-show_default_theme_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
+show_default_theme_changed (GSettings *settings,
+ const gchar *key,
+ MCData *mc)
{
- if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
- return;
+ mc->preferences.show_default_theme = g_settings_get_boolean (mc->settings, key);
- mc->preferences.show_default_theme = gconf_value_get_bool (entry->value);
+ if (mc->prefs_dialog.dialog)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mc->prefs_dialog.use_default_theme_toggle),
+ mc->preferences.show_default_theme);
mc_applet_draw (mc); /* FIXME: we shouldn't have to redraw the whole applet */
}
static void
-auto_complete_history_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
+auto_complete_history_changed (GSettings *settings,
+ const gchar *key,
+ MCData *mc)
{
- if (!entry->value || entry->value->type != GCONF_VALUE_BOOL)
- return;
+ mc->preferences.auto_complete_history = g_settings_get_boolean (mc->settings, key);
- mc->preferences.auto_complete_history = gconf_value_get_bool (entry->value);
+ if (mc->prefs_dialog.dialog)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mc->prefs_dialog.auto_complete_history_toggle),
+ mc->preferences.auto_complete_history);
}
static void
-normal_size_x_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
+normal_size_x_changed (GSettings *settings,
+ const gchar *key,
+ MCData *mc)
{
- if (!entry->value || entry->value->type != GCONF_VALUE_INT)
- return;
+ mc->preferences.normal_size_x = g_settings_get_int (mc->settings, key);
- mc->preferences.normal_size_x = gconf_value_get_int (entry->value);
+ if (mc->prefs_dialog.dialog)
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (mc->prefs_dialog.size_spinner),
+ mc->preferences.normal_size_x);
mc_command_update_entry_size (mc);
}
static void
-normal_size_y_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
-{
- if (!entry->value || entry->value->type != GCONF_VALUE_INT)
- return;
-
- mc->preferences.normal_size_y = gconf_value_get_int (entry->value);
-
- mc_applet_draw (mc); /* FIXME: we shouldn't have to redraw the whole applet */
-}
-
-static void
-cmd_line_color_fg_r_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
-{
- if (!entry->value || entry->value->type != GCONF_VALUE_INT)
- return;
-
- mc->preferences.cmd_line_color_fg_r = gconf_value_get_int (entry->value);
-
- mc_command_update_entry_color (mc);
-}
-
-static void
-cmd_line_color_fg_g_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
-{
- if (!entry->value || entry->value->type != GCONF_VALUE_INT)
- return;
-
- mc->preferences.cmd_line_color_fg_g = gconf_value_get_int (entry->value);
-
- mc_command_update_entry_color (mc);
-}
-
-static void
-cmd_line_color_fg_b_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
+cmd_line_color_fg_changed (GSettings *settings,
+ const gchar *key,
+ MCData *mc)
{
- if (!entry->value || entry->value->type != GCONF_VALUE_INT)
- return;
+ GdkRGBA color;
- mc->preferences.cmd_line_color_fg_b = gconf_value_get_int (entry->value);
+ if (mc->preferences.cmd_line_color_fg)
+ g_free (mc->preferences.cmd_line_color_fg);
- mc_command_update_entry_color (mc);
-}
+ mc->preferences.cmd_line_color_fg = g_strdup (g_settings_get_string (mc->settings, key));
-static void
-cmd_line_color_bg_r_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
-{
- if (!entry->value || entry->value->type != GCONF_VALUE_INT)
- return;
-
- mc->preferences.cmd_line_color_bg_r = gconf_value_get_int (entry->value);
+ if (mc->prefs_dialog.dialog) {
+ gdk_rgba_parse (&color, mc->preferences.cmd_line_color_fg);
+ gtk_color_button_set_rgba (GTK_COLOR_BUTTON (mc->prefs_dialog.fg_color_picker), &color);
+ }
mc_command_update_entry_color (mc);
}
static void
-cmd_line_color_bg_g_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
+cmd_line_color_bg_changed (GSettings *settings,
+ const gchar *key,
+ MCData *mc)
{
- if (!entry->value || entry->value->type != GCONF_VALUE_INT)
- return;
+ GdkRGBA color;
- mc->preferences.cmd_line_color_bg_g = gconf_value_get_int (entry->value);
+ if (mc->preferences.cmd_line_color_bg)
+ g_free (mc->preferences.cmd_line_color_bg);
- mc_command_update_entry_color (mc);
-}
+ mc->preferences.cmd_line_color_bg = g_strdup (g_settings_get_string (mc->settings, key));
-static void
-cmd_line_color_bg_b_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
-{
- if (!entry->value || entry->value->type != GCONF_VALUE_INT)
- return;
-
- mc->preferences.cmd_line_color_bg_b = gconf_value_get_int (entry->value);
+ if (mc->prefs_dialog.dialog) {
+ gdk_rgba_parse (&color, mc->preferences.cmd_line_color_bg);
+ gtk_color_button_set_rgba (GTK_COLOR_BUTTON (mc->prefs_dialog.bg_color_picker), &color);
+ }
mc_command_update_entry_color (mc);
}
@@ -240,14 +158,10 @@ load_macros_in_idle (MCData *mc)
}
static void
-macros_changed (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- MCData *mc)
+macros_changed (GSettings *settings,
+ const gchar *key,
+ MCData *mc)
{
- if (!entry->value || entry->value->type != GCONF_VALUE_LIST)
- return;
-
if (mc->preferences.idle_macros_loader_id == 0)
mc->preferences.idle_macros_loader_id =
g_idle_add ((GSourceFunc) load_macros_in_idle, mc);
@@ -256,57 +170,37 @@ macros_changed (GConfClient *client,
/* Properties dialog
*/
static void
-save_macros_to_gconf (MCData *mc)
+save_macros_to_gsettings (MCData *mc)
{
MCPrefsDialog *dialog;
GtkTreeIter iter;
- GConfValue *patterns;
- GConfValue *commands;
- GSList *pattern_list = NULL;
- GSList *command_list = NULL;
- GConfClient *client;
+ GArray *patterns;
+ GArray *commands;
dialog = &mc->prefs_dialog;
if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->macros_store), &iter))
- return;
-
- patterns = gconf_value_new (GCONF_VALUE_LIST);
- gconf_value_set_list_type (patterns, GCONF_VALUE_STRING);
+ return;
- commands = gconf_value_new (GCONF_VALUE_LIST);
- gconf_value_set_list_type (commands, GCONF_VALUE_STRING);
+ patterns = g_array_new (TRUE, TRUE, sizeof (gchar *));
+ commands = g_array_new (TRUE, TRUE, sizeof (gchar *));
do {
- char *pattern = NULL;
- char *command = NULL;
+ char *pattern = NULL;
+ char *command = NULL;
- gtk_tree_model_get (
- GTK_TREE_MODEL (dialog->macros_store), &iter,
- 0, &pattern,
- 1, &command,
- -1);
-
- pattern_list = g_slist_prepend (pattern_list,
- gconf_value_new_from_string (GCONF_VALUE_STRING, pattern, NULL));
- command_list = g_slist_prepend (command_list,
- gconf_value_new_from_string (GCONF_VALUE_STRING, command, NULL));
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->macros_store), &iter,
+ 0, &pattern, 1, &command, -1);
+
+ patterns = g_array_append_val (patterns, pattern);
+ commands = g_array_append_val (commands, command);
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->macros_store), &iter));
- pattern_list = g_slist_reverse (pattern_list);
- command_list = g_slist_reverse (command_list);
+ g_settings_set_strv (mc->global_settings, KEY_MACRO_PATTERNS, (const char **) patterns->data);
+ g_settings_set_strv (mc->global_settings, KEY_MACRO_COMMANDS, (const char **) commands->data);
- gconf_value_set_list_nocopy (patterns, pattern_list); pattern_list = NULL;
- gconf_value_set_list_nocopy (commands, command_list); command_list = NULL;
-
- client = gconf_client_get_default ();
- gconf_client_set (client, "/apps/mini-commander/macro_patterns",
- patterns, NULL);
- gconf_client_set (client, "/apps/mini-commander/macro_commands",
- commands, NULL);
-
- gconf_value_free (patterns);
- gconf_value_free (commands);
+ g_array_free (patterns, TRUE);
+ g_array_free (commands, TRUE);
}
static gboolean
@@ -437,7 +331,7 @@ add_response (GtkWidget *window,
gtk_editable_delete_text (GTK_EDITABLE (dialog->pattern_entry), 0, -1);
gtk_editable_delete_text (GTK_EDITABLE (dialog->command_entry), 0, -1);
- save_macros_to_gconf (mc);
+ save_macros_to_gsettings (mc);
}
break;
case GTK_RESPONSE_HELP:
@@ -513,7 +407,7 @@ macro_delete (GtkWidget *button,
gtk_list_store_remove (dialog->macros_store, &iter);
- save_macros_to_gconf (mc);
+ save_macros_to_gsettings (mc);
}
static void
@@ -557,33 +451,35 @@ macro_edited (GtkCellRendererText *renderer,
if (gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (dialog->macros_store), &iter, path))
gtk_list_store_set (dialog->macros_store, &iter, col, new_text, -1);
- save_macros_to_gconf (mc);
+ save_macros_to_gsettings (mc);
}
static void
foreground_color_set (GtkColorButton *color_button,
MCData *mc)
{
- GdkColor color;
-
- gtk_color_button_get_color (color_button, &color);
-
- panel_applet_gconf_set_int (mc->applet, "cmd_line_color_fg_r", (int) color.red, NULL);
- panel_applet_gconf_set_int (mc->applet, "cmd_line_color_fg_g", (int) color.green, NULL);
- panel_applet_gconf_set_int (mc->applet, "cmd_line_color_fg_b", (int) color.blue, NULL);
+ GdkRGBA color;
+ gchar *str;
+
+ gtk_color_button_get_rgba (color_button, &color);
+
+ str = gdk_rgba_to_string (&color);
+ g_settings_set_string (mc->settings, KEY_CMD_LINE_COLOR_FG, str);
+ g_free (str);
}
static void
background_color_set (GtkColorButton *color_button,
MCData *mc)
{
- GdkColor color;
-
- gtk_color_button_get_color (color_button, &color);
-
- panel_applet_gconf_set_int (mc->applet, "cmd_line_color_bg_r", (int) color.red, NULL);
- panel_applet_gconf_set_int (mc->applet, "cmd_line_color_bg_g", (int) color.green, NULL);
- panel_applet_gconf_set_int (mc->applet, "cmd_line_color_bg_b", (int) color.blue, NULL);
+ GdkRGBA color;
+ gchar *str;
+
+ gtk_color_button_get_rgba (color_button, &color);
+
+ str = gdk_rgba_to_string (&color);
+ g_settings_set_string (mc->settings, KEY_CMD_LINE_COLOR_BG, str);
+ g_free (str);
}
static void
@@ -595,9 +491,8 @@ auto_complete_history_toggled (GtkToggleButton *toggle,
auto_complete_history = gtk_toggle_button_get_active (toggle);
if (auto_complete_history == mc->preferences.auto_complete_history)
return;
-
- panel_applet_gconf_set_bool (mc->applet, "autocomplete_history",
- auto_complete_history, NULL);
+
+ g_settings_set_boolean (mc->settings, KEY_AUTOCOMPLETE_HISTORY, auto_complete_history);
}
static void
@@ -610,7 +505,7 @@ size_value_changed (GtkSpinButton *spinner,
if (size == mc->preferences.normal_size_x)
return;
- panel_applet_gconf_set_int (mc->applet, "normal_size_x", size, NULL);
+ g_settings_set_int (mc->settings, KEY_NORMAL_SIZE_X, size);
}
static void
@@ -626,7 +521,7 @@ use_default_theme_toggled (GtkToggleButton *toggle,
soft_set_sensitive (mc->prefs_dialog.fg_color_picker, !use_default_theme);
soft_set_sensitive (mc->prefs_dialog.bg_color_picker, !use_default_theme);
- panel_applet_gconf_set_bool (mc->applet, "show_default_theme", use_default_theme, NULL);
+ g_settings_set_boolean (mc->settings, KEY_SHOW_DEFAULT_THEME, use_default_theme);
}
static void
@@ -673,8 +568,7 @@ mc_preferences_setup_dialog (GtkBuilder *builder,
{
MCPrefsDialog *dialog;
GtkCellRenderer *renderer;
- GConfClient *client;
- GdkColor color;
+ GdkRGBA color;
dialog = &mc->prefs_dialog;
@@ -698,14 +592,14 @@ mc_preferences_setup_dialog (GtkBuilder *builder,
G_CALLBACK (auto_complete_history_toggled), mc);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->auto_complete_history_toggle),
mc->preferences.auto_complete_history);
- if ( ! mc_key_writable (mc, "autocomplete_history"))
+ if (!g_settings_is_writable (mc->settings, KEY_AUTOCOMPLETE_HISTORY))
hard_set_sensitive (dialog->auto_complete_history_toggle, FALSE);
/* Width */
gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->size_spinner), mc->preferences.normal_size_x);
g_signal_connect (dialog->size_spinner, "value_changed",
G_CALLBACK (size_value_changed), mc);
- if ( ! mc_key_writable (mc, "normal_size_x")) {
+ if (!g_settings_is_writable (mc->settings, KEY_NORMAL_SIZE_X)) {
hard_set_sensitive (dialog->size_spinner, FALSE);
hard_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "size_label")), FALSE);
hard_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "size_post_label")), FALSE);
@@ -716,21 +610,17 @@ mc_preferences_setup_dialog (GtkBuilder *builder,
G_CALLBACK (use_default_theme_toggled), mc);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->use_default_theme_toggle),
mc->preferences.show_default_theme);
- if ( ! mc_key_writable (mc, "show_default_theme"))
+ if (!g_settings_is_writable (mc->settings, KEY_SHOW_DEFAULT_THEME))
hard_set_sensitive (dialog->use_default_theme_toggle, FALSE);
/* Foreground color */
g_signal_connect (dialog->fg_color_picker, "color_set",
G_CALLBACK (foreground_color_set), mc);
- color.red = mc->preferences.cmd_line_color_fg_r;
- color.green = mc->preferences.cmd_line_color_fg_g;
- color.blue = mc->preferences.cmd_line_color_fg_b;
- gtk_color_button_set_color (GTK_COLOR_BUTTON (dialog->fg_color_picker), &color);
+ gdk_rgba_parse (&color, mc->preferences.cmd_line_color_fg);
+ gtk_color_button_set_rgba (GTK_COLOR_BUTTON (dialog->fg_color_picker), &color);
soft_set_sensitive (dialog->fg_color_picker, !mc->preferences.show_default_theme);
- if ( ! mc_key_writable (mc, "cmd_line_color_fg_r") ||
- ! mc_key_writable (mc, "cmd_line_color_fg_g") ||
- ! mc_key_writable (mc, "cmd_line_color_fg_b")) {
+ if (!g_settings_is_writable (mc->settings, KEY_CMD_LINE_COLOR_FG)) {
hard_set_sensitive (dialog->fg_color_picker, FALSE);
hard_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "fg_color_label")), FALSE);
}
@@ -738,15 +628,11 @@ mc_preferences_setup_dialog (GtkBuilder *builder,
/* Background color */
g_signal_connect (dialog->bg_color_picker, "color_set",
G_CALLBACK (background_color_set), mc);
- color.red = mc->preferences.cmd_line_color_bg_r;
- color.green = mc->preferences.cmd_line_color_bg_g;
- color.blue = mc->preferences.cmd_line_color_bg_b;
- gtk_color_button_set_color (GTK_COLOR_BUTTON (dialog->bg_color_picker), &color);
+ gdk_rgba_parse (&color, mc->preferences.cmd_line_color_bg);
+ gtk_color_button_set_rgba (GTK_COLOR_BUTTON (dialog->bg_color_picker), &color);
soft_set_sensitive (dialog->bg_color_picker, !mc->preferences.show_default_theme);
- if ( ! mc_key_writable (mc, "cmd_line_color_bg_r") ||
- ! mc_key_writable (mc, "cmd_line_color_bg_g") ||
- ! mc_key_writable (mc, "cmd_line_color_bg_b")) {
+ if (!g_settings_is_writable (mc->settings, KEY_CMD_LINE_COLOR_BG)) {
hard_set_sensitive (dialog->bg_color_picker, FALSE);
hard_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "bg_color_label")), FALSE);
}
@@ -756,11 +642,8 @@ mc_preferences_setup_dialog (GtkBuilder *builder,
g_signal_connect (dialog->delete_button, "clicked", G_CALLBACK (macro_delete), mc);
g_signal_connect (dialog->add_button, "clicked", G_CALLBACK (macro_add), mc);
- client = gconf_client_get_default ();
- if ( ! gconf_client_key_is_writable (client,
- "/apps/mini-commander/macro_patterns", NULL) ||
- ! gconf_client_key_is_writable (client,
- "/apps/mini-commander/macro_commands", NULL)) {
+ if (!g_settings_is_writable (mc->global_settings, KEY_MACRO_PATTERNS) ||
+ !g_settings_is_writable (mc->global_settings, KEY_MACRO_COMMANDS)) {
hard_set_sensitive (dialog->add_button, FALSE);
hard_set_sensitive (dialog->delete_button, FALSE);
hard_set_sensitive (dialog->macros_tree, FALSE);
@@ -863,276 +746,69 @@ mc_macros_free (GSList *macros)
static GSList *
mc_load_macros (MCData *mc)
{
- GConfValue *macro_patterns;
- GConfValue *macro_commands;
- GSList *macros_list = NULL;
- GConfClient *client;
-
- client = gconf_client_get_default ();
- macro_patterns = gconf_client_get (client,
- "/apps/mini-commander/macro_patterns", NULL);
- macro_commands = gconf_client_get (client,
- "/apps/mini-commander/macro_commands", NULL);
-
- if (macro_patterns && macro_commands) {
- GSList *patterns;
- GSList *commands;
-
- patterns = gconf_value_get_list (macro_patterns);
- commands = gconf_value_get_list (macro_commands);
-
- for (; patterns && commands; patterns = patterns->next, commands = commands->next) {
- GConfValue *v1 = patterns->data;
- GConfValue *v2 = commands->data;
- MCMacro *macro;
- const char *pattern, *command;
-
- pattern = gconf_value_get_string (v1);
- command = gconf_value_get_string (v2);
+ gchar **macro_patterns;
+ gchar **macro_commands;
+ GSList *macros_list = NULL;
+ guint i;
- if (!(macro = mc_macro_new (pattern, command)))
- continue;
+ macro_patterns = g_settings_get_strv (mc->global_settings, KEY_MACRO_PATTERNS);
+ macro_commands = g_settings_get_strv (mc->global_settings, KEY_MACRO_COMMANDS);
- macros_list = g_slist_prepend (macros_list, macro);
- }
- } else {
- int i;
+ for (i = 0; macro_patterns[i] != NULL && macro_commands[i] != NULL; i++) {
+ MCMacro *macro;
- for (i = 0; i < G_N_ELEMENTS (mc_default_macros); i++)
- macros_list = g_slist_prepend (macros_list,
- mc_macro_new (mc_default_macros [i].pattern,
- mc_default_macros [i].command));
- }
+ if (!(macro = mc_macro_new (macro_patterns[i], macro_commands[i])))
+ continue;
- macros_list = g_slist_reverse (macros_list);
+ macros_list = g_slist_prepend (macros_list, macro);
+ }
- if (macro_commands)
- gconf_value_free (macro_commands);
+ g_strfreev (macro_patterns);
+ g_strfreev (macro_commands);
- if (macro_patterns)
- gconf_value_free (macro_patterns);
+ macros_list = g_slist_reverse (macros_list);
return macros_list;
}
-static void
-mc_setup_listeners (MCData *mc)
-{
- GConfClient *client;
- char *key;
- int i = 0;
-
- client = gconf_client_get_default ();
- gconf_client_add_dir (client, "/apps/mini-commander",
- GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "show_default_theme");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) show_default_theme_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "autocomplete_history");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) auto_complete_history_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "normal_size_x");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) normal_size_x_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "normal_size_y");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) normal_size_y_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_fg_r");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) cmd_line_color_fg_r_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_fg_g");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) cmd_line_color_fg_g_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_fg_b");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) cmd_line_color_fg_b_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_bg_r");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) cmd_line_color_bg_r_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_bg_g");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) cmd_line_color_bg_g_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
- key = panel_applet_gconf_get_full_key (PANEL_APPLET (mc->applet), "cmd_line_color_bg_b");
- mc->listeners [i++] = gconf_client_notify_add (
- client, key,
- (GConfClientNotifyFunc) cmd_line_color_bg_b_changed,
- mc,
- NULL, NULL);
- g_free (key);
-
- mc->listeners [i++] = gconf_client_notify_add (
- client, "/apps/mini-commander/macro_patterns",
- (GConfClientNotifyFunc) macros_changed,
- mc,
- NULL, NULL);
-
- mc->listeners [i++] = gconf_client_notify_add (
- client, "/apps/mini-commander/macro_commands",
- (GConfClientNotifyFunc) macros_changed,
- mc,
- NULL, NULL);
-
- g_assert (i == MC_NUM_LISTENERS);
-
- g_object_unref (client);
-}
-
void
mc_load_preferences (MCData *mc)
{
- GConfValue *history;
- GError *error = NULL;
+ gchar **history;
+ guint i;
g_return_if_fail (mc != NULL);
g_return_if_fail (PANEL_IS_APPLET (mc->applet));
- mc->preferences.show_default_theme =
- panel_applet_gconf_get_bool (mc->applet, "show_default_theme", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.show_default_theme = MC_DEFAULT_SHOW_DEFAULT_THEME;
- }
-
- mc->preferences.auto_complete_history =
- panel_applet_gconf_get_bool (mc->applet, "autocomplete_history", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.auto_complete_history = MC_DEFAULT_AUTO_COMPLETE_HISTORY;
- }
-
- mc->preferences.normal_size_x =
- panel_applet_gconf_get_int (mc->applet, "normal_size_x", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.normal_size_x = MC_DEFAULT_NORMAL_SIZE_X;
- }
- mc->preferences.normal_size_x = MAX (mc->preferences.normal_size_x, 50);
-
- mc->preferences.normal_size_y =
- panel_applet_gconf_get_int (mc->applet, "normal_size_y", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.normal_size_y = MC_DEFAULT_NORMAL_SIZE_Y;
- }
- mc->preferences.normal_size_y = CLAMP (mc->preferences.normal_size_y, 5, 200);
-
- mc->preferences.cmd_line_color_fg_r =
- panel_applet_gconf_get_int (mc->applet, "cmd_line_color_fg_r", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.cmd_line_color_fg_r = MC_DEFAULT_CMD_LINE_COLOR_FG_R;
- }
-
- mc->preferences.cmd_line_color_fg_g =
- panel_applet_gconf_get_int (mc->applet, "cmd_line_color_fg_g", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.cmd_line_color_fg_g = MC_DEFAULT_CMD_LINE_COLOR_FG_G;
- }
-
- mc->preferences.cmd_line_color_fg_b =
- panel_applet_gconf_get_int (mc->applet, "cmd_line_color_fg_b", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.cmd_line_color_fg_b = MC_DEFAULT_CMD_LINE_COLOR_FG_B;
- }
-
- mc->preferences.cmd_line_color_bg_r =
- panel_applet_gconf_get_int (mc->applet, "cmd_line_color_bg_r", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.cmd_line_color_bg_r = MC_DEFAULT_CMD_LINE_COLOR_BG_R;
- }
-
- mc->preferences.cmd_line_color_bg_g =
- panel_applet_gconf_get_int (mc->applet, "cmd_line_color_bg_g", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.cmd_line_color_bg_g = MC_DEFAULT_CMD_LINE_COLOR_BG_G;
- }
-
- mc->preferences.cmd_line_color_bg_b =
- panel_applet_gconf_get_int (mc->applet, "cmd_line_color_bg_b", &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- mc->preferences.cmd_line_color_bg_b = MC_DEFAULT_CMD_LINE_COLOR_BG_B;
- }
+ mc->preferences.show_default_theme = g_settings_get_boolean (mc->settings, KEY_SHOW_DEFAULT_THEME);
+ mc->preferences.auto_complete_history = g_settings_get_boolean (mc->settings, KEY_AUTOCOMPLETE_HISTORY);
+ mc->preferences.normal_size_x = MAX (g_settings_get_int (mc->settings, KEY_NORMAL_SIZE_X), 50);
+ mc->preferences.normal_size_y = 48;
+ mc->preferences.cmd_line_color_fg = g_strdup (g_settings_get_string (mc->settings,
KEY_CMD_LINE_COLOR_FG));
+ mc->preferences.cmd_line_color_bg = g_strdup (g_settings_get_string (mc->settings,
KEY_CMD_LINE_COLOR_BG));
+
+ g_signal_connect (mc->settings, "changed::" KEY_SHOW_DEFAULT_THEME,
+ G_CALLBACK (show_default_theme_changed), mc);
+ g_signal_connect (mc->settings, "changed::" KEY_AUTOCOMPLETE_HISTORY,
+ G_CALLBACK (auto_complete_history_changed), mc);
+ g_signal_connect (mc->settings, "changed::" KEY_NORMAL_SIZE_X,
+ G_CALLBACK (normal_size_x_changed), mc);
+ g_signal_connect (mc->settings, "changed::" KEY_CMD_LINE_COLOR_FG,
+ G_CALLBACK (cmd_line_color_fg_changed), mc);
+ g_signal_connect (mc->settings, "changed::" KEY_CMD_LINE_COLOR_BG,
+ G_CALLBACK (cmd_line_color_bg_changed), mc);
mc->preferences.macros = mc_load_macros (mc);
- history = panel_applet_gconf_get_value (mc->applet, "history", NULL);
- if (history) {
- GSList *l;
-
- for (l = gconf_value_get_list (history); l; l = l->next) {
- const char *entry = NULL;
-
- if ((entry = gconf_value_get_string (l->data)))
- append_history_entry (mc, entry, TRUE);
- }
-
- gconf_value_free (history);
- }
-
- mc_setup_listeners (mc);
+ g_signal_connect (mc->global_settings, "changed::" KEY_MACRO_PATTERNS,
+ G_CALLBACK (macros_changed), mc);
+ g_signal_connect (mc->global_settings, "changed::" KEY_MACRO_COMMANDS,
+ G_CALLBACK (macros_changed), mc);
mc->preferences.idle_macros_loader_id = 0;
+
+ history = g_settings_get_strv (mc->settings, KEY_HISTORY);
+ for (i = 0; history[i] != NULL; i++) {
+ append_history_entry (mc, history[i], TRUE);
+ }
}
diff --git a/mini-commander/src/preferences.h b/mini-commander/src/preferences.h
index 2b1940a..2645006 100644
--- a/mini-commander/src/preferences.h
+++ b/mini-commander/src/preferences.h
@@ -47,12 +47,8 @@ typedef struct {
int normal_size_y;
int panel_size_x;
- int cmd_line_color_fg_r;
- int cmd_line_color_fg_g;
- int cmd_line_color_fg_b;
- int cmd_line_color_bg_r;
- int cmd_line_color_bg_g;
- int cmd_line_color_bg_b;
+ gchar *cmd_line_color_fg;
+ gchar *cmd_line_color_bg;
GSList *macros;
@@ -78,22 +74,6 @@ typedef struct {
GtkWidget *command_entry;
} MCPrefsDialog;
-/* Defaults */
-#define MC_DEFAULT_SHOW_DEFAULT_THEME TRUE
-#define MC_DEFAULT_SHOW_HANDLE FALSE
-#define MC_DEFAULT_SHOW_FRAME FALSE
-#define MC_DEFAULT_AUTO_COMPLETE_HISTORY TRUE
-
-#define MC_DEFAULT_NORMAL_SIZE_X 150
-#define MC_DEFAULT_NORMAL_SIZE_Y 48
-
-#define MC_DEFAULT_CMD_LINE_COLOR_FG_R 0xfc65
-#define MC_DEFAULT_CMD_LINE_COLOR_FG_G 0xfc65
-#define MC_DEFAULT_CMD_LINE_COLOR_FG_B 0xfc65
-#define MC_DEFAULT_CMD_LINE_COLOR_BG_R 0x0
-#define MC_DEFAULT_CMD_LINE_COLOR_BG_G 0x0
-#define MC_DEFAULT_CMD_LINE_COLOR_BG_B 0x0
-
#include "mini-commander_applet.h"
void mc_load_preferences (MCData *mc);
@@ -102,9 +82,6 @@ void mc_show_preferences (GSimpleAction *action,
gpointer user_data);
void mc_macros_free (GSList *macros);
-gboolean mc_key_writable (MCData *mc,
- const char *key);
-
G_END_DECLS
#endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c247619..d9fb687 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -62,6 +62,7 @@ mini-commander/src/mini-commander-global.schemas.in
mini-commander/src/mini-commander.schemas.in
mini-commander/src/mini-commander_applet.c
[type: gettext/ini]mini-commander/src/org.gnome.applets.MiniCommanderApplet.panel-applet.in.in
+mini-commander/src/org.gnome.gnome-applets.mini-commander.gschema.xml.in.in
mini-commander/src/preferences.c
mixer/applet.c
mixer/dock.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 38aaa3e..4b75a23 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -18,6 +18,7 @@ gweather/org.gnome.gnome-applets.gweather.gschema.xml.in
gweather/Locations.xml.in
invest-applet/data/Invest_Applet.server.in
mini-commander/src/org.gnome.applets.MiniCommanderApplet.panel-applet.in
+mini-commander/src/org.gnome.gnome-applets.mini-commander.gschema.xml.in
mixer/org.gnome.applets.MixerApplet.panel-applet.in
modemlights/org.gnome.applets.ModemApplet.panel-applet.in
multiload/org.gnome.applets.MultiLoadApplet.panel-applet.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]