[balsa/gtk3] Build with gtk 3.6, at least without threads
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Build with gtk 3.6, at least without threads
- Date: Thu, 22 Nov 2012 00:46:00 +0000 (UTC)
commit 1730427aacaf46fb5176d54168d0ea303099d13f
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed Nov 21 19:44:57 2012 -0500
Build with gtk 3.6, at least without threads
* libbalsa/information.c: include libbalsa.h.
* libbalsa/libbalsa.h: when not threaded, define
gdk_threads_{enter,leave} to nothing.
* libbalsa/mailbox.c (lbm_cache_message): when not threaded,
avoid recursive signal call.
* libbalsa/misc.c: remove deprecated GtkTable code.
* libbalsa/misc.h: ditto.
* src/balsa-mime-widget-image.c (img_check_size): build with
gdk_threads_{enter,leave} defined to nothing.
* src/filter-edit-callbacks.c (fe_apply_pressed),
(fe_filters_list_selection_changed): deprecation cleanup.
* src/filter-edit-dialog.c (fe_make_color_buttons): ditto.
* src/main-window.c: CSS cleanup.
* src/pref-manager.c (apply_prefs), (set_prefs): deprecation
cleanup.
ChangeLog | 20 ++++++++++++
libbalsa/information.c | 1 +
libbalsa/libbalsa.h | 2 +
libbalsa/mailbox.c | 14 ++------
libbalsa/misc.c | 68 -----------------------------------------
libbalsa/misc.h | 10 ------
src/balsa-mime-widget-image.c | 7 +++-
src/filter-edit-callbacks.c | 32 +++++++++++++++++++
src/filter-edit-dialog.c | 14 ++++++++
src/main-window.c | 10 +++---
src/pref-manager.c | 8 ++--
11 files changed, 87 insertions(+), 99 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 182336b..7921aca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2012-11-21 Peter Bloomfield
+
+ Build with gtk 3.6, at least without threads
+
+ * libbalsa/information.c: include libbalsa.h.
+ * libbalsa/libbalsa.h: when not threaded, define
+ gdk_threads_{enter,leave} to nothing.
+ * libbalsa/mailbox.c (lbm_cache_message): when not threaded,
+ avoid recursive signal call.
+ * libbalsa/misc.c: remove deprecated GtkTable code.
+ * libbalsa/misc.h: ditto.
+ * src/balsa-mime-widget-image.c (img_check_size): build with
+ gdk_threads_{enter,leave} defined to nothing.
+ * src/filter-edit-callbacks.c (fe_apply_pressed),
+ (fe_filters_list_selection_changed): deprecation cleanup.
+ * src/filter-edit-dialog.c (fe_make_color_buttons): ditto.
+ * src/main-window.c: CSS cleanup.
+ * src/pref-manager.c (apply_prefs), (set_prefs): deprecation
+ cleanup.
+
2012-11-14 Peter Bloomfield
Port to newly released Gtkspell 3.0
diff --git a/libbalsa/information.c b/libbalsa/information.c
index 12bd21b..59bfc7d 100644
--- a/libbalsa/information.c
+++ b/libbalsa/information.c
@@ -24,6 +24,7 @@
# include "config.h"
#endif /* HAVE_CONFIG_H */
#include "information.h"
+#include "libbalsa.h"
#ifdef HAVE_NOTIFY
#include <libnotify/notify.h>
diff --git a/libbalsa/libbalsa.h b/libbalsa/libbalsa.h
index 21248ee..516cd44 100644
--- a/libbalsa/libbalsa.h
+++ b/libbalsa/libbalsa.h
@@ -149,6 +149,8 @@ gboolean libbalsa_threads_has_lock(void);
#else
#define libbalsa_am_i_subthread() FALSE
#define libbalsa_threads_has_lock() TRUE
+#define gdk_threads_enter()
+#define gdk_threads_leave()
#endif /* BALSA_USE_THREADS */
void libbalsa_message(const char *fmt, ...)
#ifdef __GNUC__
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 870a2c3..bf727e5 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -367,14 +367,6 @@ lbm_index_entry_populate_from_msg(LibBalsaMailboxIndexEntry * entry,
libbalsa_mailbox_msgno_changed(msg->mailbox, msg->msgno);
}
-static LibBalsaMailboxIndexEntry*
-lbm_index_entry_new_from_msg(LibBalsaMessage *msg)
-{
- LibBalsaMailboxIndexEntry *entry = g_new(LibBalsaMailboxIndexEntry,1);
- lbm_index_entry_populate_from_msg(entry, msg);
- return entry;
-}
-
#ifdef BALSA_USE_THREADS
static LibBalsaMailboxIndexEntry*
lbm_index_entry_new_pending(void)
@@ -1927,9 +1919,11 @@ lbm_cache_message(LibBalsaMailbox * mailbox, guint msgno,
entry = g_ptr_array_index(mailbox->mindex, msgno - 1);
- if (!entry)
+ if (!entry) {
g_ptr_array_index(mailbox->mindex, msgno - 1) =
- lbm_index_entry_new_from_msg(message);
+ entry = g_new(LibBalsaMailboxIndexEntry, 1);
+ lbm_index_entry_populate_from_msg(entry, message);
+ }
#if BALSA_USE_THREADS
else if (entry->idle_pending)
lbm_index_entry_populate_from_msg(entry, message);
diff --git a/libbalsa/misc.c b/libbalsa/misc.c
index da61655..5797edf 100644
--- a/libbalsa/misc.c
+++ b/libbalsa/misc.c
@@ -1093,19 +1093,6 @@ libbalsa_ia_rfc2821_equal(const InternetAddress * a,
#define LB_PADDING 12 /* per HIG */
GtkWidget *
-libbalsa_create_table(guint rows, guint columns)
-{
- GtkWidget *table;
-
- table = gtk_table_new(rows, columns, FALSE);
-
- gtk_table_set_row_spacings(GTK_TABLE(table), LB_PADDING);
- gtk_table_set_col_spacings(GTK_TABLE(table), LB_PADDING);
-
- return table;
-}
-
-GtkWidget *
libbalsa_create_grid(void)
{
GtkWidget *grid;
@@ -1124,19 +1111,6 @@ libbalsa_create_grid(void)
in create_entry.
*/
GtkWidget *
-libbalsa_create_label(const gchar * text, GtkWidget * table, gint row)
-{
- GtkWidget *label = gtk_label_new_with_mnemonic(text);
-
- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
-
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, row, row + 1,
- GTK_FILL, GTK_FILL, 0, 0);
-
- return label;
-}
-
-GtkWidget *
libbalsa_create_grid_label(const gchar * text, GtkWidget * grid, gint row)
{
GtkWidget *label;
@@ -1154,24 +1128,6 @@ libbalsa_create_grid_label(const gchar * text, GtkWidget * grid, gint row)
creates a checkbox with a given label and places them in given array.
*/
GtkWidget *
-libbalsa_create_check(const gchar * text, GtkWidget * table, gint row,
- gboolean initval)
-{
- GtkWidget *check_button;
-
- check_button = gtk_check_button_new_with_mnemonic(text);
-
- gtk_table_attach(GTK_TABLE(table), check_button, 0, 2, row, row + 1,
- GTK_FILL, 0, 0, 0);
-
- if (initval)
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button),
- TRUE);
-
- return check_button;
-}
-
-GtkWidget *
libbalsa_create_grid_check(const gchar * text, GtkWidget * grid, gint row,
gboolean initval)
{
@@ -1190,30 +1146,6 @@ libbalsa_create_grid_check(const gchar * text, GtkWidget * grid, gint row,
/* Create a text entry and add it to the table */
GtkWidget *
-libbalsa_create_entry(GtkWidget * table, GCallback changed_func,
- gpointer data, gint row, const gchar * initval,
- GtkWidget * hotlabel)
-{
- GtkWidget *entry;
-
- entry = gtk_entry_new();
-
- gtk_table_attach(GTK_TABLE(table), entry, 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
-
- if (initval)
- gtk_entry_set_text(GTK_ENTRY(entry), initval);
-
- gtk_label_set_mnemonic_widget(GTK_LABEL(hotlabel), entry);
-
- /* Watch for changes... */
- if (changed_func)
- g_signal_connect(entry, "changed", changed_func, data);
-
- return entry;
-}
-
-GtkWidget *
libbalsa_create_grid_entry(GtkWidget * grid, GCallback changed_func,
gpointer data, gint row, const gchar * initval,
GtkWidget * hotlabel)
diff --git a/libbalsa/misc.h b/libbalsa/misc.h
index ec1a2f5..1a48033 100644
--- a/libbalsa/misc.h
+++ b/libbalsa/misc.h
@@ -163,23 +163,13 @@ int libbalsa_safe_rename (const char *src, const char *target);
gboolean libbalsa_ia_rfc2821_equal(const InternetAddress * a,
const InternetAddress * b);
-
-GtkWidget *libbalsa_create_table(guint rows, guint columns);
GtkWidget *libbalsa_create_grid(void);
-GtkWidget *libbalsa_create_label(const gchar * label, GtkWidget * table,
- gint row);
GtkWidget *libbalsa_create_grid_label(const gchar * label, GtkWidget * grid,
gint row);
-GtkWidget *libbalsa_create_entry(GtkWidget * table, GCallback func,
- gpointer data, gint row,
- const gchar * initval,
- GtkWidget * hotlabel);
GtkWidget *libbalsa_create_grid_entry(GtkWidget * grid, GCallback func,
gpointer data, gint row,
const gchar * initval,
GtkWidget * hotlabel);
-GtkWidget *libbalsa_create_check(const gchar * label, GtkWidget * table,
- gint row, gboolean initval);
GtkWidget *libbalsa_create_grid_check(const gchar * label, GtkWidget * grid,
gint row, gboolean initval);
GtkSizeGroup *libbalsa_create_size_group(GtkWidget * chooser);
diff --git a/src/balsa-mime-widget-image.c b/src/balsa-mime-widget-image.c
index 5605dd3..d1789a5 100644
--- a/src/balsa-mime-widget-image.c
+++ b/src/balsa-mime-widget-image.c
@@ -203,8 +203,11 @@ img_check_size(GtkImage ** widget_p)
g_object_set_data(G_OBJECT(widget), "check_size_sched",
GINT_TO_POINTER(FALSE));
- g_return_val_if_fail(viewport && mime_body && orig_width > 0,
- (gdk_threads_leave(), FALSE));
+ g_warn_if_fail(viewport && mime_body && orig_width > 0);
+ if (!(viewport && mime_body && orig_width > 0)) {
+ gdk_threads_leave();
+ return FALSE;
+ }
if (gtk_image_get_storage_type(widget) == GTK_IMAGE_PIXBUF)
curr_w = gdk_pixbuf_get_width(gtk_image_get_pixbuf(widget));
diff --git a/src/filter-edit-callbacks.c b/src/filter-edit-callbacks.c
index 8a18a50..5510510 100644
--- a/src/filter-edit-callbacks.c
+++ b/src/filter-edit-callbacks.c
@@ -1897,16 +1897,26 @@ fe_apply_pressed(GtkWidget * widget, gpointer data)
fil->action=action;
if (fil->action == FILTER_COLOR) {
+#if GTK_CHECK_VERSION(3, 4, 0)
+ GdkRGBA rgba;
+#else /* GTK_CHECK_VERSION(3, 4, 0) */
GdkColor color;
+#endif /* GTK_CHECK_VERSION(3, 4, 0) */
GString *string = g_string_new(NULL);
GtkToggleButton *toggle_button;
gchar *color_string;
toggle_button = (GTK_TOGGLE_BUTTON(fe_foreground_set));
if (gtk_toggle_button_get_active(toggle_button)) {
+#if GTK_CHECK_VERSION(3, 4, 0)
+ gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(fe_foreground),
+ &rgba);
+ color_string = gdk_rgba_to_string(&rgba);
+#else /* GTK_CHECK_VERSION(3, 4, 0) */
gtk_color_button_get_color(GTK_COLOR_BUTTON(fe_foreground),
&color);
color_string = gdk_color_to_string(&color);
+#endif /* GTK_CHECK_VERSION(3, 4, 0) */
g_string_append_printf(string, "foreground:%s", color_string);
g_free(color_string);
gtk_toggle_button_set_active(toggle_button, FALSE);
@@ -1914,9 +1924,15 @@ fe_apply_pressed(GtkWidget * widget, gpointer data)
toggle_button = (GTK_TOGGLE_BUTTON(fe_background_set));
if (gtk_toggle_button_get_active(toggle_button)) {
+#if GTK_CHECK_VERSION(3, 4, 0)
+ gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(fe_background),
+ &rgba);
+ color_string = gdk_rgba_to_string(&rgba);
+#else /* GTK_CHECK_VERSION(3, 4, 0) */
gtk_color_button_get_color(GTK_COLOR_BUTTON(fe_background),
&color);
color_string = gdk_color_to_string(&color);
+#endif /* GTK_CHECK_VERSION(3, 4, 0) */
if (string->len > 0)
g_string_append_c(string, ';');
g_string_append_printf(string, "background:%s", color_string);
@@ -2062,21 +2078,37 @@ fe_filters_list_selection_changed(GtkTreeSelection * selection,
gtk_combo_box_set_active(GTK_COMBO_BOX(fe_op_codes_option_menu), pos);
if (fil->action == FILTER_COLOR) {
gchar **parts, **p;
+#if GTK_CHECK_VERSION(3, 4, 0)
+ GdkRGBA rgba;
+#else /* GTK_CHECK_VERSION(3, 4, 0) */
GdkColor color;
+#endif /* GTK_CHECK_VERSION(3, 4, 0) */
parts = g_strsplit(fil->action_string, ";", 2);
for (p = parts; *p; p++) {
if (g_str_has_prefix(*p, "foreground:")) {
+#if GTK_CHECK_VERSION(3, 4, 0)
+ gdk_rgba_parse(&rgba, (*p) + 11);
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(fe_foreground),
+ &rgba);
+#else /* GTK_CHECK_VERSION(3, 4, 0) */
gdk_color_parse((*p) + 11, &color);
gtk_color_button_set_color(GTK_COLOR_BUTTON(fe_foreground),
&color);
+#endif /* GTK_CHECK_VERSION(3, 4, 0) */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(fe_foreground_set), TRUE);
}
if (g_str_has_prefix(*p, "background:")) {
+#if GTK_CHECK_VERSION(3, 4, 0)
+ gdk_rgba_parse(&rgba, (*p) + 11);
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(fe_background),
+ &rgba);
+#else /* GTK_CHECK_VERSION(3, 4, 0) */
gdk_color_parse((*p) + 11, &color);
gtk_color_button_set_color(GTK_COLOR_BUTTON(fe_background),
&color);
+#endif /* GTK_CHECK_VERSION(3, 4, 0) */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
(fe_background_set), TRUE);
}
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index a09e341..7d7b846 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -339,7 +339,11 @@ fe_make_color_buttons(void)
{
GtkWidget *grid_widget;
GtkGrid *grid;
+#if GTK_CHECK_VERSION(3, 4, 0)
+ GdkRGBA rgba;
+#else /* GTK_CHECK_VERSION(3, 4, 0) */
GdkColor color;
+#endif /* GTK_CHECK_VERSION(3, 4, 0) */
grid_widget = gtk_grid_new();
grid = GTK_GRID(grid_widget);
@@ -348,8 +352,13 @@ fe_make_color_buttons(void)
fe_foreground_set = gtk_check_button_new_with_mnemonic(_("Foreground"));
gtk_grid_attach(grid, fe_foreground_set, 0, 0, 1, 1);
+#if GTK_CHECK_VERSION(3, 4, 0)
+ gdk_rgba_parse(&rgba, "black");
+ fe_foreground = gtk_color_button_new_with_rgba(&rgba);
+#else /* GTK_CHECK_VERSION(3, 4, 0) */
gdk_color_parse("black", &color);
fe_foreground = gtk_color_button_new_with_color(&color);
+#endif /* GTK_CHECK_VERSION(3, 4, 0) */
gtk_widget_set_sensitive(fe_foreground, FALSE);
gtk_grid_attach(grid, fe_foreground, 1, 0, 1, 1);
g_signal_connect(fe_foreground_set, "toggled",
@@ -359,8 +368,13 @@ fe_make_color_buttons(void)
fe_background_set = gtk_check_button_new_with_mnemonic(_("Background"));
gtk_grid_attach(grid, fe_background_set, 0, 1, 1, 1);
+#if GTK_CHECK_VERSION(3, 4, 0)
+ gdk_rgba_parse(&rgba, "white");
+ fe_background = gtk_color_button_new_with_rgba(&rgba);
+#else /* GTK_CHECK_VERSION(3, 4, 0) */
gdk_color_parse("white", &color);
fe_background = gtk_color_button_new_with_color(&color);
+#endif /* GTK_CHECK_VERSION(3, 4, 0) */
gtk_widget_set_sensitive(fe_background, FALSE);
gtk_grid_attach(grid, fe_background, 1, 1, 1, 1);
g_signal_connect(fe_background_set, "toggled",
diff --git a/src/main-window.c b/src/main-window.c
index 0874dd5..69fdc56 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2291,11 +2291,11 @@ bw_notebook_label_new(BalsaMailboxNode * mbnode)
if (!gtk_css_provider_load_from_data(css_provider,
"#balsa-notebook-tab-button"
"{"
- "-GtkWidget-focus-padding: 0;"
- "-GtkWidget-focus-line-width: 0;"
- "border-width: 0;"
- "padding: 0;"
- "margin: 0;"
+ "-GtkWidget-focus-padding: 0px;"
+ "-GtkWidget-focus-line-width: 0px;"
+ "border-width: 0px;"
+ "padding: 0px;"
+ "margin: 0px;"
"}",
-1, NULL))
g_print("Could not load CSS data.\n");
diff --git a/src/pref-manager.c b/src/pref-manager.c
index 0268a7b..1715bb8 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -1039,12 +1039,12 @@ apply_prefs(GtkDialog * pbox)
/* quoted text color */
for (i = 0; i < MAX_QUOTED_COLOR; i++) {
- gtk_color_button_get_rgba(GTK_COLOR_BUTTON(pui->quoted_color[i]),
+ gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(pui->quoted_color[i]),
&balsa_app.quoted_color[i]);
}
/* url color */
- gtk_color_button_get_rgba(GTK_COLOR_BUTTON(pui->url_color),
+ gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(pui->url_color),
&balsa_app.url_color);
/* sorting and threading */
@@ -1278,9 +1278,9 @@ set_prefs(void)
/* Colour */
for (i = 0; i < MAX_QUOTED_COLOR; i++)
- gtk_color_button_set_rgba(GTK_COLOR_BUTTON(pui->quoted_color[i]),
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pui->quoted_color[i]),
&balsa_app.quoted_color[i]);
- gtk_color_button_set_rgba(GTK_COLOR_BUTTON(pui->url_color),
+ gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(pui->url_color),
&balsa_app.url_color);
/* Information Message */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]