[balsa/wip/gtk4] Fix some fallout
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/wip/gtk4] Fix some fallout
- Date: Sun, 2 Jun 2019 15:16:31 +0000 (UTC)
commit 0d3bd03f6fdfeb31936157d413ea6b75e05ef723
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Jun 2 11:15:53 2019 -0400
Fix some fallout
from the API/ABI breaks.
src/balsa-index.c | 35 +++++++++++++++++------------------
src/main-window.c | 6 +++---
2 files changed, 20 insertions(+), 21 deletions(-)
---
diff --git a/src/balsa-index.c b/src/balsa-index.c
index 865418f3a..a91d9ee1a 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -61,7 +61,7 @@
/* gtk widget */
static void bndx_destroy(GObject *obj);
-static gboolean bndx_popup_menu(GtkWidget *widget);
+static gboolean bndx_popup_menu(GtkWidget *widget, gpointer user_data);
/* statics */
@@ -259,9 +259,10 @@ bndx_destroy(GObject *obj)
/* Widget class popup menu method. */
static gboolean
-bndx_popup_menu(GtkWidget *widget)
+bndx_popup_menu(GtkWidget *widget, gpointer user_data)
{
- bndx_do_popup(BALSA_INDEX(widget), NULL);
+ BalsaIndex *bindex = user_data;
+ bndx_do_popup(bindex, NULL);
return TRUE;
}
@@ -449,7 +450,7 @@ balsa_index_init(BalsaIndex *bindex)
gesture = gtk_gesture_click_new();
gtk_gesture_single_set_button(GTK_GESTURE_SINGLE(gesture), 0);
g_signal_connect(gesture, "pressed",
- G_CALLBACK(bndx_gesture_pressed_cb), NULL);
+ G_CALLBACK(bndx_gesture_pressed_cb), bindex);
/* We need to claim the event sequence before GtkTreeView gets it,
* so we jump in at the capture phase: */
controller = GTK_EVENT_CONTROLLER(gesture);
@@ -462,12 +463,12 @@ balsa_index_init(BalsaIndex *bindex)
/* catch thread expand events */
bindex->row_expanded_id =
g_signal_connect_after(tree_view, "row-expanded",
- G_CALLBACK(bndx_tree_expand_cb), NULL);
+ G_CALLBACK(bndx_tree_expand_cb), bindex);
g_signal_connect(tree_view, "test-collapse-row",
- G_CALLBACK(bndx_test_collapse_row_cb), NULL);
+ G_CALLBACK(bndx_test_collapse_row_cb), bindex);
bindex->row_collapsed_id =
g_signal_connect_after(tree_view, "row-collapsed",
- G_CALLBACK(bndx_tree_collapse_cb), NULL);
+ G_CALLBACK(bndx_tree_collapse_cb), bindex);
/* We want to catch column resize attempts to store the new value */
g_signal_connect_after(tree_view, "size-allocate",
@@ -483,10 +484,10 @@ balsa_index_init(BalsaIndex *bindex)
gdk_content_formats_unref(formats);
g_signal_connect(tree_view, "drag-data-get",
- G_CALLBACK(bndx_drag_cb), NULL);
+ G_CALLBACK(bndx_drag_cb), bindex);
g_signal_connect(tree_view, "popup-menu",
- G_CALLBACK(bndx_popup_menu), NULL);
+ G_CALLBACK(bndx_popup_menu), bindex);
balsa_index_set_column_widths(bindex);
gtk_widget_show(widget);
@@ -654,10 +655,10 @@ bndx_gesture_pressed_cb(GtkGestureClick *click,
gdouble y,
gpointer user_data)
{
+ BalsaIndex *bindex = user_data;
GtkGesture *gesture;
GdkEventSequence *sequence;
const GdkEvent *event;
- BalsaIndex *bindex;
GtkTreeView *tree_view;
gint bx;
gint by;
@@ -672,7 +673,6 @@ bndx_gesture_pressed_cb(GtkGestureClick *click,
gtk_gesture_set_sequence_state(gesture, sequence, GTK_EVENT_SEQUENCE_CLAIMED);
- bindex = BALSA_INDEX(gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture)));
tree_view = bindex->tree_view;
gtk_tree_view_convert_widget_to_bin_window_coords(tree_view, (gint) x, (gint) y,
&bx, &by);
@@ -762,7 +762,7 @@ bndx_tree_expand_cb(GtkTreeView *tree_view,
GtkTreePath *path,
gpointer user_data)
{
- BalsaIndex *bindex = BALSA_INDEX(tree_view);
+ BalsaIndex *bindex = user_data;
GtkTreeSelection *selection = gtk_tree_view_get_selection(tree_view);
GtkTreePath *current_path;
@@ -791,7 +791,7 @@ bndx_test_collapse_row_cb(GtkTreeView *tree_view,
GtkTreePath *path,
gpointer user_data)
{
- BalsaIndex *bindex = BALSA_INDEX(tree_view);
+ BalsaIndex *bindex = user_data;
bindex->collapsing = TRUE;
return FALSE;
}
@@ -807,7 +807,7 @@ bndx_tree_collapse_cb(GtkTreeView *tree_view,
GtkTreePath *path,
gpointer user_data)
{
- BalsaIndex *bindex = BALSA_INDEX(tree_view);
+ BalsaIndex *bindex = user_data;
bindex->collapsing = FALSE;
bndx_changed_find_row(bindex);
}
@@ -858,12 +858,10 @@ bndx_drag_cb(GtkWidget *widget,
GtkSelectionData *data,
gpointer user_data)
{
- BalsaIndex *bindex;
+ BalsaIndex *bindex = user_data;
g_return_if_fail(widget != NULL);
- bindex = BALSA_INDEX(widget);
-
if (gtk_tree_selection_count_selected_rows
(gtk_tree_view_get_selection(bindex->tree_view)) > 0) {
gtk_selection_data_set(data, gtk_selection_data_get_target(data),
@@ -2153,9 +2151,10 @@ bndx_do_popup(BalsaIndex *bindex,
submenu =
balsa_mblist_mru_menu(GTK_WINDOW
- (gtk_widget_get_root(GTK_WIDGET(bindex))),
+ (gtk_widget_get_root(GTK_WIDGET(bindex->tree_view))),
&balsa_app.folder_mru,
G_CALLBACK(mru_menu_cb), bindex);
+ gtk_widget_set_hexpand(GTK_WIDGET(submenu), TRUE); /* Didn't help, but doesn't hurt! */
gtk_menu_item_set_submenu(GTK_MENU_ITEM(bindex->move_to_item),
submenu);
diff --git a/src/main-window.c b/src/main-window.c
index 92d7f7a62..9f963f5f0 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -4216,7 +4216,7 @@ bw_notebook_switch_page_cb(GtkWidget * notebook,
BalsaWindow *window = BALSA_WINDOW(data);
BalsaWindowPrivate *priv = balsa_window_get_instance_private(window);
GtkWidget *page;
- GtkTreeView *tree_view;
+ GtkWidget *child;
BalsaIndex *bindex;
LibBalsaMailbox *mailbox;
gchar *title;
@@ -4235,8 +4235,8 @@ bw_notebook_switch_page_cb(GtkWidget * notebook,
return;
page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_num);
- tree_view = GTK_TREE_VIEW(gtk_bin_get_child(GTK_BIN(page)));
- bindex = balsa_index_get_from_tree_view(tree_view);
+ child = gtk_bin_get_child(GTK_BIN(page));
+ bindex = balsa_index_get_from_tree_view(GTK_TREE_VIEW(child));
priv->current_index = bindex;
g_object_add_weak_pointer(G_OBJECT(bindex),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]