[evolution-rss] gsettings initial migration
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] gsettings initial migration
- Date: Sun, 29 Jul 2012 19:52:20 +0000 (UTC)
commit 6df0f7355aaf26ae498f9214e045f3eecb956d02
Author: Lucian Langa <lucilanga gnome org>
Date: Sun Jul 29 20:19:49 2012 +0200
gsettings initial migration
configure.ac | 9 ++
src/Makefile.am | 41 ++----
src/network-soup.c | 37 +++++-
src/network.h | 26 ++---
src/rss-config-factory.c | 334 +++++++++++++++++++++++++++++++++++++++++++---
src/rss-config.c | 57 +++++++-
src/rss.c | 148 ++++++++++++++++++++-
src/rss.h | 25 ++++
8 files changed, 605 insertions(+), 72 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4610c55..7dfc81e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,6 +38,8 @@ AM_MAINTAINER_MODE
dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "\${ACLOCAL_FLAGS}")
+GLIB_GSETTINGS
+
IT_PROG_INTLTOOL([0.35.0])
AC_PROG_CC
@@ -313,6 +315,13 @@ dnl ***********
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
AM_GCONF_SOURCE_2
+dnl ***************
+dnl Gsettings stuff
+dnl ***************
+PKG_CHECK_MODULES(GSETTINGS, glib-2.0 >= 2.26, HAVE_GSETTINGS=yes, HAVE_GSETTINGS=no)
+AM_CONDITIONAL(HAVE_GSETTINGS, [test "xHAVE_GSETTINGS" = "xyes"])
+AC_SUBST(HAVE_GSETTINGS)
+
dnl ********************
dnl extract soup version
dnl ********************
diff --git a/src/Makefile.am b/src/Makefile.am
index bfb057c..262d51a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -105,35 +105,19 @@ schema_DATA = $(schema_in_files:.schemas.in.in=.schemas)
sed -e "s#\ bindir\@# bindir@#g" $< > $@
@EVO_SERVER_RULE@
- INTLTOOL_SERVER_RULE@
- INTLTOOL_SCHEMAS_RULE@
-
-if GCONF_SCHEMAS_INSTALL
-
-install-data-local:
- rm -f $(PLUGIN_INSTALL_DIR)/*gnome-cooly*
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(schema_DATA)
-
-uninstall-local:
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-uninstall-rule $(schema_DATA)
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/remove_folder
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/pass_proxy
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/startup_check
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/rep_check
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/rep_check_timeout
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/auth_proxy
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/host_proxy
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/html_render
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/use_proxy
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/user_proxy
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/port_proxy
- $(GCONFTOOL) -u /apps/evolution/evolution-rss/display_summary
- $(GCONFTOOL) -u /gnome/url-handlers/feed/command
- $(GCONFTOOL) -u /gnome/url-handlers/feed/enabled
- $(GCONFTOOL) -u /gnome/url-handlers/feed/need-terminal
+gsettings_SCHEMAS = \
+ org.gnome.evolution.plugin.evolution-rss.gschema.xml
+
+ INTLTOOL_XML_NOMERGE_RULE@
+
+if HAVE_GSETTINGS
+ GSETTINGS_RULES@
endif
+convertdir = $(datadir)/GConf/gsettings
+convert_DATA = evolution-rss.convert
+
DISTCLEANFILES = $(schema_DATA)
@@ -147,11 +131,12 @@ CLEANFILES = $(BUILT_SOURCES) \
org-gnome-evolution-rss.error \
evolution-rss.schemas \
evolution-rss.schemas.in \
- $(schema_DATA)
+ $(gsettings_SCHEMAS)
EXTRA_DIST = \
$(ui_DATA) \
- $(schema_in_files) \
+ $(convert_DATA) \
+ $(gsettings_SCHEMAS:.xml=.xml.in.in) \
rss.h network.h \
network-soup.c \
network-soup.h \
diff --git a/src/network-soup.c b/src/network-soup.c
index ec0ae4c..eaf69a4 100644
--- a/src/network-soup.c
+++ b/src/network-soup.c
@@ -1,5 +1,5 @@
/* Evolution RSS Reader Plugin
- * Copyright (C) 2007-2010 Lucian Langa <cooly gnome eu org>
+ * Copyright (C) 2007-2012 Lucian Langa <cooly gnome eu org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,7 +24,9 @@
#endif
#include <string.h>
+#if EVOLUTION_VERSION < 30503
#include <gconf/gconf-client.h>
+#endif
#ifdef HAVE_LIBSOUP_GNOME
#include <libsoup/soup-gnome.h>
#include <libsoup/soup-gnome-features.h>
@@ -55,7 +57,11 @@ SoupCookieJar *rss_soup_jar = NULL;
#endif
gint proxy_type = 0;
extern rssfeed *rf;
+#if EVOLUTION_VERSION < 30304
extern GConfClient *rss_gconf;
+#else
+GSettings *settings;
+#endif
extern SoupSession *webkit_session;
#if (DATASERVER_VERSION >= 2023001)
EProxy *proxy;
@@ -231,8 +237,13 @@ void
proxify_webkit_session_async(EProxy *proxy, WEBKITNET *wknet)
{
SoupURI *proxy_uri = NULL, *su;
+#if EVOLUTION_VERSION < 30304
gint ptype = gconf_client_get_int (
rss_gconf, KEY_GCONF_EVO_PROXY_TYPE, NULL);
+#else
+ GSettings *settings = g_settings_new(CONF_SCHEMA_EVO_NETWORK);
+ gint ptype = g_settings_get_int(settings, CONF_EVO_PROXY_TYPE);
+#endif
switch (ptype) {
#ifndef HAVE_LIBSOUP_GNOME
@@ -289,8 +300,14 @@ void
proxify_session(EProxy *proxy, SoupSession *session, gchar *uri)
{
SoupURI *proxy_uri = NULL;
+#if EVOLUTION_VERSION < 30304
gint ptype = gconf_client_get_int (
rss_gconf, KEY_GCONF_EVO_PROXY_TYPE, NULL);
+#else
+ GSettings *settings = g_settings_new(CONF_SCHEMA_EVO_NETWORK);
+ gint ptype = g_settings_get_int (
+ settings, CONF_EVO_PROXY_TYPE);
+#endif
switch (ptype) {
#ifndef HAVE_LIBSOUP_GNOME
@@ -395,8 +412,14 @@ void
proxify_session_async(EProxy *proxy, STNET *stnet)
{
SoupURI *proxy_uri = NULL, *su;
+#if EVOLUTION_VERSION < 30304
gint ptype = gconf_client_get_int (
rss_gconf, KEY_GCONF_EVO_PROXY_TYPE, NULL);
+#else
+ GSettings *settings = g_settings_new(CONF_SCHEMA_EVO_NETWORK);
+ gint ptype = g_settings_get_int (
+ settings, CONF_EVO_PROXY_TYPE);
+#endif
switch (ptype) {
#ifndef HAVE_LIBSOUP_GNOME
@@ -978,10 +1001,16 @@ net_queue_dispatcher(void)
g_queue_get_length(rf->stqueue),
net_queue_run_count);
+#if EVOLUTION_VERSION < 30304
if (qlen && net_queue_run_count < gconf_client_get_int (
rss_gconf,
GCONF_KEY_DOWNLOAD_QUEUE_SIZE,
NULL)) {
+#else
+ if (qlen && net_queue_run_count < g_settings_get_int (
+ settings,
+ CONF_DOWNLOAD_QUEUE_SIZE)) {
+#endif
net_queue_run_count++;
_stnet = g_queue_pop_head(rf->stqueue);
soup_session_queue_message (
@@ -1187,8 +1216,14 @@ sync_gecko_cookies(void)
void
rss_soup_init(void)
{
+ settings = g_settings_new(RSS_CONF_SCHEMA);
+
#if LIBSOUP_VERSION > 2026002 && defined(HAVE_LIBSOUP_GNOME)
+#if EVOLUTION_VERSION < 30304
if (gconf_client_get_bool (rss_gconf, GCONF_KEY_ACCEPT_COOKIES, NULL)) {
+#else
+ if (g_settings_get_boolean (settings, CONF_ACCEPT_COOKIES)) {
+#endif
gchar *feed_dir = rss_component_peek_base_directory();
gchar *cookie_path = g_build_path(
G_DIR_SEPARATOR_S,
diff --git a/src/network.h b/src/network.h
index db6af73..c8511a2 100644
--- a/src/network.h
+++ b/src/network.h
@@ -1,5 +1,5 @@
/* Evolution RSS Reader Plugin
- * Copyright (C) 2007-2009 Lucian Langa <cooly gnome eu org>
+ * Copyright (C) 2007-2012 Lucian Langa <cooly gnome eu org>
*
* This progronam is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
#include <glib.h>
+#if EVOLUTION_VERSION < 30304
#define GCONF_KEY_USE_PROXY "/apps/evolution/evolution-rss/use_proxy"
#define GCONF_KEY_HOST_PROXY "/apps/evolution/evolution-rss/host_proxy"
#define GCONF_KEY_PORT_PROXY "/apps/evolution/evolution-rss/port_proxy"
@@ -67,24 +68,15 @@
#define KEY_GCONF_SYS_AUTOCONFIG_URL PATH_GCONF_SYS_PROXY "/autoconfig_url"
#define RIGHT_KEY(sufix) (proxy_type == PROXY_TYPE_SYSTEM ? KEY_GCONF_SYS_ ## sufix : KEY_GCONF_EVO_ ## sufix)
+#else
+#define RSS_CONF_SCHEMA "org.gnome.evolution.plugin.evolution-rss"
+#define CONF_SCHEMA_EVO_NETWORK "org.gnome.evolution.shell.network-config"
+#define CONF_EVO_PROXY_TYPE "proxy-type"
+#define CONF_NETWORK_TIMEOUT "network-timeout"
+#define CONF_DOWNLOAD_QUEUE_SIZE "network-queue-size"
+#endif
-/*#define GCONF_E_SHELL_NETWORK_CONFIG_PATH "/apps/evolution/shell/network_config/"
-
-#define GCONF_E_HTTP_HOST_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "http_host"
-#define GCONF_E_HTTP_PORT_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "http_port"
-#define GCONF_E_HTTPS_HOST_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "secure_host"
-#define GCONF_E_HTTPS_PORT_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "secure_port"
-#define GCONF_E_SOCKS_HOST_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "socks_host"
-#define GCONF_E_SOCKS_PORT_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "socks_port"
-#define GCONF_E_IGNORE_HOSTS_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "ignore_hosts"
-#define GCONF_E_USE_AUTH_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "use_authentication"
-#define GCONF_E_PROXY_TYPE_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "proxy_type"
-#define GCONF_E_AUTH_USER_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "authentication_user"
-#define GCONF_E_AUTH_PWD_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "authentication_password"
-#define GCONF_E_USE_PROXY_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "use_http_proxy"
-#define GCONF_E_AUTOCONFIG_URL_KEY GCONF_E_SHELL_NETWORK_CONFIG_PATH "autoconfig_url"*/
-
enum ProxyType {
PROXY_TYPE_SYSTEM = 0,
PROXY_TYPE_NO_PROXY,
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index 6a64348..4ed33e6 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -27,7 +27,9 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
+#if EVOLUTION_VERSION < 30304
#include <gconf/gconf-client.h>
+#endif
#include <gdk/gdkkeysyms.h>
#if (DATASERVER_VERSION >= 2031001)
@@ -172,47 +174,75 @@ render_engine_changed (GtkComboBox *dropdown, GCallback *user_data)
int id = gtk_combo_box_get_active (dropdown);
GtkTreeModel *model;
GtkTreeIter iter;
- GConfClient *client;
+#if EVOLUTION_VERSION < 30304
+ GConfClient *client = gconf_client_get_default();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
model = gtk_combo_box_get_model (dropdown);
if (id == -1 || !gtk_tree_model_iter_nth_child (model, &iter, NULL, id))
return;
if (!id) id = 10;
- client = gconf_client_get_default();
+#if EVOLUTION_VERSION < 30304
gconf_client_set_int(client, GCONF_KEY_HTML_RENDER, id, NULL);
+#else
+ g_settings_set_int(settings, CONF_HTML_RENDER, id);
+#endif
#ifdef HAVE_GECKO
if (id == 2)
rss_mozilla_init();
#endif
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
}
static void
start_check_cb(GtkWidget *widget, gpointer data)
{
- GConfClient *client;
+#if EVOLUTION_VERSION < 30304
+ GConfClient *client = gconf_client_get_default();
gboolean active = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (widget));
/* Save the new setting to gconf */
- client = gconf_client_get_default();
gconf_client_set_bool (client, data, active, NULL);
g_object_unref(client);
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+ gboolean active = gtk_toggle_button_get_active (
+ GTK_TOGGLE_BUTTON (widget));
+ /* Save the new setting */
+ g_settings_set_boolean (settings, data, active);
+ g_object_unref(settings);
+#endif
}
void
accept_cookies_cb(GtkWidget *widget, GtkWidget *data)
{
- GConfClient *client;
+#if EVOLUTION_VERSION < 30304
+ GConfClient *client = gconf_client_get_default();
gboolean active = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (widget));
/* Save the new setting to gconf */
- client = gconf_client_get_default();
gconf_client_set_bool (
client,
GCONF_KEY_ACCEPT_COOKIES, active, NULL);
gtk_widget_set_sensitive(data, active);
g_object_unref(client);
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+ gboolean active = gtk_toggle_button_get_active (
+ GTK_TOGGLE_BUTTON (widget));
+ /* Save the new setting */
+ g_settings_set_boolean (settings, CONF_ACCEPT_COOKIES, active);
+ gtk_widget_set_sensitive(data, active);
+ g_object_unref(settings);
+#endif
}
static void
@@ -257,26 +287,39 @@ treeview_row_activated(GtkTreeView *treeview,
static void
rep_check_cb (GtkWidget *widget, gpointer data)
{
- GConfClient *client;
+#if EVOLUTION_VERSION < 30304
+ GConfClient *client = gconf_client_get_default();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
gboolean active =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
/* Save the new setting to gconf */
- client = gconf_client_get_default();
+#if EVOLUTION_VERSION < 30304
gconf_client_set_bool (client,
- GCONF_KEY_REP_CHECK,
- active,
- NULL);
+ GCONF_KEY_REP_CHECK, active, NULL);
+#else
+ g_settings_set_boolean (settings,
+ CONF_REP_CHECK, active);
+#endif
//if we already have a timeout set destroy it first
if (rf->rc_id && !active)
g_source_remove(rf->rc_id);
if (active) {
gtk_spin_button_update((GtkSpinButton *)data);
//we have to make sure we have a timeout value
+#if EVOLUTION_VERSION < 30304
if (!gconf_client_get_float(client, GCONF_KEY_REP_CHECK_TIMEOUT, NULL))
gconf_client_set_float (client,
GCONF_KEY_REP_CHECK_TIMEOUT,
gtk_spin_button_get_value((GtkSpinButton *)data),
NULL);
+#else
+ if (!g_settings_get_double(settings, CONF_REP_CHECK_TIMEOUT))
+ g_settings_set_double (settings,
+ CONF_REP_CHECK_TIMEOUT,
+ gtk_spin_button_get_value((GtkSpinButton *)data));
+#endif
if (rf->rc_id)
g_source_remove(rf->rc_id);
rf->rc_id = g_timeout_add (
@@ -284,52 +327,90 @@ rep_check_cb (GtkWidget *widget, gpointer data)
(GSourceFunc) update_articles,
(gpointer)1);
}
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
}
static void
enclosure_limit_cb (GtkWidget *widget, gpointer data)
{
- GConfClient *client;
+#if EVOLUTION_VERSION < 30304
+ GConfClient *client = gconf_client_get_default();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
gboolean active =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
/* Save the new setting to gconf */
- client = gconf_client_get_default();
+#if EVOLUTION_VERSION < 30304
gconf_client_set_bool (client,
GCONF_KEY_ENCLOSURE_LIMIT,
active,
NULL);
+#else
+ g_settings_set_boolean (settings, CONF_ENCLOSURE_LIMIT, active);
+#endif
if (active) {
//we have to make sure we have a timeout value
+#if EVOLUTION_VERSION < 30304
if (!gconf_client_get_float(client, GCONF_KEY_ENCLOSURE_SIZE, NULL))
gconf_client_set_float (client,
GCONF_KEY_ENCLOSURE_SIZE,
gtk_spin_button_get_value((GtkSpinButton *)data),
NULL);
+#else
+ if (!g_settings_get_double(settings, CONF_ENCLOSURE_SIZE))
+ g_settings_set_double (settings,
+ CONF_ENCLOSURE_SIZE,
+ gtk_spin_button_get_value((GtkSpinButton *)data));
+#endif
}
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
}
static void
enclosure_size_cb (GtkWidget *widget, gpointer data)
{
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
gconf_client_set_float (client,
GCONF_KEY_ENCLOSURE_SIZE,
gtk_spin_button_get_value((GtkSpinButton*)widget),
NULL);
g_object_unref(client);
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+ g_settings_set_double (settings, CONF_ENCLOSURE_SIZE,
+ gtk_spin_button_get_value((GtkSpinButton*)widget));
+ g_object_unref(settings);
+#endif
}
static void
rep_check_timeout_cb (GtkWidget *widget, gpointer data)
{
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data));
+#if EVOLUTION_VERSION < 30304
gconf_client_set_float (client,
GCONF_KEY_REP_CHECK_TIMEOUT,
gtk_spin_button_get_value((GtkSpinButton*)widget),
NULL);
+#else
+ g_settings_set_double (settings, CONF_REP_CHECK_TIMEOUT,
+ gtk_spin_button_get_value((GtkSpinButton*)widget));
+#endif
if (active) {
if (rf->rc_id)
g_source_remove(rf->rc_id);
@@ -338,7 +419,11 @@ rep_check_timeout_cb (GtkWidget *widget, gpointer data)
(GSourceFunc) update_articles,
(gpointer)1);
}
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
}
static void
@@ -1402,7 +1487,11 @@ delete_response(GtkWidget *selector, guint response, gpointer user_data)
GtkTreeModel *model;
GtkTreeIter iter;
gchar *name;
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
if (response == GTK_RESPONSE_OK) {
selection =
gtk_tree_view_get_selection(
@@ -1413,10 +1502,14 @@ delete_response(GtkWidget *selector, guint response, gpointer user_data)
4, &name,
-1);
rss_delete_feed(name,
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client,
GCONF_KEY_REMOVE_FOLDER,
NULL));
+#else
+ g_settings_get_boolean(settings, CONF_REMOVE_FOLDER));
+#endif
g_free(name);
}
store_redraw(GTK_TREE_VIEW(rf->treeview));
@@ -1424,7 +1517,11 @@ delete_response(GtkWidget *selector, guint response, gpointer user_data)
}
gtk_widget_destroy(selector);
rf->import = 0;
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
}
void
@@ -1465,7 +1562,11 @@ remove_feed_dialog(gchar *msg)
GtkWidget *vbox1;
GtkWidget *checkbutton1;
GtkWidget *dialog_action_area1;
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
#if EVOLUTION_VERSION < 22904
dialog1 = e_error_new(
@@ -1510,14 +1611,22 @@ remove_feed_dialog(gchar *msg)
gtk_widget_show (checkbutton1);
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (checkbutton1),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client,
GCONF_KEY_REMOVE_FOLDER, NULL));
+#else
+ g_settings_get_boolean(settings, CONF_REMOVE_FOLDER));
+#endif
g_signal_connect(
checkbutton1,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_REMOVE_FOLDER);
+#else
+ (gpointer)CONF_REMOVE_FOLDER);
+#endif
gtk_box_pack_start (
GTK_BOX (vbox1),
checkbutton1,
@@ -1534,7 +1643,11 @@ remove_feed_dialog(gchar *msg)
gtk_button_box_set_layout (
GTK_BUTTON_BOX (dialog_action_area1),
GTK_BUTTONBOX_END);
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
return dialog1;
}
@@ -3224,6 +3337,7 @@ export_cb (GtkWidget *widget, gpointer data)
static void
spin_update_cb (GtkWidget *widget, gchar *key)
{
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
gconf_client_set_float (
client,
@@ -3231,6 +3345,12 @@ spin_update_cb (GtkWidget *widget, gchar *key)
gtk_spin_button_get_value((GtkSpinButton*)widget),
NULL);
g_object_unref(client);
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+ g_settings_set_double (settings, key,
+ gtk_spin_button_get_value((GtkSpinButton*)widget));
+ g_object_unref(settings);
+#endif
}
static void
@@ -3247,15 +3367,27 @@ destroy_ui_data (gpointer data)
void
font_cb(GtkWidget *widget, GtkWidget *data)
{
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
gboolean active = 1-gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (widget));
/* Save the new setting to gconf */
- gconf_client_set_bool (
- client,
+#if EVOLUTION_VERSION < 30304
+ gconf_client_set_bool (client,
GCONF_KEY_CUSTOM_FONT, active, NULL);
+#else
+ g_settings_set_boolean (settings,
+ CONF_CUSTOM_FONT, active);
+#endif
gtk_widget_set_sensitive(data, active);
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
}
GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl);
@@ -3278,7 +3410,11 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
gchar *toplevel[] = {(gchar *)"settingsbox", NULL};
GtkAdjustment *adjustment;
GtkWidget *widget1, *widget2;
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default ();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
uifile = g_build_filename (EVOLUTION_UIDIR,
"rss-html-rendering.ui",
@@ -3310,9 +3446,13 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
renderer,
"text", 0,
NULL);
+#if EVOLUTION_VERSION < 30304
render = GPOINTER_TO_INT(gconf_client_get_int(client,
GCONF_KEY_HTML_RENDER,
NULL));
+#else
+ render = g_settings_get_int(settings, CONF_HTML_RENDER);
+#endif
switch (render) {
case 10:
@@ -3366,9 +3506,13 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
gtk_builder_get_object(
ui->xml, "fontsetting"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget2),
- 1-gconf_client_get_bool (
+#if EVOLUTION_VERSION < 30304
+ 1 - gconf_client_get_bool (
client,
GCONF_KEY_CUSTOM_FONT, NULL));
+#else
+ 1 - g_settings_get_boolean (settings, CONF_CUSTOM_FONT));
+#endif
g_object_set(widget1, "sensitive", (gboolean)1-gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (widget2)), NULL);
g_signal_connect (
@@ -3391,10 +3535,14 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
gtk_spin_button_set_adjustment(
(GtkSpinButton *)ui->minfont,
adjustment);
+#if EVOLUTION_VERSION < 30304
adj = gconf_client_get_float(
client,
GCONF_KEY_MIN_FONT_SIZE,
NULL);
+#else
+ adj = g_settings_get_double(settings, CONF_MIN_FONT_SIZE);
+#endif
if (adj)
gtk_spin_button_set_value(
(GtkSpinButton *)ui->minfont, adj);
@@ -3402,50 +3550,87 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
ui->minfont,
"changed",
G_CALLBACK(spin_update_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_MIN_FONT_SIZE);
+#else
+ (gpointer)CONF_MIN_FONT_SIZE);
+#endif
g_signal_connect(
ui->minfont,
"value-changed",
G_CALLBACK(spin_update_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_MIN_FONT_SIZE);
+#else
+ (gpointer)CONF_MIN_FONT_SIZE);
+#endif
ui->check = GTK_WIDGET (
gtk_builder_get_object(ui->xml, "enable_java"));
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (ui->check),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client, GCONF_KEY_HTML_JAVA, NULL));
+#else
+ g_settings_get_boolean(settings, CONF_HTML_JAVA));
+#endif
g_signal_connect(ui->check,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_HTML_JAVA);
+#else
+ (gpointer)CONF_HTML_JAVA);
+#endif
ui->check = GTK_WIDGET (
gtk_builder_get_object(ui->xml, "image_resize"));
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (ui->check),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client, GCONF_KEY_IMAGE_RESIZE, NULL));
+#else
+ g_settings_get_boolean(settings, CONF_IMAGE_RESIZE));
+#endif
g_signal_connect(ui->check,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_IMAGE_RESIZE);
+#else
+ (gpointer)CONF_IMAGE_RESIZE);
+#endif
ui->check = GTK_WIDGET (
gtk_builder_get_object(ui->xml, "enable_js"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->check),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(client, GCONF_KEY_HTML_JS, NULL));
+#else
+ g_settings_get_boolean(settings, CONF_HTML_JS));
+#endif
g_signal_connect(ui->check,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_HTML_JS);
+#else
+ (gpointer)CONF_HTML_JS);
+#endif
ui->check = GTK_WIDGET (
gtk_builder_get_object(ui->xml, "accept_cookies"));
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (ui->check),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client, GCONF_KEY_ACCEPT_COOKIES, NULL));
+#else
+ g_settings_get_boolean(
+ settings, CONF_ACCEPT_COOKIES));
+#endif
g_signal_connect(ui->check,
"clicked",
G_CALLBACK(accept_cookies_cb),
@@ -3479,17 +3664,26 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
gtk_spin_button_set_adjustment(
(GtkSpinButton *)ui->nettimeout,
adjustment);
+#if EVOLUTION_VERSION < 30304
adj = gconf_client_get_float(
client,
GCONF_KEY_NETWORK_TIMEOUT,
NULL);
+#else
+ adj = g_settings_get_double(settings, CONF_NETWORK_TIMEOUT);
+#endif
if (adj < NETWORK_MIN_TIMEOUT) {
adj = NETWORK_MIN_TIMEOUT;
+#if EVOLUTION_VERSION < 30304
gconf_client_set_float (
client,
GCONF_KEY_NETWORK_TIMEOUT,
adj,
NULL);
+#else
+ g_settings_set_double (
+ settings, CONF_NETWORK_TIMEOUT, adj);
+#endif
}
if (adj)
gtk_spin_button_set_value(
@@ -3498,42 +3692,75 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
ui->nettimeout,
"changed",
G_CALLBACK(spin_update_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_NETWORK_TIMEOUT);
+#else
+ (gpointer)CONF_NETWORK_TIMEOUT);
+#endif
g_signal_connect(
ui->nettimeout,
"value-changed",
G_CALLBACK(spin_update_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_NETWORK_TIMEOUT);
+#else
+ (gpointer)CONF_NETWORK_TIMEOUT);
+#endif
//feed notification
ui->check = GTK_WIDGET (
gtk_builder_get_object(ui->xml, "status_icon"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->check),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client, GCONF_KEY_STATUS_ICON, NULL));
+#else
+ g_settings_get_boolean(settings, CONF_STATUS_ICON));
+#endif
g_signal_connect(ui->check,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_STATUS_ICON);
+#else
+ (gpointer)CONF_STATUS_ICON);
+#endif
ui->check = GTK_WIDGET (
gtk_builder_get_object(ui->xml, "blink_icon"));
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (ui->check),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client, GCONF_KEY_BLINK_ICON, NULL));
+#else
+ g_settings_get_boolean(
+ settings, CONF_BLINK_ICON));
+#endif
g_signal_connect(ui->check,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_BLINK_ICON);
+#else
+ (gpointer)CONF_BLINK_ICON);
+#endif
ui->check = GTK_WIDGET (
gtk_builder_get_object(ui->xml, "feed_icon"));
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (ui->check),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(client, GCONF_KEY_FEED_ICON, NULL));
+#else
+ g_settings_get_boolean(settings, CONF_FEED_ICON));
+#endif
g_signal_connect(ui->check,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_FEED_ICON);
+#else
+ (gpointer)CONF_FEED_ICON);
+#endif
#if GTK_MAJOR_VERSION < 3
hbox = gtk_vbox_new (FALSE, 0);
@@ -3553,7 +3780,11 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
"ui-data",
ui,
destroy_ui_data);
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
return hbox;
}
@@ -3828,7 +4059,11 @@ rss_config_control_new (void)
GtkTreeViewColumn *column;
gdouble adj, size;
GError* error = NULL;
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
d("rf->%p\n", rf);
uifile = g_build_filename (
@@ -3843,8 +4078,7 @@ rss_config_control_new (void)
g_free (uifile);
treeview = (GtkTreeView *)gtk_builder_get_object(
- gui,
- "feeds-treeview");
+ gui, "feeds-treeview");
rf->treeview = (GtkWidget *)treeview;
gtk_tree_view_set_rules_hint (
@@ -3999,9 +4233,17 @@ rss_config_control_new (void)
enclsize = GTK_WIDGET (gtk_builder_get_object(gui, "spinbutton2"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check1),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(client, GCONF_KEY_REP_CHECK, NULL));
+#else
+ g_settings_get_boolean(settings, CONF_REP_CHECK));
+#endif
+#if EVOLUTION_VERSION < 30304
adj = gconf_client_get_float(client, GCONF_KEY_REP_CHECK_TIMEOUT, NULL);
+#else
+ adj = g_settings_get_double(settings, CONF_REP_CHECK_TIMEOUT);
+#endif
if (adj)
gtk_spin_button_set_value((GtkSpinButton *)spin, adj);
g_signal_connect(
@@ -4015,7 +4257,11 @@ rss_config_control_new (void)
G_CALLBACK(rep_check_timeout_cb),
check1);
+#if EVOLUTION_VERSION < 30304
size = gconf_client_get_float(client, GCONF_KEY_ENCLOSURE_SIZE, NULL);
+#else
+ size = g_settings_get_double(settings, CONF_ENCLOSURE_SIZE);
+#endif
if (size)
gtk_spin_button_set_value((GtkSpinButton *)enclsize, size);
g_signal_connect(
@@ -4031,64 +4277,112 @@ rss_config_control_new (void)
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (check2),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client,
GCONF_KEY_START_CHECK,
NULL));
+#else
+ g_settings_get_boolean(settings, CONF_START_CHECK));
+#endif
g_signal_connect(check2,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_START_CHECK);
+#else
+ (gpointer)CONF_START_CHECK);
+#endif
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (check3),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client,
GCONF_KEY_DISPLAY_SUMMARY,
NULL));
+#else
+ g_settings_get_boolean(settings, CONF_DISPLAY_SUMMARY));
+#endif
g_signal_connect(check3,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_DISPLAY_SUMMARY);
+#else
+ (gpointer)CONF_DISPLAY_SUMMARY);
+#endif
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (check4),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client,
GCONF_KEY_SHOW_COMMENTS,
NULL));
+#else
+ g_settings_get_boolean(settings, CONF_SHOW_COMMENTS));
+#endif
g_signal_connect(check4,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_SHOW_COMMENTS);
+#else
+ (gpointer)CONF_SHOW_COMMENTS);
+#endif
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (check5),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client,
GCONF_KEY_SEARCH_RSS,
NULL));
+#else
+ g_settings_get_boolean(settings, CONF_SEARCH_RSS));
+#endif
g_signal_connect(check5,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_SEARCH_RSS);
+#else
+ (gpointer)CONF_SEARCH_RSS);
+#endif
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (check6),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client,
GCONF_KEY_DOWNLOAD_ENCLOSURES,
NULL));
+#else
+ g_settings_get_boolean(settings, CONF_DOWNLOAD_ENCLOSURES));
+#endif
g_signal_connect(check6,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_DOWNLOAD_ENCLOSURES);
+#else
+ (gpointer)CONF_DOWNLOAD_ENCLOSURES);
+#endif
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (check7),
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(
client,
GCONF_KEY_ENCLOSURE_LIMIT,
NULL));
+#else
+ g_settings_get_boolean(settings, CONF_ENCLOSURE_LIMIT));
+#endif
g_signal_connect(check7,
"clicked",
G_CALLBACK(start_check_cb),
+#if EVOLUTION_VERSION < 30304
(gpointer)GCONF_KEY_ENCLOSURE_LIMIT);
+#else
+ (gpointer)CONF_ENCLOSURE_LIMIT);
+#endif
import = GTK_WIDGET (gtk_builder_get_object(gui, "import"));
export = GTK_WIDGET (gtk_builder_get_object(gui, "export"));
@@ -4112,7 +4406,11 @@ rss_config_control_new (void)
gtk_container_remove (
GTK_CONTAINER (gtk_widget_get_parent(control_widget)),
control_widget);
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
g_object_unref (gui);
#if EVOLUTION_VERSION < 22900 //kb//
diff --git a/src/rss-config.c b/src/rss-config.c
index d85fe82..19599c1 100644
--- a/src/rss-config.c
+++ b/src/rss-config.c
@@ -1,5 +1,5 @@
/* Evoution RSS Reader Plugin
- * Copyright (C) 2007-2010 Lucian Langa <cooly gnome eu org>
+ * Copyright (C) 2007-2012 Lucian Langa <cooly gnome eu org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -17,8 +17,10 @@
* 02110-1301 USA
*/
+#if EVOLUTION_VERSION < 30503
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
+#endif
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <stdio.h>
@@ -379,47 +381,88 @@ prepare_feed(gpointer key, gpointer value, gpointer user_data)
void
load_gconf_feed(void)
{
- GSList *list, *l = NULL;
char *uid;
+ guint i;
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
+ GSList *list, *l = NULL;
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+ gchar **list;
+#endif
+#if EVOLUTION_VERSION < 30304
list = gconf_client_get_list (client,
"/apps/evolution/evolution-rss/feeds",
GCONF_VALUE_STRING, NULL);
for (l = list; l; l = l->next) {
uid = feeds_uid_from_xml (l->data);
+#else
+ list = g_settings_get_strv (settings, "feeds");
+ for (i = 0; list && list[i]; i++) {
+ uid = feeds_uid_from_xml (list[i]);
+
+#endif
if (!uid)
continue;
+#if EVOLUTION_VERSION < 30304
feed_new_from_xml (l->data);
+#else
+ feed_new_from_xml (list[i]);
+#endif
g_free (uid);
}
+#if EVOLUTION_VERSION < 30304
g_slist_foreach(list, (GFunc) g_free, NULL);
g_slist_free(list);
+#endif
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
}
void
save_gconf_feed(void)
{
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
+#else
+ GSettings *settings = g_settings_new(RSS_CONF_SCHEMA);
+ GPtrArray *d = g_ptr_array_new();
+ GSList *l;
+#endif
g_hash_table_foreach(rf->hrname, prepare_feed, NULL);
- gconf_client_set_list (
- client,
+#if EVOLUTION_VERSION < 30304
+ gconf_client_set_list (client,
"/apps/evolution/evolution-rss/feeds",
- GCONF_VALUE_STRING,
- rss_list,
- NULL);
+ GCONF_VALUE_STRING, rss_list, NULL);
+#else
+ l = rss_list;
+ while (l) {
+ g_ptr_array_add(d, l->data);
+ l = l->next;
+ }
+ g_ptr_array_add (d, NULL);
+ g_settings_set_strv (settings, "feeds", (const gchar * const *)d->pdata);
+ g_ptr_array_free (d, FALSE);
+#endif
while (rss_list) {
g_free (rss_list->data);
rss_list = g_slist_remove (rss_list, rss_list->data);
}
+#if EVOLUTION_VERSION < 30304
gconf_client_suggest_sync (client, NULL);
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
}
diff --git a/src/rss.c b/src/rss.c
index 0c020fb..afc4c58 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -80,6 +80,10 @@ int rss_verbose_debug = 0;
#endif
#endif
+#if EVOLUTION_VERSION >= 30505
+#include <mail/e-mail-reader-utils.h>
+#endif
+
#if EVOLUTION_VERSION >= 30305
#include <libemail-engine/mail-tools.h>
#include <libemail-engine/mail-ops.h>
@@ -285,7 +289,11 @@ rssfeed *rf = NULL;
guint upgrade = 0; // set to 2 when initailization successfull
guint count = 0;
gchar *buffer = NULL;
+#if EVOLUTION_VERSION < 30304
GConfClient *rss_gconf;
+#else
+GSettings *settings;
+#endif
gboolean inhibit_read = FALSE; //prevent mail selection when deleting folder
gboolean delete_op = FALSE; //delete in progress
@@ -679,8 +687,13 @@ download_chunk(
}
progress = (NetStatusProgress*)statusdata;
if (progress->current > 0 && progress->total > 0) {
+#if EVOLUTION_VERSION < 30304
guint encl_max_size = (gint)gconf_client_get_float(
rss_gconf, GCONF_KEY_ENCLOSURE_SIZE, NULL);
+#else
+ guint encl_max_size = g_settings_get_double(
+ settings, CONF_ENCLOSURE_SIZE);
+#endif
if (progress->total > encl_max_size * 1024) { //TOLERANCE!!!
cancel_active_op((gpointer)CFL->file);
return;
@@ -962,12 +975,22 @@ void
network_timeout(void)
{
float timeout;
+#if EVOLUTION_VERSION < 30304
+ rss_gconf = gconf_client_get_default();
+#else
+ settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
if (nettime_id)
g_source_remove(nettime_id);
+#if EVOLUTION_VERSION < 30304
timeout = gconf_client_get_float(
rss_gconf, GCONF_KEY_NETWORK_TIMEOUT, NULL);
+#else
+ timeout = g_settings_get_double(
+ settings, CONF_NETWORK_TIMEOUT);
+#endif
if (!timeout)
timeout = NETWORK_MIN_TIMEOUT;
@@ -1252,31 +1275,60 @@ webkit_set_preferences(void)
agstr = g_strdup_printf("Evolution/%s; Evolution-RSS/%s",
EVOLUTION_VERSION_STRING, VERSION);
g_object_set (settings, "user-agent", agstr, NULL);
+#if EVOLUTION_VERSION < 30304
if (gconf_client_get_bool (rss_gconf,
GCONF_KEY_CUSTOM_FONT, NULL)) {
+#else
+ if (g_settings_get_boolean (settings, CONF_CUSTOM_FONT)) {
+#endif
g_object_set (settings, "minimum-font-size",
+#if EVOLUTION_VERSION < 30304
(gint)gconf_client_get_float(rss_gconf,
GCONF_KEY_MIN_FONT_SIZE, NULL),
+#else
+ (gint)g_settings_get_double(settings,
+ CONF_MIN_FONT_SIZE),
+#endif
NULL);
g_object_set (settings, "minimum-logical-font-size",
+#if EVOLUTION_VERSION < 30304
(gint)gconf_client_get_float(rss_gconf,
GCONF_KEY_MIN_FONT_SIZE, NULL),
+#else
+ (gint)g_settings_get_double(settings,
+ CONF_MIN_FONT_SIZE),
+#endif
NULL);
}
#if (WEBKIT_VERSION >= 1001022)
g_object_set (settings, "enable-page-cache", TRUE, NULL);
//g_object_set (settings, "auto-resize-window", TRUE, NULL);
g_object_set (settings, "enable-plugins",
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(rss_gconf,
GCONF_KEY_EMBED_PLUGIN, NULL),
+#else
+ g_settings_get_boolean(settings,
+ CONF_EMBED_PLUGIN),
+#endif
NULL);
g_object_set (settings, "enable-java-applet",
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(rss_gconf,
GCONF_KEY_HTML_JAVA, NULL),
+#else
+ g_settings_get_boolean(settings,
+ CONF_HTML_JAVA),
+#endif
NULL);
g_object_set (settings, "enable-scripts",
+#if EVOLUTION_VERSION < 30304
gconf_client_get_bool(rss_gconf,
GCONF_KEY_HTML_JS, NULL),
+#else
+ g_settings_get_boolean(settings,
+ CONF_HTML_JS),
+#endif
NULL);
#endif
webkit_web_view_set_full_content_zoom(
@@ -2947,11 +2999,37 @@ void org_gnome_cooly_folder_refresh(void *ep, EShellView *shell_view)
gboolean online;
#if EVOLUTION_VERSION > 22900 //kb//
CamelFolder *folder;
+#if EVOLUTION_VERSION >= 30505
+ CamelStore *selected_store = NULL;
+ gchar *selected_folder_name = NULL;
+ gboolean has_selection;
+#endif
EMFolderTree *folder_tree;
EShellSidebar *shell_sidebar = e_shell_view_get_shell_sidebar(
shell_view);
g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL);
+#if EVOLUTION_VERSION < 30505
folder = em_folder_tree_get_selected_folder (folder_tree);
+#else
+ has_selection = em_folder_tree_get_selected(
+ folder_tree, &selected_store, &selected_folder_name);
+
+ /* Sanity checks */
+ g_warn_if_fail (
+ (has_selection && selected_store != NULL) ||
+ (!has_selection && selected_store == NULL));
+ g_warn_if_fail (
+ (has_selection && selected_folder_name != NULL) ||
+ (!has_selection && selected_folder_name == NULL));
+
+ if (has_selection) {
+ folder = camel_store_get_folder_sync (
+ selected_store, selected_folder_name,
+ CAMEL_STORE_FOLDER_INFO_FAST, NULL, NULL);
+ g_object_unref (selected_store);
+ g_free (selected_folder_name);
+ }
+#endif
g_return_if_fail (folder != NULL);
#if (DATASERVER_VERSION >= 2031001)
folder_name = (gchar *)camel_folder_get_full_name(folder);
@@ -3014,6 +3092,12 @@ void org_gnome_cooly_folder_icon(void *ep, EMEventTargetCustomIcon *t)
gchar *rss_folder, *ofolder, *key;
gchar *main_folder = get_main_folder();
+#if EVOLUTION_VERSION < 30304
+ rss_gconf = gconf_client_get_default();
+#else
+ settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
+
if (t->folder_name == NULL
|| g_ascii_strncasecmp(t->folder_name, main_folder, strlen(main_folder)))
goto out;
@@ -3036,7 +3120,11 @@ void org_gnome_cooly_folder_icon(void *ep, EMEventTargetCustomIcon *t)
evolution_store = t->store;
if (!(g_hash_table_lookup(icons, key))) {
+#if EVOLUTION_VERSION < 30304
if (gconf_client_get_bool (rss_gconf, GCONF_KEY_FEED_ICON, NULL)) {
+#else
+ if (g_settings_get_boolean (settings, CONF_FEED_ICON)) {
+#endif
// if (g_file_test(feed_file, G_FILE_TEST_EXISTS)) {
// unfortunately e_icon_factory_get_icon return broken image in case of error
// we use gdk_pixbuf_new_from_file to test the validity of the image file
@@ -3453,7 +3541,11 @@ add:
}
//search for a feed entry
+#if EVOLUTION_VERSION < 30304
if (gconf_client_get_bool (rss_gconf, GCONF_KEY_SEARCH_RSS, NULL)) {
+#else
+ if (g_settings_get_boolean (settings, CONF_SEARCH_RSS)) {
+#endif
dp("searching new feed\n");
rssurl = search_rss(content->str, content->len);
if (rssurl) {
@@ -4861,19 +4953,33 @@ void org_gnome_cooly_rss_startup(void *ep, ESEventTargetUpgrade *t)
#endif
{
gdouble timeout;
+#if EVOLUTION_VERSION < 30304
+ rss_gconf = gconf_client_get_default();
+#else
+ settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
+#if EVOLUTION_VERSION < 30304
if (gconf_client_get_bool (rss_gconf, GCONF_KEY_START_CHECK, NULL)) {
+#else
+ if (g_settings_get_boolean (settings, CONF_START_CHECK)) {
+#endif
//as I don't know how to set this I'll setup a 10 secs timeout
//and return false for disableation
g_timeout_add (3 * 1000,
(GSourceFunc) update_articles,
0);
}
+#if EVOLUTION_VERSION < 30304
timeout = gconf_client_get_float(
rss_gconf,
GCONF_KEY_REP_CHECK_TIMEOUT,
NULL);
if (gconf_client_get_bool (rss_gconf, GCONF_KEY_REP_CHECK, NULL)) {
+#else
+ timeout = g_settings_get_double(settings, CONF_REP_CHECK_TIMEOUT);
+ if (g_settings_get_boolean (settings, CONF_REP_CHECK)) {
+#endif
rf->rc_id = g_timeout_add (60 * 1000 * timeout,
(GSourceFunc) update_articles,
(gpointer)1);
@@ -5146,8 +5252,12 @@ guint
fallback_engine(void)
{
#ifdef HAVE_RENDERKIT
+#if EVOLUTION_VERSION < 30304
guint engine = gconf_client_get_int(
rss_gconf, GCONF_KEY_HTML_RENDER, NULL);
+#else
+ guint engine = g_settings_get_int(settings, CONF_HTML_RENDER);
+#endif
#if !defined(HAVE_GECKO) && !defined (HAVE_WEBKIT)
engine = 0;
#endif
@@ -5249,7 +5359,11 @@ e_plugin_lib_enable(EPlugin *ep, int enable)
bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
// textdomain (GETTEXT_PACKAGE);
+#if EVOLUTION_VERSION < 30304
rss_gconf = gconf_client_get_default();
+#else
+ settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
upgrade = 1;
d = getenv("RSS_DEBUG");
if (d)
@@ -5283,21 +5397,34 @@ e_plugin_lib_enable(EPlugin *ep, int enable)
/*GD-BUS init*/
init_gdbus ();
prepare_hashes();
+#if EVOLUTION_VERSION < 30304
if (gconf_client_get_bool (rss_gconf, GCONF_KEY_STATUS_ICON, NULL))
+#else
+ if (g_settings_get_boolean (settings, CONF_STATUS_ICON))
+#endif
create_status_icon();
//there is no shutdown for e-plugin yet.
atexit(rss_finalize);
+#if EVOLUTION_VERSION < 30304
render = GPOINTER_TO_INT(
gconf_client_get_int(rss_gconf,
GCONF_KEY_HTML_RENDER,
NULL));
+#else
+ render = g_settings_get_int(settings, CONF_HTML_RENDER);
+#endif
if (!render) { // set render just in case it was forced in configure
render = RENDER_N;
+#if EVOLUTION_VERSION < 30304
gconf_client_set_int(
rss_gconf,
GCONF_KEY_HTML_RENDER,
render, NULL);
+#else
+ g_settings_set_int(settings,
+ CONF_HTML_RENDER, render);
+#endif
}
#ifdef HAVE_GECKO
if (2 == render)
@@ -5593,8 +5720,15 @@ create_mail(create_feed *CF)
// g_object_weak_ref((GObject *)filter_uids, free_filter_uids, NULL);
}
//FIXME too lasy to write a separate function
- if (!rf->import)
+ if (!rf->import) {
+#if EVOLUTION_VERSION < 30505
mail_refresh_folder(mail_folder, NULL, NULL);
+#else
+ EShellContent *shell_content = e_shell_view_get_shell_content (rss_shell_view);
+ EMailReader *reader = E_MAIL_READER (shell_content);
+ e_mail_reader_refresh_folder(reader, mail_folder);
+#endif
+ }
#if (DATASERVER_VERSION >= 2031001)
g_object_unref(rtext);
g_object_unref(new);
@@ -5964,11 +6098,19 @@ display_doc_finish (GObject *o, GAsyncResult *result, gpointer user_data)
{
GSimpleAsyncResult *simple;
AsyncData *asyncr;
+#if EVOLUTION_VERSION < 30304
GConfClient *client = gconf_client_get_default();
+#else
+ settings = g_settings_new(RSS_CONF_SCHEMA);
+#endif
simple = G_SIMPLE_ASYNC_RESULT (result);
asyncr = g_simple_async_result_get_op_res_gpointer (simple);
+#if EVOLUTION_VERSION < 30304
if (gconf_client_get_bool (client, GCONF_KEY_STATUS_ICON, NULL)) {
+#else
+ if (g_settings_get_boolean (settings, CONF_STATUS_ICON)) {
+#endif
update_status_icon(asyncr->status_msg);
}
if (asyncr->mail_folder) {
@@ -5984,7 +6126,11 @@ display_doc_finish (GObject *o, GAsyncResult *result, gpointer user_data)
camel_object_unref(asyncr->mail_folder);
#endif
}
+#if EVOLUTION_VERSION < 30304
g_object_unref(client);
+#else
+ g_object_unref(settings);
+#endif
}
gchar *
diff --git a/src/rss.h b/src/rss.h
index 89843b5..864e214 100644
--- a/src/rss.h
+++ b/src/rss.h
@@ -180,6 +180,7 @@ typedef struct _rssfeed {
GList *enclist; // network downloads tracking
} rssfeed;
+#if EVOLUTION_VERSION < 30304
#define GCONF_KEY_DISPLAY_SUMMARY "/apps/evolution/evolution-rss/display_summary"
#define GCONF_KEY_START_CHECK "/apps/evolution/evolution-rss/startup_check"
#define GCONF_KEY_CUSTOM_FONT "/apps/evolution/evolution-rss/custom_font"
@@ -201,6 +202,30 @@ typedef struct _rssfeed {
#define GCONF_KEY_ACCEPT_COOKIES "/apps/evolution/evolution-rss/accept_cookies"
#define GCONF_KEY_IMAGE_RESIZE "/apps/evolution/evolution-rss/image_resize"
#define GCONF_KEY_SEARCH_RSS "/apps/evolution/evolution-rss/search_rss"
+#else
+#define RSS_CONF_SCHEMA "org.gnome.evolution.plugin.evolution-rss"
+#define CONF_DISPLAY_SUMMARY "display-summary"
+#define CONF_ACCEPT_COOKIES "accept-cookies"
+#define CONF_DOWNLOAD_ENCLOSURES "download-enclosures"
+#define CONF_ENCLOSURE_LIMIT "enclosure-limit"
+#define CONF_ENCLOSURE_SIZE "enclosure-size"
+#define CONF_REMOVE_FOLDER "remove-folder"
+#define CONF_CUSTOM_FONT "custom-font"
+#define CONF_MIN_FONT_SIZE "min-font-size"
+#define CONF_HTML_RENDER "html-render"
+#define CONF_HTML_JS "html-js"
+#define CONF_HTML_JAVA "html-java"
+#define CONF_EMBED_PLUGIN "embed-plugin"
+#define CONF_STATUS_ICON "status-icon"
+#define CONF_BLINK_ICON "blink-icon"
+#define CONF_START_CHECK "startup-check"
+#define CONF_REP_CHECK "rep-check"
+#define CONF_REP_CHECK_TIMEOUT "rep-check-timeout"
+#define CONF_IMAGE_RESIZE "image-resize"
+#define CONF_SEARCH_RSS "search-rss"
+#define CONF_FEED_ICON "feed-icon"
+#define CONF_SHOW_COMMENTS "show-comments"
+#endif
enum {
RSS_FEED,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]