checkupdate: Migrate to GSettings
This commit is contained in:
parent
4bcb3b6f8b
commit
698c1a83b5
|
@ -24,26 +24,17 @@ plugin_in_files = checkupdate.pluma-plugin.desktop.in
|
||||||
|
|
||||||
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-check-update.schemas.in
|
gsettings_SCHEMAS = org.mate.pluma.plugins.checkupdate.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/checkupdate/$$p ; \
|
|
||||||
done \
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
install-data-local:
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST = $(plugin_in_files) $(schemas_in_files)
|
EXTRA_DIST = $(plugin_in_files) $(gsettings_SCHEMAS_in_in)
|
||||||
|
|
||||||
CLEANFILES = $(plugin_DATA) $(schemas_DATA)
|
CLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS_in) $(gsettings_SCHEMAS)
|
||||||
|
|
||||||
DISTCLEANFILES = $(plugin_DATA) $(schemas_DATA)
|
DISTCLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS_in) $(gsettings_SCHEMAS)
|
||||||
|
|
||||||
-include $(top_srcdir)/git.mk
|
-include $(top_srcdir)/git.mk
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<schemalist gettext-domain="@GETTEXT_PACKAGE@">
|
||||||
|
<schema id="org.mate.pluma.plugins.checkupdate" path="/org/mate/pluma/plugins/checkupdate/">
|
||||||
|
<key name="ignore-version" type="s">
|
||||||
|
<default>''</default>
|
||||||
|
<_summary>Version to ignore until the next version is released</_summary>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
|
</schemalist>
|
|
@ -29,24 +29,24 @@
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <mateconf/mateconf-client.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2, 17, 1)
|
#if !GTK_CHECK_VERSION(2, 17, 1)
|
||||||
#include <pluma/pluma-message-area.h>
|
#include <pluma/pluma-message-area.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MATECONF_KEY_BASE "/apps/pluma/plugins/checkupdate"
|
#define SETTINGS_SCHEMA "org.mate.pluma.plugins.checkupdate"
|
||||||
#define MATECONF_KEY_IGNORE_VERSION MATECONF_KEY_BASE "/ignore_version"
|
#define SETTINGS_IGNORE_VERSION "ignore-version"
|
||||||
|
|
||||||
#define WINDOW_DATA_KEY "PlumaCheckUpdatePluginWindowData"
|
#define WINDOW_DATA_KEY "PlumaCheckUpdatePluginWindowData"
|
||||||
|
|
||||||
#define VERSION_PLACE "<a href=\"[0-9]\\.[0-9]+/\">"
|
#define VERSION_PLACE "<a href=\"[0-9]\\.[0-9]+/\">"
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
#define PLUMA_URL "http://ftp.acc.umu.se/pub/mate/binaries/win32/pluma/"
|
#define PLUMA_URL "http://pub.mate-desktop.org/sources/mate-text-editor/"
|
||||||
#define FILE_REGEX "pluma\\-setup\\-[0-9]+\\.[0-9]+\\.[0-9]+(\\-[0-9]+)?\\.exe"
|
#define FILE_REGEX "pluma\\-setup\\-[0-9]+\\.[0-9]+\\.[0-9]+(\\-[0-9]+)?\\.exe"
|
||||||
#else
|
#else
|
||||||
#define PLUMA_URL "http://ftp.acc.umu.se/pub/mate/binaries/mac/pluma/"
|
#define PLUMA_URL "http://pub.mate-desktop.org/sources/mate-text-editor/"
|
||||||
#define FILE_REGEX "pluma\\-[0-9]+\\.[0-9]+\\.[0-9]+(\\-[0-9]+)?\\.dmg"
|
#define FILE_REGEX "pluma\\-[0-9]+\\.[0-9]+\\.[0-9]+(\\-[0-9]+)?\\.dmg"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ struct _PlumaCheckUpdatePluginPrivate
|
||||||
{
|
{
|
||||||
SoupSession *session;
|
SoupSession *session;
|
||||||
|
|
||||||
MateConfClient *mateconf_client;
|
GSettings *settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -101,12 +101,7 @@ pluma_check_update_plugin_init (PlumaCheckUpdatePlugin *plugin)
|
||||||
|
|
||||||
plugin->priv->session = soup_session_async_new ();
|
plugin->priv->session = soup_session_async_new ();
|
||||||
|
|
||||||
plugin->priv->mateconf_client = mateconf_client_get_default ();
|
plugin->priv->settings = g_settings_new (SETTINGS_SCHEMA);
|
||||||
|
|
||||||
mateconf_client_add_dir (plugin->priv->mateconf_client,
|
|
||||||
MATECONF_KEY_BASE,
|
|
||||||
MATECONF_CLIENT_PRELOAD_ONELEVEL,
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -120,13 +115,11 @@ pluma_check_update_plugin_dispose (GObject *object)
|
||||||
plugin->priv->session = NULL;
|
plugin->priv->session = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin->priv->mateconf_client != NULL)
|
if (plugin->priv->settings != NULL)
|
||||||
{
|
{
|
||||||
mateconf_client_suggest_sync (plugin->priv->mateconf_client, NULL);
|
g_object_unref (G_OBJECT (plugin->priv->settings));
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (plugin->priv->mateconf_client));
|
plugin->priv->settings = NULL;
|
||||||
|
|
||||||
plugin->priv->mateconf_client = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pluma_debug_message (DEBUG_PLUGINS,
|
pluma_debug_message (DEBUG_PLUGINS,
|
||||||
|
@ -266,10 +259,9 @@ on_response_cb (GtkWidget *infobar,
|
||||||
|
|
||||||
data = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
data = g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
|
||||||
|
|
||||||
mateconf_client_set_string (data->plugin->priv->mateconf_client,
|
g_settings_set_string (data->plugin->priv->settings,
|
||||||
MATECONF_KEY_IGNORE_VERSION,
|
SETTINGS_IGNORE_VERSION,
|
||||||
data->version,
|
data->version);
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (window),
|
g_object_set_data (G_OBJECT (window),
|
||||||
|
@ -467,9 +459,8 @@ parse_file_version (const gchar *file)
|
||||||
static gchar *
|
static gchar *
|
||||||
get_ignore_version (PlumaCheckUpdatePlugin *plugin)
|
get_ignore_version (PlumaCheckUpdatePlugin *plugin)
|
||||||
{
|
{
|
||||||
return mateconf_client_get_string (plugin->priv->mateconf_client,
|
return g_settings_get_string (plugin->priv->settings,
|
||||||
MATECONF_KEY_IGNORE_VERSION,
|
SETTINGS_IGNORE_VERSION);
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
<mateconfschemafile>
|
|
||||||
<schemalist>
|
|
||||||
<schema>
|
|
||||||
<key>/schemas/apps/pluma/plugins/checkupdate/ignore_version</key>
|
|
||||||
<applyto>/apps/pluma/plugins/checkupdate/ignore_version</applyto>
|
|
||||||
<owner>pluma</owner>
|
|
||||||
<type>string</type>
|
|
||||||
<locale name="C">
|
|
||||||
<short>Version to ignore until the next version is released</short>
|
|
||||||
</locale>
|
|
||||||
</schema>
|
|
||||||
</schemalist>
|
|
||||||
</mateconfschemafile>
|
|
Loading…
Reference in New Issue