2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "claws-features.h"
28 #include <glib/gi18n.h>
30 #include <gdk/gdkkeysyms.h>
36 #include "prefs_gtk.h"
37 #include "prefs_summary_open.h"
38 #include "prefs_common.h"
39 #include "manage_window.h"
40 #include "alertpanel.h"
41 #include "displayheader.h"
46 PREFS_SUMMARY_OPEN_HEADER
,
47 PREFS_SUMMARY_OPEN_DATA
,
48 N_PREFS_SUMMARY_OPEN_COLUMNS
51 static struct SummaryOpen
{
55 GtkWidget
*cancel_btn
;
57 GtkWidget
*possible_actions_list_view
;
58 GtkWidget
*actions_list_view
;
61 /* widget creating functions */
62 static void prefs_summary_open_create (void);
64 static void prefs_summary_open_set_dialog (void);
65 static void prefs_summary_open_set_list (void);
67 /* callback functions */
68 static void prefs_summary_open_register_cb (GtkButton
*btn
,
69 gpointer hidden_data
);
70 static void prefs_summary_open_delete_cb (GtkButton
*btn
,
71 gpointer list_view_data
);
72 static void prefs_summary_open_up (void);
73 static void prefs_summary_open_down (void);
75 static gboolean
prefs_summary_open_key_pressed (GtkWidget
*widget
,
78 static void prefs_summary_open_ok (void);
79 static void prefs_summary_open_cancel (void);
80 static gint
prefs_summary_open_deleted (GtkWidget
*widget
,
85 static GtkListStore
*prefs_summary_open_create_store (void);
86 static void prefs_summary_open_insert_action (GtkListStore
*store
,
89 static GtkWidget
*prefs_summary_open_list_view_create (const gchar
*name
);
90 static void prefs_summary_open_create_list_view_columns (GtkWidget
*list_view
,
92 static void actions_list_model_row_changed (GtkTreeModel
*model
,
95 GtkTreeView
*list_view
);
97 static void drag_begin (GtkTreeView
*list_view
,
98 GdkDragContext
*context
,
101 static void drag_end (GtkTreeView
*list_view
,
102 GdkDragContext
*context
,
105 static EntryAction saved_summary_select_prio
[SUMMARY_OPEN_ACTIONS
-1];
107 static gchar
*action_name
[SUMMARY_OPEN_ACTIONS
] =
109 N_("oldest marked email"),
110 N_("oldest new email"),
111 N_("oldest unread email"),
112 N_("last opened email"),
113 N_("newest email in the list"),
115 N_("oldest email in the list"),
116 N_("newest marked email"),
117 N_("newest new email"),
118 N_("newest unread email")
121 void prefs_summary_open_open(void)
124 if (!summaryopen
.window
) {
125 prefs_summary_open_create();
128 manage_window_set_transient(GTK_WINDOW(summaryopen
.window
));
129 gtk_widget_grab_focus(summaryopen
.ok_btn
);
131 prefs_summary_open_set_dialog();
133 for (i
= 0; i
< SUMMARY_OPEN_ACTIONS
-1; i
++)
134 saved_summary_select_prio
[i
] = prefs_common
.summary_select_prio
[i
];
136 gtk_widget_show(summaryopen
.window
);
137 gtk_window_set_modal(GTK_WINDOW(summaryopen
.window
), TRUE
);
140 static void prefs_summary_open_create(void)
146 GtkWidget
*cancel_btn
;
147 GtkWidget
*confirm_area
;
159 GtkWidget
*list_view_hbox
;
160 GtkWidget
*list_view_hbox1
;
161 GtkWidget
*list_view_hbox2
;
162 GtkWidget
*list_view_scrolledwin
;
163 GtkWidget
*possible_actions_list_view
;
164 GtkWidget
*actions_list_view
;
166 window
= gtkut_window_new(GTK_WINDOW_TOPLEVEL
, "prefs_summary_open");
167 gtk_container_set_border_width (GTK_CONTAINER (window
), 8);
168 gtk_window_set_position (GTK_WINDOW (window
), GTK_WIN_POS_CENTER
);
169 gtk_window_set_resizable(GTK_WINDOW (window
), TRUE
);
170 gtk_window_set_type_hint(GTK_WINDOW(window
), GDK_WINDOW_TYPE_HINT_DIALOG
);
171 gtk_widget_set_size_request (GTK_WIDGET (window
), 610, 310);
173 vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, 6);
174 gtk_widget_show (vbox
);
175 gtk_container_add (GTK_CONTAINER (window
), vbox
);
177 btn_hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
178 gtk_widget_show (btn_hbox
);
179 gtk_box_pack_end (GTK_BOX (vbox
), btn_hbox
, FALSE
, FALSE
, 0);
181 gtkut_stock_button_set_create(&confirm_area
, &cancel_btn
, NULL
, _("_Cancel"),
182 &ok_btn
, NULL
, _("_OK"), NULL
, NULL
, NULL
);
183 gtk_widget_show (confirm_area
);
184 gtk_box_pack_end (GTK_BOX(btn_hbox
), confirm_area
, FALSE
, FALSE
, 0);
185 gtk_widget_grab_default (ok_btn
);
187 gtk_window_set_title (GTK_WINDOW(window
),
188 _("Message selection when entering a folder"));
189 MANAGE_WINDOW_SIGNALS_CONNECT(window
);
190 g_signal_connect (G_OBJECT(window
), "delete_event",
191 G_CALLBACK(prefs_summary_open_deleted
),
193 g_signal_connect (G_OBJECT(window
), "key_press_event",
194 G_CALLBACK(prefs_summary_open_key_pressed
),
196 g_signal_connect (G_OBJECT(ok_btn
), "clicked",
197 G_CALLBACK(prefs_summary_open_ok
),
199 g_signal_connect (G_OBJECT(cancel_btn
), "clicked",
200 G_CALLBACK(prefs_summary_open_cancel
),
203 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
204 gtk_widget_show (vbox1
);
205 gtk_box_pack_start (GTK_BOX (vbox
), vbox1
, TRUE
, TRUE
, 0);
206 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), 2);
208 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
209 gtk_widget_show (hbox1
);
210 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, TRUE
, 0);
212 /* display headers list */
214 list_view_hbox
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 10);
215 gtk_widget_show (list_view_hbox
);
216 gtk_box_pack_start (GTK_BOX (vbox1
), list_view_hbox
, TRUE
, TRUE
, 0);
218 list_view_hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
219 gtk_widget_show (list_view_hbox1
);
220 gtk_box_pack_start (GTK_BOX (list_view_hbox
), list_view_hbox1
, TRUE
, TRUE
, 0);
222 list_view_scrolledwin
= gtk_scrolled_window_new (NULL
, NULL
);
223 gtk_widget_show (list_view_scrolledwin
);
224 gtk_box_pack_start (GTK_BOX (list_view_hbox1
), list_view_scrolledwin
,
226 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin
),
227 GTK_POLICY_AUTOMATIC
,
228 GTK_POLICY_AUTOMATIC
);
229 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin
),
232 possible_actions_list_view
= prefs_summary_open_list_view_create
233 (_("Available selections"));
234 gtk_widget_show (possible_actions_list_view
);
235 gtk_container_add(GTK_CONTAINER(list_view_scrolledwin
), possible_actions_list_view
);
237 btn_vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, 8);
238 gtk_widget_show (btn_vbox
);
239 gtk_box_pack_start (GTK_BOX (list_view_hbox1
), btn_vbox
, FALSE
, FALSE
, 0);
241 reg_btn
= gtkut_stock_button("list-add", _("_Add"));
242 gtk_widget_show (reg_btn
);
243 gtk_box_pack_start (GTK_BOX (btn_vbox
), reg_btn
, FALSE
, TRUE
, 0);
244 g_signal_connect (G_OBJECT (reg_btn
), "clicked",
245 G_CALLBACK (prefs_summary_open_register_cb
),
246 possible_actions_list_view
);
247 del_btn
= gtkut_stock_button("list-remove", _("_Remove"));
248 gtk_widget_show (del_btn
);
249 gtk_box_pack_start (GTK_BOX (btn_vbox
), del_btn
, FALSE
, TRUE
, 0);
253 list_view_hbox2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
254 gtk_widget_show (list_view_hbox2
);
255 gtk_box_pack_start (GTK_BOX (list_view_hbox
), list_view_hbox2
, TRUE
, TRUE
, 0);
257 list_view_scrolledwin
= gtk_scrolled_window_new (NULL
, NULL
);
258 gtk_widget_show (list_view_scrolledwin
);
259 gtk_box_pack_start (GTK_BOX (list_view_hbox2
), list_view_scrolledwin
,
261 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (list_view_scrolledwin
),
262 GTK_POLICY_AUTOMATIC
,
263 GTK_POLICY_AUTOMATIC
);
264 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(list_view_scrolledwin
),
267 actions_list_view
= prefs_summary_open_list_view_create
268 (_("Current selections"));
269 g_signal_connect (G_OBJECT (del_btn
), "clicked",
270 G_CALLBACK (prefs_summary_open_delete_cb
),
272 gtk_widget_show (actions_list_view
);
273 gtk_container_add (GTK_CONTAINER (list_view_scrolledwin
),
276 gtk_tree_view_set_reorderable(GTK_TREE_VIEW(actions_list_view
), TRUE
);
277 g_signal_connect(G_OBJECT(actions_list_view
), "drag_begin",
278 G_CALLBACK(drag_begin
),
281 g_signal_connect(G_OBJECT(actions_list_view
), "drag_end",
282 G_CALLBACK(drag_end
),
285 btn_vbox
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, 8);
286 gtk_widget_show (btn_vbox
);
287 gtk_box_pack_start (GTK_BOX (list_view_hbox2
), btn_vbox
, FALSE
, FALSE
, 0);
289 up_btn
= gtkut_stock_button("go-up", _("_Up"));
290 gtk_widget_show (up_btn
);
291 gtk_box_pack_start (GTK_BOX (btn_vbox
), up_btn
, FALSE
, FALSE
, 0);
292 g_signal_connect (G_OBJECT (up_btn
), "clicked",
293 G_CALLBACK (prefs_summary_open_up
), NULL
);
295 down_btn
= gtkut_stock_button("go-down", _("_Down"));
296 gtk_widget_show (down_btn
);
297 gtk_box_pack_start (GTK_BOX (btn_vbox
), down_btn
, FALSE
, FALSE
, 0);
298 g_signal_connect (G_OBJECT (down_btn
), "clicked",
299 G_CALLBACK (prefs_summary_open_down
), NULL
);
301 gtk_widget_show_all(window
);
303 summaryopen
.window
= window
;
304 summaryopen
.ok_btn
= ok_btn
;
305 summaryopen
.cancel_btn
= cancel_btn
;
307 summaryopen
.possible_actions_list_view
= possible_actions_list_view
;
308 summaryopen
.actions_list_view
= actions_list_view
;
311 /* do it SUMMARY_OPEN_ACTIONS-1 times */
312 #define SET_PRIO(p_one,p_two,p_three,p_four) { \
313 prefs_common.summary_select_prio[0] = p_one; \
314 prefs_common.summary_select_prio[1] = p_two; \
315 prefs_common.summary_select_prio[2] = p_three; \
316 prefs_common.summary_select_prio[3] = p_four; \
317 prefs_common.summary_select_prio[4] = ACTION_UNSET; \
318 prefs_common.summary_select_prio[5] = ACTION_UNSET; \
319 prefs_common.summary_select_prio[6] = ACTION_UNSET; \
320 prefs_common.summary_select_prio[7] = ACTION_UNSET; \
321 prefs_common.summary_select_prio[8] = ACTION_UNSET; \
322 prefs_common.summary_select_prio[9] = ACTION_UNSET; \
325 void prefs_summary_open_set_defaults(void)
327 switch (prefs_common
.select_on_entry
) {
328 case SELECTONENTRY_MNU
:
329 SET_PRIO(ACTION_OLDEST_MARKED
, ACTION_OLDEST_NEW
, ACTION_OLDEST_UNREAD
, ACTION_NEWEST_LIST
); break;
330 case SELECTONENTRY_MUN
:
331 SET_PRIO(ACTION_OLDEST_MARKED
, ACTION_OLDEST_UNREAD
, ACTION_OLDEST_NEW
, ACTION_NEWEST_LIST
); break;
332 case SELECTONENTRY_NMU
:
333 SET_PRIO(ACTION_OLDEST_NEW
, ACTION_OLDEST_MARKED
, ACTION_OLDEST_UNREAD
, ACTION_NEWEST_LIST
); break;
334 case SELECTONENTRY_NUM
:
335 SET_PRIO(ACTION_OLDEST_NEW
, ACTION_OLDEST_UNREAD
, ACTION_OLDEST_MARKED
, ACTION_NEWEST_LIST
); break;
336 case SELECTONENTRY_UNM
:
337 SET_PRIO(ACTION_OLDEST_UNREAD
, ACTION_OLDEST_NEW
, ACTION_OLDEST_MARKED
, ACTION_NEWEST_LIST
); break;
338 case SELECTONENTRY_UMN
:
339 SET_PRIO(ACTION_OLDEST_UNREAD
, ACTION_OLDEST_MARKED
, ACTION_OLDEST_NEW
, ACTION_NEWEST_LIST
); break;
340 case SELECTONENTRY_LAST
:
341 SET_PRIO(ACTION_LAST_OPENED
, ACTION_NEWEST_LIST
, ACTION_UNSET
, ACTION_UNSET
); break;
342 case SELECTONENTRY_NOTHING
:
343 SET_PRIO(ACTION_NEWEST_LIST
, ACTION_UNSET
, ACTION_UNSET
, ACTION_UNSET
); break;
348 static void prefs_summary_open_set_dialog(void)
350 GtkTreeView
*possible_list_view
= GTK_TREE_VIEW(summaryopen
.possible_actions_list_view
);
351 GtkTreeView
*actions_list_view
= GTK_TREE_VIEW(summaryopen
.actions_list_view
);
352 GtkTreeModel
*model_poss
, *model_act
;
354 gboolean set
= FALSE
;
355 gboolean used
[SUMMARY_OPEN_ACTIONS
-1] = {FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
, FALSE
};
357 model_poss
= gtk_tree_view_get_model(possible_list_view
);
358 model_act
= gtk_tree_view_get_model(actions_list_view
);
360 gtk_list_store_clear(GTK_LIST_STORE(model_poss
));
361 gtk_list_store_clear(GTK_LIST_STORE(model_act
));
364 for (i
= 0; i
< SUMMARY_OPEN_ACTIONS
-1; i
++) {
365 EntryAction act
= prefs_common
.summary_select_prio
[i
];
367 if (act
== ACTION_UNSET
)
372 prefs_summary_open_insert_action(GTK_LIST_STORE
373 (model_act
), action_name
[act
], act
);
376 /* backward compat */
377 prefs_summary_open_set_defaults();
381 for (i
= 1; i
< SUMMARY_OPEN_ACTIONS
; i
++) {
383 prefs_summary_open_insert_action(GTK_LIST_STORE
384 (model_poss
), action_name
[i
], i
);
389 static void prefs_summary_open_set_list(void)
396 model
= gtk_tree_view_get_model(GTK_TREE_VIEW(summaryopen
.actions_list_view
));
397 while (gtk_tree_model_iter_nth_child(model
, &iter
, NULL
, row
)) {
398 gtk_tree_model_get(model
, &iter
, PREFS_SUMMARY_OPEN_DATA
, &data
, -1);
399 prefs_common
.summary_select_prio
[row
] = GPOINTER_TO_INT(data
);
402 for (; row
< SUMMARY_OPEN_ACTIONS
-1; row
++) {
403 prefs_common
.summary_select_prio
[row
] = ACTION_UNSET
;
407 static void prefs_summary_open_delete_cb(GtkButton
*btn
, gpointer list_view_data
)
409 GtkTreeView
*list_view
= GTK_TREE_VIEW(list_view_data
);
411 GtkListStore
*store
= GTK_LIST_STORE(gtk_tree_view_get_model(list_view
));
412 GtkTreeSelection
*selection
= gtk_tree_view_get_selection(list_view
);
414 GtkTreeView
*possible_list_view
= GTK_TREE_VIEW(summaryopen
.possible_actions_list_view
);
415 GtkTreeModel
*model
, *model_poss
;
418 model
= gtk_tree_view_get_model(list_view
);
419 model_poss
= gtk_tree_view_get_model(possible_list_view
);
421 if (!gtk_tree_selection_get_selected(selection
, NULL
, &iter
))
424 gtk_tree_model_get(model
, &iter
, PREFS_SUMMARY_OPEN_DATA
, &data
, -1);
428 gtk_list_store_remove(store
, &iter
);
430 i
= GPOINTER_TO_INT(data
);
431 prefs_summary_open_insert_action(GTK_LIST_STORE
432 (model_poss
), action_name
[i
], i
);
434 prefs_summary_open_set_list();
437 static void prefs_summary_open_register_cb(GtkButton
*btn
, gpointer list_view_data
)
439 GtkTreeView
*possible_list_view
= GTK_TREE_VIEW(list_view_data
);
440 GtkTreeView
*list_view
= GTK_TREE_VIEW(summaryopen
.actions_list_view
);
442 GtkListStore
*store
= GTK_LIST_STORE(gtk_tree_view_get_model(possible_list_view
));
443 GtkTreeSelection
*selection
= gtk_tree_view_get_selection(possible_list_view
);
445 GtkTreeModel
*model
, *model_poss
;
448 model
= gtk_tree_view_get_model(list_view
);
449 model_poss
= gtk_tree_view_get_model(possible_list_view
);
451 if (!gtk_tree_selection_get_selected(selection
, NULL
, &iter
))
454 gtk_tree_model_get(model_poss
, &iter
, PREFS_SUMMARY_OPEN_DATA
, &data
, -1);
458 gtk_list_store_remove(store
, &iter
);
460 i
= GPOINTER_TO_INT(data
);
461 prefs_summary_open_insert_action(GTK_LIST_STORE
462 (model
), action_name
[i
], i
);
464 prefs_summary_open_set_list();
467 static void prefs_summary_open_up(void)
469 GtkTreePath
*prev
, *sel
, *try;
471 GtkListStore
*store
= NULL
;
472 GtkTreeModel
*model
= NULL
;
475 if (!gtk_tree_selection_get_selected
476 (gtk_tree_view_get_selection
477 (GTK_TREE_VIEW(summaryopen
.actions_list_view
)),
481 store
= (GtkListStore
*)model
;
482 sel
= gtk_tree_model_get_path(GTK_TREE_MODEL(store
), &isel
);
486 /* no move if we're at row 0... */
487 try = gtk_tree_path_copy(sel
);
488 if (!gtk_tree_path_prev(try)) {
489 gtk_tree_path_free(try);
490 gtk_tree_path_free(sel
);
495 gtk_tree_model_get_iter(GTK_TREE_MODEL(store
),
497 gtk_list_store_swap(store
, &iprev
, &isel
);
499 gtk_tree_path_free(sel
);
500 gtk_tree_path_free(prev
);
501 prefs_summary_open_set_list();
504 static void prefs_summary_open_down(void)
506 GtkListStore
*store
= NULL
;
507 GtkTreeModel
*model
= NULL
;
508 GtkTreeIter next
, sel
;
511 if (!gtk_tree_selection_get_selected
512 (gtk_tree_view_get_selection
513 (GTK_TREE_VIEW(summaryopen
.actions_list_view
)),
517 store
= (GtkListStore
*)model
;
518 try = gtk_tree_model_get_path(GTK_TREE_MODEL(store
), &sel
);
523 if (gtk_tree_model_iter_next(GTK_TREE_MODEL(store
), &next
))
524 gtk_list_store_swap(store
, &next
, &sel
);
526 gtk_tree_path_free(try);
527 prefs_summary_open_set_list();
530 static gboolean
prefs_summary_open_key_pressed(GtkWidget
*widget
,
534 if (event
&& event
->keyval
== GDK_KEY_Escape
)
535 prefs_summary_open_cancel();
539 static void prefs_summary_open_ok(void)
543 /* force an empty list to be at least ACTION_NONE */
544 if (prefs_common
.summary_select_prio
[0] == ACTION_UNSET
)
545 prefs_common
.summary_select_prio
[0] = ACTION_NOTHING
;
547 for (i
= 0; i
< SUMMARY_OPEN_ACTIONS
-1; i
++)
548 saved_summary_select_prio
[i
] = prefs_common
.summary_select_prio
[i
];
550 gtk_widget_hide(summaryopen
.window
);
551 gtk_window_set_modal(GTK_WINDOW(summaryopen
.window
), FALSE
);
554 static void prefs_summary_open_cancel(void)
557 for (i
= 0; i
< SUMMARY_OPEN_ACTIONS
-1; i
++)
558 prefs_common
.summary_select_prio
[i
] = saved_summary_select_prio
[i
];
560 gtk_widget_hide(summaryopen
.window
);
563 static gint
prefs_summary_open_deleted(GtkWidget
*widget
, GdkEventAny
*event
,
566 prefs_summary_open_cancel();
570 static GtkListStore
*prefs_summary_open_create_store(void)
572 return gtk_list_store_new(N_PREFS_SUMMARY_OPEN_COLUMNS
,
578 static void prefs_summary_open_insert_action(GtkListStore
*store
,
585 gtk_list_store_append(store
, &iter
);
586 gtk_list_store_set(store
, &iter
,
587 PREFS_SUMMARY_OPEN_HEADER
,
589 PREFS_SUMMARY_OPEN_DATA
, GINT_TO_POINTER(dp
),
593 static GtkWidget
*prefs_summary_open_list_view_create(const gchar
*name
)
595 GtkWidget
*list_view
;
596 GtkTreeSelection
*selector
;
599 model
= GTK_TREE_MODEL(prefs_summary_open_create_store());
600 list_view
= gtk_tree_view_new_with_model(model
);
601 g_object_unref(G_OBJECT(model
));
603 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(list_view
),
604 prefs_common
.use_stripes_everywhere
);
606 selector
= gtk_tree_view_get_selection(GTK_TREE_VIEW(list_view
));
607 gtk_tree_selection_set_mode(selector
, GTK_SELECTION_BROWSE
);
609 prefs_summary_open_create_list_view_columns(GTK_WIDGET(list_view
), name
);
614 static void prefs_summary_open_create_list_view_columns(GtkWidget
*list_view
,
617 GtkTreeViewColumn
*column
;
618 GtkCellRenderer
*renderer
;
620 renderer
= gtk_cell_renderer_text_new();
621 column
= gtk_tree_view_column_new_with_attributes
622 (name
, renderer
, "text", PREFS_SUMMARY_OPEN_HEADER
, NULL
);
623 gtk_tree_view_append_column(GTK_TREE_VIEW(list_view
), column
);
627 *\brief Called as a result of a drag & drop
629 static void actions_list_model_row_changed(GtkTreeModel
*model
,
632 GtkTreeView
*list_view
)
637 *\brief Called as a result of a gtk_list_store_swap()
639 static void drag_begin(GtkTreeView
*list_view
,
640 GdkDragContext
*context
,
643 /* XXX unfortunately a completed drag & drop does not emit
644 * a "rows_reordered" signal, but a "row_changed" signal.
645 * So during drag and drop, listen to "row_changed", and
646 * update the account list accordingly */
648 GtkTreeModel
*model
= gtk_tree_view_get_model(list_view
);
649 g_signal_connect(G_OBJECT(model
), "row_changed",
650 G_CALLBACK(actions_list_model_row_changed
),
654 static void drag_end(GtkTreeView
*list_view
,
655 GdkDragContext
*context
,
658 GtkTreeModel
*model
= gtk_tree_view_get_model(list_view
);
659 g_signal_handlers_disconnect_by_func(G_OBJECT(model
),
660 G_CALLBACK(actions_list_model_row_changed
),
662 prefs_summary_open_set_list();