diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-09-29 21:27:03 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-09-29 21:27:03 (GMT) |
commit | 3a83a06db8ee27eafcd0219d1d26bf2af23737f5 (patch) | |
tree | 163ea7fbe1435b9f380e7ae96dfc36d8f16d1d0a /src/gui/panels | |
parent | 55bc8570f25a479b222733c4093f9ae996c9f68e (diff) |
Cleaned the DB code a little bit.
Diffstat (limited to 'src/gui/panels')
-rw-r--r-- | src/gui/panels/bookmarks.c | 5 | ||||
-rw-r--r-- | src/gui/panels/history.c | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c index ebe1f62..b55e24c 100644 --- a/src/gui/panels/bookmarks.c +++ b/src/gui/panels/bookmarks.c @@ -545,7 +545,8 @@ static void on_collection_content_changed(GDbCollection *collec, DBAction action store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); - if (action == DBA_ADD_ITEM || (action == DBA_CHANGE_STATE && g_db_item_is_enabled(G_DB_ITEM(bookmark)))) + if (action == DBA_ADD_ITEM \ + || (action == DBA_CHANGE_STATE && !g_db_item_has_flag(G_DB_ITEM(bookmark), DIF_DISABLED))) { proc = g_loaded_binary_get_processor(panel->binary); msize = g_arch_processor_get_memory_size(proc); @@ -570,7 +571,7 @@ static void on_collection_content_changed(GDbCollection *collec, DBAction action } - else /*if (action == DBA_CHANGE_STATE && g_db_item_is_enabled(G_DB_ITEM(bookmark)))*/ + else { model = GTK_TREE_MODEL(store); diff --git a/src/gui/panels/history.c b/src/gui/panels/history.c index df3fde1..bb71cf2 100644 --- a/src/gui/panels/history.c +++ b/src/gui/panels/history.c @@ -442,7 +442,7 @@ static void on_history_changed(GDbCollection *collec, DBAction action, GDbItem * gtk_list_store_set(store, &iter, HTC_ITEM, item, //HTC_PICTURE, G_BOOKMARKS_PANEL_GET_CLASS(panel)->bookmark_img, - HTC_FOREGROUND, g_db_item_is_enabled(item) ? NULL : "grey", + HTC_FOREGROUND, g_db_item_has_flag(item, DIF_DISABLED) ? "grey" : NULL, HTC_LABEL, label, -1); @@ -461,7 +461,7 @@ static void on_history_changed(GDbCollection *collec, DBAction action, GDbItem * if (find_changed_item(model, item, &iter)) gtk_list_store_set(store, &iter, - HTC_FOREGROUND, g_db_item_is_enabled(item) ? NULL : "grey", + HTC_FOREGROUND, g_db_item_has_flag(item, DIF_DISABLED) ? "grey" : NULL, -1); break; @@ -482,7 +482,7 @@ static void on_history_changed(GDbCollection *collec, DBAction action, GDbItem * gtk_tree_model_get(_model, _iter, HTC_ITEM, &item, -1); - active = g_db_item_is_enabled(item); + active = !g_db_item_has_flag(item, DIF_DISABLED); g_object_unref(G_OBJECT(item)); @@ -530,7 +530,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_cmp(item_a, item_b, true); + result = g_db_item_cmp(item_a, item_b); g_object_unref(G_OBJECT(item_a)); g_object_unref(G_OBJECT(item_b)); @@ -568,10 +568,10 @@ static void on_history_selection_change(GtkTreeSelection *selection, GHistoryPan gtk_tree_model_get(model, &iter, HTC_ITEM, &item, -1); button = GTK_WIDGET(gtk_builder_get_object(builder, "undo")); - gtk_widget_set_sensitive(button, g_db_item_is_enabled(item)); + gtk_widget_set_sensitive(button, !g_db_item_has_flag(item, DIF_DISABLED)); button = GTK_WIDGET(gtk_builder_get_object(builder, "redo")); - gtk_widget_set_sensitive(button, !g_db_item_is_enabled(item)); + gtk_widget_set_sensitive(button, g_db_item_has_flag(item, DIF_DISABLED)); g_object_unref(G_OBJECT(item)); |