[balsa/gtk3] Remove dependence on GtkViewPort
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Remove dependence on GtkViewPort
- Date: Fri, 12 Apr 2013 02:12:01 +0000 (UTC)
commit 15e224edbf6b68058f3fbd9b40873e3b716e5050
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Thu Apr 11 22:09:06 2013 -0400
Remove dependence on GtkViewPort
* src/balsa-message.c (bm_on_set_style),
(bm_find_scroll_to_rectangle), (balsa_message_init),
(select_part): remove dependence on GtkViewPort.
* src/balsa-message.h: ditto.
* src/balsa-mime-widget-callbacks.c
(balsa_mime_widget_key_press_event): ditto.
* src/balsa-mime-widget-image.c (balsa_mime_widget_new_image):
ditto.
ChangeLog | 11 +++++++++++
src/balsa-message.c | 19 +++++++++++--------
src/balsa-message.h | 1 -
src/balsa-mime-widget-callbacks.c | 3 ++-
src/balsa-mime-widget-image.c | 2 +-
5 files changed, 25 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 593c23c..758332f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2013-04-11 Peter Bloomfield
+ * src/balsa-message.c (bm_on_set_style),
+ (bm_find_scroll_to_rectangle), (balsa_message_init),
+ (select_part): remove dependence on GtkViewPort.
+ * src/balsa-message.h: ditto.
+ * src/balsa-mime-widget-callbacks.c
+ (balsa_mime_widget_key_press_event): ditto.
+ * src/balsa-mime-widget-image.c (balsa_mime_widget_new_image):
+ ditto.
+
+2013-04-11 Peter Bloomfield
+
* src/toolbar-prefs.c (create_toolbar_page):
gtk_scrolled_window_add_with_viewport is deprecated.
diff --git a/src/balsa-message.c b/src/balsa-message.c
index 0392487..2035de4 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -344,7 +344,7 @@ bm_on_set_style(GtkWidget * widget,
context = gtk_widget_get_style_context(bm->treeview);
gtk_style_context_get_background_color(context, GTK_STATE_FLAG_NORMAL,
&rgba);
- gtk_widget_override_background_color(bm->cont_viewport,
+ gtk_widget_override_background_color(bm->scroll,
GTK_STATE_FLAG_NORMAL, &rgba);
}
@@ -411,8 +411,8 @@ bm_find_scroll_to_rectangle(BalsaMessage * bm,
rectangle->x, rectangle->y,
&x, &y);
- g_object_get(G_OBJECT(bm->cont_viewport), "hadjustment", &hadj,
- "vadjustment", &vadj, NULL);
+ g_object_get(G_OBJECT(bm->scroll), "hadjustment", &hadj,
+ "vadjustment", &vadj, NULL);
gtk_adjustment_clamp_page(hadj, x, x + rectangle->width);
gtk_adjustment_clamp_page(vadj, y, y + rectangle->height);
}
@@ -723,11 +723,9 @@ balsa_message_init(BalsaMessage * bm)
g_signal_connect(scroll, "key_press_event",
G_CALLBACK(balsa_mime_widget_key_press_event), bm);
gtk_box_pack_start(GTK_BOX(vbox), scroll, TRUE, TRUE, 0);
- bm->cont_viewport = gtk_viewport_new(NULL, NULL);
- gtk_container_add(GTK_CONTAINER(scroll), bm->cont_viewport);
g_signal_connect_after(bm, "style-updated",
G_CALLBACK(bm_on_set_style), bm);
- g_signal_connect(bm->cont_viewport, "size-allocate",
+ g_signal_connect(bm->scroll, "size-allocate",
G_CALLBACK(on_content_size_alloc), NULL);
/* Widget to hold headers */
@@ -740,7 +738,12 @@ balsa_message_init(BalsaMessage * bm)
g_signal_connect(G_OBJECT(bm->bm_widget->widget), "focus_out_event",
G_CALLBACK(balsa_mime_widget_unlimit_focus),
(gpointer) bm);
- gtk_container_add(GTK_CONTAINER(bm->cont_viewport), bm->bm_widget->widget);
+#if GTK_CHECK_VERSION(3, 8, 0)
+ gtk_container_add(GTK_CONTAINER(bm->scroll), bm->bm_widget->widget);
+#else /* GTK_CHECK_VERSION(3, 8, 0 */
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(bm->scroll),
+ bm->bm_widget->widget);
+#endif /* GTK_CHECK_VERSION(3, 8, 0 */
/* structure view */
model = gtk_tree_store_new (NUM_COLUMNS,
@@ -2283,7 +2286,7 @@ select_part(BalsaMessage * bm, BalsaPartInfo *info)
g_signal_emit(G_OBJECT(bm), balsa_message_signals[SELECT_PART], 0);
- g_object_get(G_OBJECT(bm->cont_viewport), "hadjustment", &hadj,
+ g_object_get(G_OBJECT(bm->scroll), "hadjustment", &hadj,
"vadjustment", &vadj, NULL);
gtk_adjustment_set_value(hadj, 0);
gtk_adjustment_set_value(vadj, 0);
diff --git a/src/balsa-message.h b/src/balsa-message.h
index 8d530c2..61fa882 100644
--- a/src/balsa-message.h
+++ b/src/balsa-message.h
@@ -63,7 +63,6 @@ struct _BalsaMessage {
ShownHeaders shown_headers;
/* Widgets to hold content */
- GtkWidget *cont_viewport;
GtkWidget *scroll;
/* Widget to hold structure tree */
diff --git a/src/balsa-mime-widget-callbacks.c b/src/balsa-mime-widget-callbacks.c
index ef14f64..d0896b1 100644
--- a/src/balsa-mime-widget-callbacks.c
+++ b/src/balsa-mime-widget-callbacks.c
@@ -201,7 +201,8 @@ balsa_mime_widget_key_press_event(GtkWidget * widget, GdkEventKey * event,
GtkAdjustment *adj;
int page_adjust;
- g_object_get(G_OBJECT(bm->cont_viewport), "vadjustment", &adj, NULL);
+ adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW
+ (bm->scroll));
page_adjust = balsa_app.pgdownmod ?
(gtk_adjustment_get_page_size(adj) * balsa_app.pgdown_percent) /
diff --git a/src/balsa-mime-widget-image.c b/src/balsa-mime-widget-image.c
index 9a37142..3c9d542 100644
--- a/src/balsa-mime-widget-image.c
+++ b/src/balsa-mime-widget-image.c
@@ -125,7 +125,7 @@ balsa_mime_widget_new_image(BalsaMessage * bm,
G_CALLBACK(balsa_image_button_press_cb), data);
mwi->context =
- gtk_widget_get_style_context(GTK_WIDGET(bm->cont_viewport));
+ gtk_widget_get_style_context(GTK_WIDGET(bm->scroll));
bmwi_context_changed_cb(mwi->context, mw);
mwi->context_changed_handler_id =
g_signal_connect(mwi->context, "changed",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]