summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-11-13 12:11:10 +0100
committerStefano Karapetsas <[email protected]>2012-11-13 12:11:10 +0100
commit7b5a0590dec1342bc64b4d3372498ded5a7d06ac (patch)
treeb6b36f40ca43ddf662b99949805f0dff5437a4ae
parentfbef320f6d79dfdddfc2e77ac98936fbe1d5e183 (diff)
downloadmate-netbook-7b5a0590dec1342bc64b4d3372498ded5a7d06ac.tar.bz2
mate-netbook-7b5a0590dec1342bc64b4d3372498ded5a7d06ac.tar.xz
maximus: migrate to gsettings and drop libmateui
-rw-r--r--maximus/Makefile.am18
-rw-r--r--maximus/main.c40
-rw-r--r--maximus/maximus-app.c96
-rw-r--r--maximus/maximus-bind.c34
-rw-r--r--maximus/maximus.schemas54
-rw-r--r--maximus/org.mate.maximus.gschema.xml.in.in24
6 files changed, 75 insertions, 191 deletions
diff --git a/maximus/Makefile.am b/maximus/Makefile.am
index 67192c9..265f76f 100644
--- a/maximus/Makefile.am
+++ b/maximus/Makefile.am
@@ -30,20 +30,12 @@ mate_maximus_SOURCES = \
xutils.c \
xutils.h
-schemadir = $(sysconfdir)/mateconf/schemas
-schema_DATA = maximus.schemas
+@INTLTOOL_XML_NOMERGE_RULE@
+gsettings_SCHEMAS = org.mate.maximus.gschema.xml
+@GSETTINGS_RULES@
-if MATECONF_SCHEMAS_INSTALL
-install-data-local:
- -MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) \
- $(MATECONFTOOL) --makefile-install-rule $(schema_DATA)
-endif
-
-if MATECONF_SCHEMAS_INSTALL
-uninstall-local:
- -MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) \
- $(MATECONFTOOL) --makefile-uninstall-rule $(schema_DATA)
-endif
+%.gschema.xml.in: %.gschema.xml.in.in Makefile
+ $(AM_V_GEN) $(SED) -e 's^\@GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' < $< > $@
desktopdir=$(sysconfdir)/xdg/autostart
dist_desktop_DATA=mate-maximus-autostart.desktop
diff --git a/maximus/main.c b/maximus/main.c
index 4855aac..6bf4e1b 100644
--- a/maximus/main.c
+++ b/maximus/main.c
@@ -26,31 +26,16 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
-#include <libmateui/libmateui.h>
#include <unique/unique.h>
#include "maximus-app.h"
-static gboolean on_sess_save (MateClient *client,
- gint arg1,
- MateSaveStyle arg2,
- gboolean arg3,
- MateInteractStyle arg4,
- gboolean arg5);
-
-static gboolean no_restart = FALSE;
static gboolean version = FALSE;
gboolean no_maximize = FALSE;
GOptionEntry entries[] =
{
{
- "no-restart", 's',
- 0, G_OPTION_ARG_NONE,
- &no_restart,
- "Do not automatically restart (standalone)", NULL
- },
- {
"version", 'v',
0, G_OPTION_ARG_NONE,
&version,
@@ -71,9 +56,7 @@ gint main (gint argc, gchar *argv[])
{
UniqueApp *unique;
MaximusApp *app;
- MateClient *client;
GOptionContext *context;
- gchar *exec[] = {"maximus"};
g_thread_init (NULL);
g_set_application_name ("Maximus");
@@ -92,19 +75,6 @@ gint main (gint argc, gchar *argv[])
g_option_context_add_group (context, gtk_get_option_group (TRUE));
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free(context);
-
- if (!no_restart)
- {
- mate_program_init ("mate-maximus", "1.3.0", LIBMATEUI_MODULE, argc, argv,
- MATE_PARAM_NONE, NULL);
-
- client = mate_master_client ();
- mate_client_set_restart_command (client, 1, exec);
- mate_client_set_restart_style (client, MATE_RESTART_IMMEDIATELY);
-
- g_signal_connect (client, "save-yourself",
- G_CALLBACK (on_sess_save), NULL);
- }
gdk_error_trap_push ();
app = maximus_app_get_default ();
@@ -114,13 +84,3 @@ gint main (gint argc, gchar *argv[])
return EXIT_SUCCESS;
}
-
-static gboolean on_sess_save (MateClient *client,
- gint arg1,
- MateSaveStyle arg2,
- gboolean arg3,
- MateInteractStyle arg4,
- gboolean arg5)
-{
- return TRUE;
-}
diff --git a/maximus/maximus-app.c b/maximus/maximus-app.c
index be9a2fc..334cca5 100644
--- a/maximus/maximus-app.c
+++ b/maximus/maximus-app.c
@@ -23,9 +23,7 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
-
-#include <mateconf/mateconf.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include "maximus-app.h"
#include "maximus-bind.h"
@@ -37,11 +35,11 @@ G_DEFINE_TYPE (MaximusApp, maximus_app, G_TYPE_OBJECT);
MAXIMUS_TYPE_APP, \
MaximusAppPrivate))
-/* Gconf keys */
-#define APP_PATH "/apps/maximus"
-#define APP_EXCLUDE_CLASS APP_PATH "/exclude_class"
-#define APP_UNDECORATE APP_PATH "/undecorate"
-#define APP_NO_MAXIMIZE APP_PATH "/no_maximize"
+/* GSettings schemas and keys */
+#define APP_SCHEMA "org.mate.maximus"
+#define APP_EXCLUDE_CLASS "exclude-class"
+#define APP_UNDECORATE "undecorate"
+#define APP_NO_MAXIMIZE "no-maximize"
/* A set of default exceptions */
static gchar *default_exclude_classes[] =
@@ -74,8 +72,9 @@ struct _MaximusAppPrivate
{
MaximusBind *bind;
MatewnckScreen *screen;
+ GSettings *settings;
- GSList *exclude_class_list;
+ gchar **exclude_class_list;
gboolean undecorate;
gboolean no_maximize;
};
@@ -284,7 +283,6 @@ is_excluded (MaximusApp *app, MatewnckWindow *window)
MatewnckWindowActions actions;
gchar *res_name;
gchar *class_name;
- GSList *c;
gint i;
g_return_val_if_fail (MAXIMUS_IS_APP (app), TRUE);
@@ -333,10 +331,10 @@ is_excluded (MaximusApp *app, MatewnckWindow *window)
}
/* Check user list */
- for (c = priv->exclude_class_list; c; c = c->next)
+ for (i = 0; priv->exclude_class_list[i] != NULL; i++)
{
- if ((class_name && c->data && strstr (class_name, c->data))
- || (res_name && c->data && strstr (res_name, c->data) ))
+ if ((class_name && strstr (class_name, priv->exclude_class_list[i]))
+ || (res_name && strstr (res_name, priv->exclude_class_list[i]) ))
{
g_debug ("Excluding: %s\n", matewnck_window_get_name (window));
return TRUE;
@@ -408,34 +406,22 @@ on_window_opened (MatewnckScreen *screen,
G_CALLBACK (on_window_state_changed), app);
}
+/* GSettings Callbacks */
static void
-on_app_no_maximize_changed (MateConfClient *client,
- guint cid,
- MateConfEntry *entry,
+on_app_no_maximize_changed (GSettings *settings,
+ gchar *key,
MaximusApp *app)
{
MaximusAppPrivate *priv;
- MateConfValue* value;
g_return_if_fail (MAXIMUS_IS_APP (app));
priv = app->priv;
-
- if (entry == NULL)
- {
- priv->no_maximize = FALSE;
- }
- else
- {
- value = mateconf_entry_get_value(entry);
- priv->no_maximize = value != NULL && mateconf_value_get_bool(value);
- }
+ priv->no_maximize = g_settings_get_boolean (settings, key);
}
-/* MateConf Callbacks */
static void
-on_exclude_class_changed (MateConfClient *client,
- guint cid,
- MateConfEntry *entry,
+on_exclude_class_changed (GSettings *settings,
+ gchar *key,
MaximusApp *app)
{
MaximusAppPrivate *priv;
@@ -444,12 +430,10 @@ on_exclude_class_changed (MateConfClient *client,
priv = app->priv;
if (priv->exclude_class_list)
- g_slist_free (priv->exclude_class_list);
+ g_strfreev (priv->exclude_class_list);
- priv->exclude_class_list= mateconf_client_get_list (client,
- APP_EXCLUDE_CLASS,
- MATECONF_VALUE_STRING,
- NULL);
+ priv->exclude_class_list= g_settings_get_strv (settings,
+ APP_EXCLUDE_CLASS);
}
static gboolean
@@ -462,9 +446,8 @@ show_desktop (MatewnckScreen *screen)
}
static void
-on_app_undecorate_changed (MateConfClient *client,
- guint cid,
- MateConfEntry *entry,
+on_app_undecorate_changed (GSettings *settings,
+ gchar *key,
MaximusApp *app)
{
MaximusAppPrivate *priv;
@@ -474,9 +457,7 @@ on_app_undecorate_changed (MateConfClient *client,
priv = app->priv;
g_return_if_fail (MATEWNCK_IS_SCREEN (priv->screen));
- priv->undecorate = mateconf_client_get_bool (client,
- APP_UNDECORATE,
- NULL);
+ priv->undecorate = g_settings_get_boolean (settings, APP_UNDECORATE);
g_debug ("%s\n", priv->undecorate ? "Undecorating" : "Decorating");
windows = matewnck_screen_get_windows (priv->screen);
@@ -523,7 +504,6 @@ static void
maximus_app_init (MaximusApp *app)
{
MaximusAppPrivate *priv;
- MateConfClient *client = mateconf_client_get_default ();
MatewnckScreen *screen;
priv = app->priv = MAXIMUS_APP_GET_PRIVATE (app);
@@ -532,35 +512,25 @@ maximus_app_init (MaximusApp *app)
was_decorated = g_quark_from_static_string ("was-decorated");
- mateconf_client_add_dir (client, APP_PATH, MATECONF_CLIENT_PRELOAD_NONE, NULL);
+ priv->settings = g_settings_new (APP_SCHEMA);
- priv->exclude_class_list= mateconf_client_get_list (client,
- APP_EXCLUDE_CLASS,
- MATECONF_VALUE_STRING,
- NULL);
- mateconf_client_notify_add (client, APP_EXCLUDE_CLASS,
- (MateConfClientNotifyFunc)on_exclude_class_changed,
- app, NULL, NULL);
+ priv->exclude_class_list= g_settings_get_strv (priv->settings, APP_EXCLUDE_CLASS);
+ g_signal_connect (priv->settings, "changed::" APP_EXCLUDE_CLASS,
+ G_CALLBACK (on_exclude_class_changed), app);
- priv->undecorate = mateconf_client_get_bool(client,
- APP_UNDECORATE,
- NULL);
- mateconf_client_notify_add (client, APP_UNDECORATE,
- (MateConfClientNotifyFunc)on_app_undecorate_changed,
- app, NULL, NULL);
+ priv->undecorate = g_settings_get_boolean (priv->settings, APP_UNDECORATE);
+ g_signal_connect (priv->settings, "changed::" APP_UNDECORATE,
+ G_CALLBACK (on_app_undecorate_changed), app);
priv->screen = screen = matewnck_screen_get_default ();
g_signal_connect (screen, "window-opened",
G_CALLBACK (on_window_opened), app);
- priv->no_maximize = mateconf_client_get_bool(client,
- APP_NO_MAXIMIZE,
- NULL);
+ priv->no_maximize = g_settings_get_boolean (priv->settings, APP_NO_MAXIMIZE);
g_print ("no maximize: %s\n", priv->no_maximize ? "true" : "false");
- mateconf_client_notify_add (client, APP_NO_MAXIMIZE,
- (MateConfClientNotifyFunc)on_app_no_maximize_changed,
- app, NULL, NULL);
+ g_signal_connect (priv->settings, "changed::" APP_NO_MAXIMIZE,
+ G_CALLBACK (on_app_no_maximize_changed), app);
}
MaximusApp *
diff --git a/maximus/maximus-bind.c b/maximus/maximus-bind.c
index cbbcf2e..69de949 100644
--- a/maximus/maximus-bind.c
+++ b/maximus/maximus-bind.c
@@ -25,8 +25,7 @@
#include <gdk/gdkkeysyms.h>
-#include <mateconf/mateconf.h>
-#include <mateconf/mateconf-client.h>
+#include <gio/gio.h>
#include <libmatewnck/libmatewnck.h>
@@ -53,9 +52,9 @@ G_DEFINE_TYPE (MaximusBind, maximus_bind, G_TYPE_OBJECT);
#define KEY_RELEASE_TIMEOUT 300
#define STATE_CHANGED_SLEEP 0.5
-/* Gconf keys */
-#define BIND_PATH "/apps/maximus"
-#define BIND_EXCLUDE_CLASS BIND_PATH "/binding"
+/* GSettings schemas and keys */
+#define BIND_SCHEMA "org.mate.maximus"
+#define BIND_EXCLUDE_CLASS "binding"
#define SYSRULESDIR SYSCONFDIR"/maximus"
@@ -63,6 +62,7 @@ struct _MaximusBindPrivate
{
FakeKey *fk;
MatewnckScreen *screen;
+ GSettings *settings;
gchar *binding;
@@ -312,10 +312,9 @@ binding_is_valid (const gchar *binding)
}
static void
-on_binding_changed (MateConfClient *client,
- guint cid,
- MateConfEntry *entry,
- MaximusBind *bind)
+on_binding_changed (GSettings *settings,
+ gchar *key,
+ MaximusBind *bind)
{
MaximusBindPrivate *priv;
@@ -327,9 +326,7 @@ on_binding_changed (MateConfClient *client,
(TomboyBindkeyHandler)on_binding_changed);
g_free (priv->binding);
- priv->binding = mateconf_client_get_string (client,
- BIND_EXCLUDE_CLASS,
- NULL);
+ priv->binding = g_settings_get_string (settings, BIND_EXCLUDE_CLASS);
if (binding_is_valid (priv->binding))
tomboy_keybinder_bind (priv->binding,
@@ -458,7 +455,6 @@ static void
maximus_bind_init (MaximusBind *bind)
{
MaximusBindPrivate *priv;
- MateConfClient *client = mateconf_client_get_default ();
GdkDisplay *display = gdk_display_get_default ();
MatewnckScreen *screen;
@@ -467,17 +463,13 @@ maximus_bind_init (MaximusBind *bind)
priv->fk = fakekey_init (GDK_DISPLAY_XDISPLAY (display));
priv->screen = screen = matewnck_screen_get_default ();
priv->rules = NULL;
+ priv->settings = g_settings_new (BIND_SCHEMA);
tomboy_keybinder_init ();
- mateconf_client_add_dir (client, BIND_PATH, MATECONF_CLIENT_PRELOAD_NONE, NULL);
-
- priv->binding = mateconf_client_get_string (client,
- BIND_EXCLUDE_CLASS,
- NULL);
- mateconf_client_notify_add (client, BIND_EXCLUDE_CLASS,
- (MateConfClientNotifyFunc)on_binding_changed,
- bind, NULL, NULL);
+ priv->binding = g_settings_get_string (priv->settings, BIND_EXCLUDE_CLASS);
+ g_signal_connect (priv->settings, "changed::" BIND_EXCLUDE_CLASS,
+ G_CALLBACK (on_binding_changed), bind);
if (binding_is_valid (priv->binding))
tomboy_keybinder_bind (priv->binding,
diff --git a/maximus/maximus.schemas b/maximus/maximus.schemas
deleted file mode 100644
index a348e9b..0000000
--- a/maximus/maximus.schemas
+++ /dev/null
@@ -1,54 +0,0 @@
-<mateconfschemafile>
- <schemalist>
- <schema>
- <key>/schemas/apps/maximus/exclude_class</key>
- <applyto>/apps/maximus/exclude_class</applyto>
- <owner>maximus</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[Totem]</default>
- <locale name="C">
- <short>A list of exclusion strings which apply to the window class.</short>
- <long>A list of exclusion strings which apply to the window class</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/maximus/binding</key>
- <applyto>/apps/maximus/binding</applyto>
- <owner>maximus</owner>
- <type>string</type>
- <default>disabled</default>
- <locale name="C">
- <short>A binding</short>
- <long>A binding</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/maximus/undecorate</key>
- <applyto>/apps/maximus/undecorate</applyto>
- <owner>maximus</owner>
- <type>bool</type>
- <default>1</default>
- <locale name="C">
- <short>Undecorate windows when maximized</short>
- <long>Undecorate windows when maximized</long>
- </locale>
- </schema>
-
- <schema>
- <key>/schemas/apps/maximus/no_maximize</key>
- <applyto>/apps/maximus/no_maximize</applyto>
- <owner>maximus</owner>
- <type>bool</type>
- <default>0</default>
- <locale name="C">
- <short>Do not automatically maximize newly opened windows</short>
- <long>Do not automatically maximize newly opened windows. If undecorate is set, will still undecorate maximised windows.</long>
- </locale>
- </schema>
-
- </schemalist>
-</mateconfschemafile>
-
diff --git a/maximus/org.mate.maximus.gschema.xml.in.in b/maximus/org.mate.maximus.gschema.xml.in.in
new file mode 100644
index 0000000..f7ddce4
--- /dev/null
+++ b/maximus/org.mate.maximus.gschema.xml.in.in
@@ -0,0 +1,24 @@
+<schemalist gettext-domain="@GETTEXT_PACKAGE@">
+ <schema id="org.mate.maximus" path="/org/mate/maximus/">
+ <key name="exclude-class" type="as">
+ <default>[ 'Totem' ]</default>
+ <_summary>A list of exclusion strings which apply to the window class.</_summary>
+ <_description>A list of exclusion strings which apply to the window class</_description>
+ </key>
+ <key name="binding" type="s">
+ <default>'disabled'</default>
+ <_summary>A binding</_summary>
+ <_description>A binding</_description>
+ </key>
+ <key name="undecorate" type="b">
+ <default>true</default>
+ <_summary>Undecorate windows when maximized</_summary>
+ <_description>Undecorate windows when maximized</_description>
+ </key>
+ <key name="no-maximize" type="b">
+ <default>false</default>
+ <_summary>Do not automatically maximize newly opened windows</_summary>
+ <_description>Do not automatically maximize newly opened windows. If undecorate is set, will still undecorate maximised windows.</_description>
+ </key>
+ </schema>
+</schemalist>