diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-08-02 23:49:17 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-08-02 23:49:17 (GMT) |
commit | c3bfd743a8422e7c844ccf3247b142af548209b8 (patch) | |
tree | 7073f153d0f5a0589e0c44166b65649ec047040d /src/gui | |
parent | 9226736f0702db296433466462cfbad5a11bf46b (diff) |
Allowed to emit signals to GTK main thread for GUI updates in a generic way.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@563 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/panels/bookmarks.c | 5 | ||||
-rw-r--r-- | src/gui/panels/history.c | 19 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c index b3af70c..5b0649c 100644 --- a/src/gui/panels/bookmarks.c +++ b/src/gui/panels/bookmarks.c @@ -41,6 +41,8 @@ #include "../../common/cpp.h" #include "../../common/extstr.h" #include "../../core/params.h" +#include "../../glibext/chrysamarshal.h" +#include "../../glibext/signal.h" #include "../../gtkext/easygtk.h" #include "../../gtkext/support.h" @@ -503,7 +505,8 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary g_object_ref(G_OBJECT(binary)); collec = g_loaded_binary_find_collection(binary, DBF_BOOKMARKS); - g_signal_connect(collec, "content-changed", G_CALLBACK(on_collection_content_changed), panel); + g_signal_connect_to_main(collec, "content-changed", G_CALLBACK(on_collection_content_changed), panel, + g_cclosure_user_marshal_VOID__ENUM_OBJECT); } diff --git a/src/gui/panels/history.c b/src/gui/panels/history.c index 25ee39f..1e86880 100644 --- a/src/gui/panels/history.c +++ b/src/gui/panels/history.c @@ -33,6 +33,8 @@ #include "panel-int.h" #include "../../analysis/db/collection.h" +#include "../../glibext/chrysamarshal.h" +#include "../../glibext/signal.h" #include "../../gtkext/easygtk.h" @@ -205,7 +207,6 @@ static void g_history_panel_init(GHistoryPanel *panel) column = gtk_tree_view_column_new_with_attributes("", renderer, "surface", HTC_PICTURE, NULL); - gtk_tree_view_column_set_sort_column_id(column, GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); renderer = gtk_cell_renderer_text_new(); @@ -213,9 +214,11 @@ static void g_history_panel_init(GHistoryPanel *panel) "foreground", HTC_FOREGROUND, "text", HTC_LABEL, NULL); - gtk_tree_view_column_set_sort_column_id(column, GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(panel->store), + GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING); + /* Eléments de contrôle inférieurs */ box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); @@ -400,7 +403,8 @@ static void change_history_panel_current_binary(GHistoryPanel *panel, GLoadedBin } - g_signal_connect(collec, "content-changed", G_CALLBACK(on_history_changed), panel); + g_signal_connect_to_main(collec, "content-changed", G_CALLBACK(on_history_changed), panel, + g_cclosure_user_marshal_VOID__ENUM_OBJECT); } @@ -446,9 +450,6 @@ static void on_history_changed(GDbCollection *collec, DBAction action, GDbItem * gtk_tree_store_set(panel->store, &iter, HTC_FOREGROUND, g_db_item_is_active(item) ? NULL : "grey", -1); - gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(panel->store), - GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, - GTK_SORT_ASCENDING); break; } @@ -457,14 +458,10 @@ static void on_history_changed(GDbCollection *collec, DBAction action, GDbItem * } while (gtk_tree_model_iter_next(model, &iter)); - break; - } - - } @@ -492,7 +489,7 @@ static gint sort_history_lines(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter gtk_tree_model_get(model, a, HTC_ITEM, &item_a, -1); gtk_tree_model_get(model, b, HTC_ITEM, &item_b, -1); - result = g_db_item_compare_with_timestamp(item_a, item_b); + result = g_db_item_cmp(item_a, item_b, true); g_object_unref(G_OBJECT(item_a)); g_object_unref(G_OBJECT(item_b)); |