[evolution-rss] code cleanups
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] code cleanups
- Date: Thu, 30 Sep 2010 19:28:59 +0000 (UTC)
commit 71f5a83d64143686c479f7e4a98334e27f5d3477
Author: Lucian Langa <lucilanga gnome org>
Date: Sun Aug 29 08:29:57 2010 +0300
code cleanups
configure.ac | 5 ---
src/Makefile.am | 1 -
src/rss-config-factory.c | 68 +++++++++++++++++++++++-----------------------
src/rss.c | 24 ++++++++--------
4 files changed, 46 insertions(+), 52 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8f00171..6045a04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -276,11 +276,6 @@ AC_SUBST(RENDER_CFLAGS)
AC_SUBST(RENDER)
AC_SUBST(RENDER_N)
-# check for ellipsize
-GTK_VERSION=`$PKG_CONFIG --modversion gtk+-2.0`
-GTK_VERSION=`echo $GTK_VERSION|$AWK -F . '{print $1 * 1000000 + $2 * 1000 + $3}'`
-AC_SUBST(GTK_VERSION)
-
dnl ***********
dnl GConf stuff
dnl ***********
diff --git a/src/Makefile.am b/src/Makefile.am
index 8d84331..9d481e4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,7 +14,6 @@ INCLUDES = \
-DDATASERVER_VERSION=$(DATASERVER_VERSION) \
-DEVOLUTION_UIDIR=\""$(uidir)"\" \
-DEVOLUTION_ICONDIR=\""$(ICON_DIR)"\" \
- -DGTK_VERSION="$(GTK_VERSION)" \
-DLIBSOUP_VERSION="$(SOUP_VERSION)" \
-DWEBKIT_VERSION="$(WEBKIT_VERSION)" \
-DRENDER=\""$(RENDER)"\" \
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index 3e75df6..6848cda 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -735,12 +735,12 @@ build_dialog_add(gchar *url, gchar *feed_text)
ok = GTK_WIDGET (
gtk_builder_get_object(gui, "ok_button"));
-#if GTK_VERSION < 2018000
+#if GTK_CHECK_VERSION (2,18,0)
+ gtk_widget_set_can_default (ok, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (
ok,
GTK_CAN_DEFAULT);
-#else
- gtk_widget_set_can_default (ok, TRUE);
#endif
d("/*Gtk-CRITICAL **: gtk_box_pack: assertion `child->parent == NULL' failed*/");
gtk_dialog_add_action_widget (
@@ -754,12 +754,12 @@ build_dialog_add(gchar *url, gchar *feed_text)
GTK_DIALOG (dialog1),
cancel,
GTK_RESPONSE_CANCEL);
-#if GTK_VERSION < 2018000
+#if GTK_CHECK_VERSION (2,18,0)
+ gtk_widget_set_can_default (cancel, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (
cancel,
GTK_CAN_DEFAULT);
-#else
- gtk_widget_set_can_default (cancel, TRUE);
#endif
gtk_widget_add_accelerator (
@@ -940,7 +940,7 @@ feeds_dialog_add(GtkDialog *d, gpointer data)
NULL);
#endif
progress = gtk_progress_bar_new();
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
gtk_box_pack_start(
GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(msg_feeds))),
progress,
@@ -1343,7 +1343,7 @@ remove_feed_dialog(gchar *msg)
#endif
gtk_window_set_keep_above(GTK_WINDOW(dialog1), TRUE);
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
dialog_vbox1 = gtk_dialog_get_content_area(GTK_DIALOG (dialog1));
#else
dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;
@@ -1382,7 +1382,7 @@ remove_feed_dialog(gchar *msg)
FALSE,
0);
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
dialog_action_area1 = gtk_dialog_get_action_area(GTK_DIALOG (dialog1));
#else
dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
@@ -1455,7 +1455,7 @@ process_dialog_edit(add_feed *feed, gchar *url, gchar *feed_name)
NULL);
#endif
progress = gtk_progress_bar_new();
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
gtk_box_pack_start(
GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(msg_feeds))),
progress,
@@ -1752,7 +1752,7 @@ error: rss_error(NULL,
NULL);
import_label = gtk_label_new(_("Please wait"));
import_progress = gtk_progress_bar_new();
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
gtk_box_pack_start(
GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(import_dialog))),
import_label,
@@ -1975,7 +1975,7 @@ fail: g_free(rssprefix);
gtk_label_set_text(
GTK_LABEL(import_label),
(gchar *)name);
-#if GTK_VERSION >= 2006000
+#if GTK_CHECK_VERSION (2,6,0)
gtk_label_set_ellipsize (
GTK_LABEL (import_label),
PANGO_ELLIPSIZE_START);
@@ -2202,14 +2202,14 @@ create_import_dialog (void)
GTK_WINDOW (import_file_select),
GDK_WINDOW_TYPE_HINT_DIALOG);
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
dialog_vbox5 = gtk_dialog_get_content_area(GTK_DIALOG (import_file_select));
#else
dialog_vbox5 = GTK_DIALOG (import_file_select)->vbox;
#endif
gtk_widget_show (dialog_vbox5);
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
dialog_action_area5 = gtk_dialog_get_action_area(
GTK_DIALOG (import_file_select));
#else
@@ -2227,14 +2227,14 @@ create_import_dialog (void)
GTK_DIALOG (import_file_select),
button1,
GTK_RESPONSE_CANCEL);
-#if GTK_VERSION < 2018000
- GTK_WIDGET_SET_FLAGS (
- button1,
- GTK_CAN_DEFAULT);
-#else
+#if GTK_CHECK_VERSION (2,18,0)
gtk_widget_set_can_default (
button1,
TRUE);
+#else
+ GTK_WIDGET_SET_FLAGS (
+ button1,
+ GTK_CAN_DEFAULT);
#endif
button2 = gtk_button_new_from_stock ("gtk-open");
@@ -2243,12 +2243,12 @@ create_import_dialog (void)
GTK_DIALOG (import_file_select),
button2,
GTK_RESPONSE_OK);
-#if GTK_VERSION < 2018000
+#if GTK_CHECK_VERSION (2,18,0)
+ gtk_widget_set_can_default(button2, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (
button2,
GTK_CAN_DEFAULT);
-#else
- gtk_widget_set_can_default(button2, TRUE);
#endif
gtk_widget_grab_default (button2);
@@ -2292,14 +2292,14 @@ create_export_dialog (void)
GTK_WINDOW (export_file_select),
GDK_WINDOW_TYPE_HINT_DIALOG);
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
vbox26 = gtk_dialog_get_content_area(GTK_DIALOG (export_file_select));
#else
vbox26 = GTK_DIALOG (export_file_select)->vbox;
#endif
gtk_widget_show (vbox26);
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
hbuttonbox1 = gtk_dialog_get_action_area(
GTK_DIALOG (export_file_select));
#else
@@ -2316,24 +2316,24 @@ create_export_dialog (void)
GTK_DIALOG (export_file_select),
button3,
GTK_RESPONSE_CANCEL);
-#if GTK_VERSION < 2018000
+#if GTK_CHECK_VERSION (2,18,0)
+ gtk_widget_set_can_default(button3, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (
button3,
GTK_CAN_DEFAULT);
-#else
- gtk_widget_set_can_default(button3, TRUE);
#endif
button4 = gtk_button_new_from_stock ("gtk-save");
gtk_widget_show (button4);
gtk_dialog_add_action_widget (
GTK_DIALOG (export_file_select),
button4, GTK_RESPONSE_OK);
-#if GTK_VERSION < 2018000
+#if GTK_CHECK_VERSION (2,18,0)
+ gtk_widget_set_can_default(button4, TRUE);
+#else
GTK_WIDGET_SET_FLAGS (
button4,
GTK_CAN_DEFAULT);
-#else
- gtk_widget_set_can_default(button4, TRUE);
#endif
gtk_widget_grab_default (button4);
@@ -2619,7 +2619,7 @@ export_opml(gchar *file)
// g_signal_connect(import_dialog, "response", G_CALLBACK(import_dialog_response), NULL);
import_label = gtk_label_new(_("Please wait"));
import_progress = gtk_progress_bar_new();
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
content_area = gtk_dialog_get_content_area(GTK_DIALOG(import_dialog));
#else
content_area = GTK_DIALOG(import_dialog)->vbox;
@@ -3080,7 +3080,7 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
"rss-html-rendering.ui",
NULL);
ui->xml = gtk_builder_new ();
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
if (!gtk_builder_add_objects_from_file (ui->xml, uifile, toplevel, &error)) {
g_warning ("Couldn't load builder file: %s", error->message);
g_error_free (error);
@@ -3489,7 +3489,7 @@ rss_folder_factory (EPlugin *epl, EConfigHookItemFactoryData *data)
feed = build_dialog_add(url, ofolder);
//we do not need ok/cancel buttons here
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
action_area = gtk_dialog_get_action_area(GTK_DIALOG(feed->dialog));
#else
action_area = GTK_DIALOG (feed->dialog)->action_area;
@@ -3675,7 +3675,7 @@ rss_config_control_new (void)
GTK_TREE_VIEW (treeview),
2);
gtk_tree_view_set_search_column(treeview, 1);
-#if GTK_VERSION >= 2012000
+#if GTK_CHECK_VERSION (2,12,0)
gtk_tree_view_set_tooltip_column (treeview, 3);
#endif
diff --git a/src/rss.c b/src/rss.c
index d808749..98ea88d 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -660,7 +660,7 @@ create_user_pass_dialog(RSS_AUTH *auth)
gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
password_dialog = GTK_WIDGET (widget);
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
action_area = gtk_dialog_get_action_area (GTK_DIALOG(password_dialog));
content_area = gtk_dialog_get_content_area (GTK_DIALOG(password_dialog));
#else
@@ -1048,7 +1048,7 @@ rss_browser_set_hsize (GtkAdjustment *adj, gpointer data);
void
rss_browser_set_hsize (GtkAdjustment *adj, gpointer data)
{
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
resize_pane_hsize = gtk_adjustment_get_page_size(adj);
#else
resize_pane_hsize = (adj->page_size);
@@ -1069,7 +1069,7 @@ rss_browser_update_content (
if (GTK_IS_WIDGET(widget)) {
if (rf->mozembed)
if (
-#if GTK_VERSION >= 2019007
+#if GTK_CHECK_VERSION (2,19,7)
gtk_widget_get_realized(rf->mozembed)
#else
GTK_WIDGET_REALIZED(rf->mozembed)
@@ -1790,14 +1790,14 @@ org_gnome_rss_browser (EMFormatHTML *efh, void *eb, EMFormatHTMLPObject *pobject
adj = gtk_scrolled_window_get_vadjustment(
(GtkScrolledWindow *)gtk_widget_get_parent(po->html));
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
height = (int)gtk_adjustment_get_page_size(adj);
#else
height = (int)(adj->page_size);
#endif
adj = gtk_scrolled_window_get_hadjustment(
(GtkScrolledWindow *)gtk_widget_get_parent(po->html));
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
width = (int)gtk_adjustment_get_page_size(adj);
#else
width = (int)(adj->page_size);
@@ -2308,7 +2308,7 @@ void org_gnome_cooly_format_rss(void *ep, EMFormatHookTarget *t) //camelmimepart
} else
tmp = g_strdup((gchar *)(buffer->data));
-#if GTK_VERSION >= 2018000
+#if GTK_CHECK_VERSION (2,18,0)
gtk_widget_get_allocation(obj, &alloc);
#else
alloc.width = obj->allocation.width;;
@@ -4202,10 +4202,10 @@ store_folder_renamed(CamelStore *store,
#endif
gchar *main_folder = lookup_main_folder();
#if (DATASERVER_VERSION < 2031001)
- if (!g_ascii_strncasecmp(info->old_base, main_folder, strlen(main_folder))
+ if (!g_ascii_strncasecmp(info->old_base, main_folder, strlen(main_folder))
|| !g_ascii_strncasecmp(info->old_base, OLD_FEEDS_FOLDER, strlen(OLD_FEEDS_FOLDER))) {
#else
- if (!g_ascii_strncasecmp(old_name, main_folder, strlen(main_folder))
+ if (!g_ascii_strncasecmp(old_name, main_folder, strlen(main_folder))
|| !g_ascii_strncasecmp(old_name, OLD_FEEDS_FOLDER, strlen(OLD_FEEDS_FOLDER))) {
#endif
@@ -4371,7 +4371,7 @@ custom_fetch_feed(gpointer key, gpointer value, gpointer user_data)
void evo_window_popup(GtkWidget *win)
{
gint x, y, sx, sy, new_x, new_y;
-#if GTK_VERSION >= 2014000
+#if GTK_CHECK_VERSION (2,14,0)
GdkWindow *window = gtk_widget_get_window(win);
#else
GdkWindow *window = win->window;
@@ -4493,7 +4493,7 @@ update_status_icon(const char *channel, gchar *title)
stext = g_markup_escape_text(
flat_status_msg,
strlen(flat_status_msg));
-#if GTK_VERSION >= 2016000
+#if GTK_CHECK_VERSION (2,16,0)
gtk_status_icon_set_tooltip_text (status_icon, stext);
#else
gtk_status_icon_set_tooltip (status_icon, stext);
@@ -4796,11 +4796,11 @@ org_gnome_evolution_rss(void *ep, EMPopupTargetSelect *t)
pretty_url = g_strdup ("RSS");
label = gtk_label_new (NULL);
-#if GTK_VERSION >= 2006000
+#if GTK_CHECK_VERSION (2,6,0)
gtk_label_set_ellipsize (
GTK_LABEL (label), PANGO_ELLIPSIZE_END);
#endif
-#if GTK_VERSION > 2008011
+#if GTK_CHECK_VERSION (2,8,11)
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
#endif
gtk_label_set_markup (GTK_LABEL (label), pretty_url);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]