diff options
author | 2011-09-08 08:25:15 +0000 | |
---|---|---|
committer | 2011-09-08 08:25:15 +0000 | |
commit | 20e277802983fa9d16a5f406f27c8cc120200e46 (patch) | |
tree | e745cff05e79c1d3f391199fd1e4cc422c64a6d2 | |
parent | c5b0c941f310f2b90e9d23f5dc5d89f3167cd817 (diff) |
use glib message functions instead of g_printf(). make view state selector/notebook a persistent setting. add toggling of tracker/dir filters to view menu. I might add more from preferences another time.
-rw-r--r-- | src/dispatch.c | 4 | ||||
-rw-r--r-- | src/json.c | 4 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/trg-main-window.c | 35 | ||||
-rw-r--r-- | src/trg-menu-bar.c | 152 | ||||
-rw-r--r-- | src/trg-menu-bar.h | 3 | ||||
-rw-r--r-- | src/trg-preferences-dialog.c | 14 | ||||
-rw-r--r-- | src/trg-prefs.c | 20 | ||||
-rw-r--r-- | src/trg-prefs.h | 4 | ||||
-rw-r--r-- | src/trg-torrent-add-dialog.c | 2 |
10 files changed, 180 insertions, 60 deletions
diff --git a/src/dispatch.c b/src/dispatch.c index 5bf42c1..e6181a1 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -42,7 +42,7 @@ JsonObject *dispatch(TrgClient * client, JsonNode * req, int *status) json_node_free(req); #ifdef DEBUG if (g_getenv("TRG_SHOW_OUTGOING")) - g_printf("=>(outgoing)=> %s\n", serialized); + g_debug("=>(outgoing)=>\n%s\n", serialized); #endif response = trg_http_perform(client, serialized); g_free(serialized); @@ -103,7 +103,7 @@ gboolean dispatch_async(TrgClient * client, JsonNode * req, trg_client_thread_pool_push(client, args, &error); if (error) { - g_printf("thread creation error: %s\n", error->message); + g_error("thread creation error: %s\n", error->message); g_error_free(error); g_free(args); return FALSE; @@ -58,7 +58,7 @@ JsonObject *trg_deserialize(struct http_response * response, root = json_parser_get_root(parser); #ifdef DEBUG if (g_getenv("TRG_SHOW_INCOMING") != NULL) { - g_printf("incoming JSON data:\n%s\n", response->data); + g_debug("<=(incoming)<=:\n%s\n", response->data); } else if (g_getenv("TRG_SHOW_INCOMING_PRETTY") != NULL) { JsonGenerator *pg; gsize len; @@ -69,7 +69,7 @@ JsonObject *trg_deserialize(struct http_response * response, json_generator_set_root(pg, root); pgdata = json_generator_to_data(pg, &len); - g_printf("incoming JSON data:\n%s\n", pgdata); + g_debug("<=(incoming)<=:\n%s\n", pgdata); g_free(pgdata); g_object_unref(pg); @@ -149,8 +149,6 @@ int main(int argc, char *argv[]) } #endif - gtk_widget_show_all(GTK_WIDGET(window)); - auto_connect_if_required(window, client); gtk_main(); diff --git a/src/trg-main-window.c b/src/trg-main-window.c index ff1bace..d752347 100644 --- a/src/trg-main-window.c +++ b/src/trg-main-window.c @@ -480,6 +480,17 @@ static void open_remote_prefs_cb(GtkWidget * w G_GNUC_UNUSED, gpointer data) { gtk_widget_show_all(GTK_WIDGET(dlg)); } +static void main_window_toggle_filter_dirs(GtkCheckMenuItem * w, gpointer win) { + TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win); + trg_state_selector_set_show_dirs(priv->stateSelector, gtk_check_menu_item_get_active(w)); +} + +static void main_window_toggle_filter_trackers(GtkCheckMenuItem * w, gpointer win) { + TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win); + trg_state_selector_set_show_trackers(priv->stateSelector, + gtk_check_menu_item_get_active(w)); +} + static TrgToolbar *trg_main_window_toolbar_new(TrgMainWindow * win) { GObject *b_connect, *b_disconnect, *b_add, *b_resume, *b_pause; GObject *b_remove, *b_delete, *b_props, *b_local_prefs, *b_remote_prefs; @@ -503,8 +514,6 @@ static TrgToolbar *trg_main_window_toolbar_new(TrgMainWindow * win) { g_signal_connect(b_props, "clicked", G_CALLBACK(open_props_cb), win); g_signal_connect(b_local_prefs, "clicked", G_CALLBACK(open_local_prefs_cb), win); - g_signal_connect(b_remote_prefs, "clicked", - G_CALLBACK(open_remote_prefs_cb), win); return toolBar; } @@ -1125,14 +1134,16 @@ static void quit_cb(GtkWidget * w G_GNUC_UNUSED, gpointer data) { } static TrgMenuBar *trg_main_window_menu_bar_new(TrgMainWindow * win) { + TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win); + GObject *b_connect, *b_disconnect, *b_add, *b_resume, *b_pause, *b_verify, *b_remove, *b_delete, *b_props, *b_local_prefs, *b_remote_prefs, *b_about, *b_view_states, *b_view_notebook, *b_view_stats, *b_add_url, *b_quit, *b_move, *b_reannounce, *b_pause_all, - *b_resume_all; + *b_resume_all, *b_dir_filters, *b_tracker_filters; TrgMenuBar *menuBar; - menuBar = trg_menu_bar_new(win); + menuBar = trg_menu_bar_new(trg_client_get_prefs(priv->client)); g_object_get(menuBar, "connect-button", &b_connect, "disconnect-button", &b_disconnect, "add-button", &b_add, "add-url-button", &b_add_url, "resume-button", &b_resume, "resume-all-button", &b_resume_all, @@ -1144,6 +1155,7 @@ static TrgMenuBar *trg_main_window_menu_bar_new(TrgMainWindow * win) { &b_local_prefs, "view-notebook-button", &b_view_notebook, "view-states-button", &b_view_states, "view-stats-button", &b_view_stats, "about-button", &b_about, "quit-button", &b_quit, + "dir-filters", &b_dir_filters, "tracker-filters", &b_tracker_filters, NULL); g_signal_connect(b_connect, "activate", G_CALLBACK(connect_cb), win); @@ -1171,7 +1183,13 @@ static TrgMenuBar *trg_main_window_menu_bar_new(TrgMainWindow * win) { g_signal_connect(b_view_notebook, "toggled", G_CALLBACK(view_notebook_toggled_cb), win); g_signal_connect(b_view_states, "toggled", + G_CALLBACK(view_notebook_toggled_cb), win); + g_signal_connect(b_view_states, "toggled", G_CALLBACK(view_states_toggled_cb), win); + g_signal_connect(b_dir_filters, "toggled", + G_CALLBACK(main_window_toggle_filter_dirs), win); + g_signal_connect(b_tracker_filters, "toggled", + G_CALLBACK(main_window_toggle_filter_trackers), win); g_signal_connect(b_view_stats, "activate", G_CALLBACK(view_stats_toggled_cb), win); g_signal_connect(b_props, "activate", G_CALLBACK(open_props_cb), win); @@ -1708,8 +1726,6 @@ static GObject *trg_main_window_constructor(GType type, g_signal_connect(priv->client, "session-updated", G_CALLBACK(trg_client_session_updated_cb), priv->statusBar); - /*g_signal_connect(priv->statusBar, "text-pushed", - G_CALLBACK(status_bar_text_pushed), self);*/ gtk_box_pack_start(GTK_BOX(outerVbox), GTK_WIDGET(priv->statusBar), FALSE, FALSE, 2); @@ -1721,6 +1737,13 @@ static GObject *trg_main_window_constructor(GType type, if (width > 0 && height > 0) gtk_window_set_default_size(GTK_WINDOW(self), width, height); + gtk_widget_show_all(GTK_WIDGET(self)); + + trg_widget_set_visible(priv->stateSelectorScroller, + trg_prefs_get_bool(prefs, TRG_PREFS_KEY_SHOW_STATE_SELECTOR, TRG_PREFS_GLOBAL)); + trg_widget_set_visible(priv->notebook, + trg_prefs_get_bool(prefs, TRG_PREFS_KEY_SHOW_NOTEBOOK, TRG_PREFS_GLOBAL)); + return G_OBJECT(self); } diff --git a/src/trg-menu-bar.c b/src/trg-menu-bar.c index 7efa149..6d73df4 100644 --- a/src/trg-menu-bar.c +++ b/src/trg-menu-bar.c @@ -19,6 +19,7 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> + #include "trg-main-window.h" #include "trg-menu-bar.h" @@ -44,7 +45,10 @@ enum { PROP_VIEW_STATS_BUTTON, PROP_VIEW_STATES_BUTTON, PROP_VIEW_NOTEBOOK_BUTTON, - PROP_QUIT + PROP_QUIT, + PROP_PREFS, + PROP_DIR_FILTERS, + PROP_TRACKER_FILTERS }; G_DEFINE_TYPE(TrgMenuBar, trg_menu_bar, GTK_TYPE_MENU_BAR) @@ -74,6 +78,9 @@ struct _TrgMenuBarPrivate { GtkWidget *mb_view_stats; GtkWidget *mb_about; GtkWidget *mb_quit; + GtkWidget *mb_directory_filters; + GtkWidget *mb_tracker_filters; + TrgPrefs *prefs; }; void trg_menu_bar_connected_change(TrgMenuBar * mb, gboolean connected) @@ -105,6 +112,17 @@ void trg_menu_bar_torrent_actions_sensitive(TrgMenuBar * mb, gtk_widget_set_sensitive(priv->mb_move, sensitive); } +static void trg_menu_bar_set_property(GObject * object, + guint prop_id, const GValue * value, GParamSpec * pspec G_GNUC_UNUSED) { + TrgMenuBarPrivate *priv = TRG_MENU_BAR_GET_PRIVATE(object); + + switch (prop_id) { + case PROP_PREFS: + priv->prefs = g_value_get_object(value); + break; + } +} + static void trg_menu_bar_get_property(GObject * object, guint property_id, GValue * value, GParamSpec * pspec) @@ -174,6 +192,15 @@ trg_menu_bar_get_property(GObject * object, guint property_id, case PROP_QUIT: g_value_set_object(value, priv->mb_quit); break; + case PROP_PREFS: + g_value_set_object(value, priv->prefs); + break; + case PROP_DIR_FILTERS: + g_value_set_object(value, priv->mb_directory_filters); + break; + case PROP_TRACKER_FILTERS: + g_value_set_object(value, priv->mb_tracker_filters); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); } @@ -215,29 +242,66 @@ GtkWidget *trg_menu_bar_item_new(GtkMenuShell * shell, char *text, return item; } -static GtkWidget *trg_menu_bar_view_menu_new(TrgMenuBarPrivate * priv) +static void view_menu_item_toggled_cb(GtkCheckMenuItem * w, gpointer data) { + TrgPrefs *p = TRG_PREFS(data); + gchar *key = (gchar*)g_object_get_data(G_OBJECT(w), "conf-key"); + trg_prefs_set_bool(p, key, gtk_check_menu_item_get_active(w), TRG_PREFS_GLOBAL); +} + +static void view_menu_bar_toggled_dependency_cb(GtkCheckMenuItem *w, gpointer data) +{ + gtk_widget_set_sensitive(GTK_WIDGET(data), gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); +} + +static GtkWidget *trg_menu_bar_view_item_new(TrgPrefs *prefs, gchar *key, + gchar *label, GtkWidget *dependency) +{ + GtkWidget *w = gtk_check_menu_item_new_with_label(label); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM + (w), trg_prefs_get_bool(prefs, key, TRG_PREFS_GLOBAL)); + g_object_set_data_full(G_OBJECT(w), "conf-key", g_strdup(key), + g_free); + + if (dependency) { + gtk_widget_set_sensitive(w, gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(dependency))); + g_signal_connect(dependency, "toggled", + G_CALLBACK(view_menu_bar_toggled_dependency_cb), w); + } + + g_signal_connect(w, "toggled", + G_CALLBACK(view_menu_item_toggled_cb), prefs); + + return w; +} + +static GtkWidget *trg_menu_bar_view_menu_new(TrgMenuBar * mb) +{ + TrgMenuBarPrivate *priv = TRG_MENU_BAR_GET_PRIVATE(mb); + GtkWidget *view = gtk_menu_item_new_with_mnemonic(_("_View")); GtkWidget *viewMenu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(view), viewMenu); - priv->mb_view_states = - gtk_check_menu_item_new_with_label(_("State selector")); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM - (priv->mb_view_states), TRUE); + priv->mb_view_states = trg_menu_bar_view_item_new(priv->prefs, TRG_PREFS_KEY_SHOW_STATE_SELECTOR, _("State selector"), NULL); + gtk_menu_shell_append(GTK_MENU_SHELL(viewMenu), priv->mb_view_states); - priv->mb_view_notebook = - gtk_check_menu_item_new_with_mnemonic(_("Torrent _details")); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM - (priv->mb_view_notebook), TRUE); + priv->mb_directory_filters = trg_menu_bar_view_item_new(priv->prefs, TRG_PREFS_KEY_FILTER_DIRS, _("Directory filters"), priv->mb_view_states); + gtk_menu_shell_append(GTK_MENU_SHELL(viewMenu), + priv->mb_directory_filters); - priv->mb_view_stats = - gtk_menu_item_new_with_mnemonic(_("_Statistics")); - gtk_widget_set_sensitive(priv->mb_view_stats, FALSE); + priv->mb_tracker_filters = trg_menu_bar_view_item_new(priv->prefs, TRG_PREFS_KEY_FILTER_TRACKERS, _("Tracker filters"), priv->mb_view_states); + gtk_menu_shell_append(GTK_MENU_SHELL(viewMenu), + priv->mb_tracker_filters); - gtk_menu_shell_append(GTK_MENU_SHELL(viewMenu), priv->mb_view_states); + priv->mb_view_notebook = trg_menu_bar_view_item_new(priv->prefs, TRG_PREFS_KEY_SHOW_NOTEBOOK, _("Torrent details"), NULL); gtk_menu_shell_append(GTK_MENU_SHELL(viewMenu), priv->mb_view_notebook); + + + priv->mb_view_stats = + gtk_menu_item_new_with_mnemonic(_("_Statistics")); + gtk_widget_set_sensitive(priv->mb_view_stats, FALSE); gtk_menu_shell_append(GTK_MENU_SHELL(viewMenu), priv->mb_view_stats); return view; @@ -355,10 +419,35 @@ GtkWidget *trg_menu_bar_help_menu_new(TrgMenuBar * menuBar) return helpMenu; } +static GObject *trg_menu_bar_constructor(GType type, + guint n_construct_properties, GObjectConstructParam * construct_params) { + GObject *object; + TrgMenuBarPrivate *priv; + + object = G_OBJECT_CLASS + (trg_menu_bar_parent_class)->constructor(type, + n_construct_properties, construct_params); + priv = TRG_MENU_BAR_GET_PRIVATE(object); + + gtk_menu_shell_append(GTK_MENU_SHELL(object), + trg_menu_bar_file_file_menu_new(priv)); + gtk_menu_shell_append(GTK_MENU_SHELL(object), + trg_menu_bar_torrent_menu_new(priv)); + gtk_menu_shell_append(GTK_MENU_SHELL(object), + trg_menu_bar_options_menu_new(priv)); + gtk_menu_shell_append(GTK_MENU_SHELL(object), + trg_menu_bar_view_menu_new(TRG_MENU_BAR(object))); + trg_menu_bar_help_menu_new(TRG_MENU_BAR(object)); + + return object; +} + static void trg_menu_bar_class_init(TrgMenuBarClass * klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); object_class->get_property = trg_menu_bar_get_property; + object_class->set_property = trg_menu_bar_set_property; + object_class->constructor = trg_menu_bar_constructor; g_type_class_add_private(klass, sizeof(TrgMenuBarPrivate)); @@ -416,25 +505,32 @@ static void trg_menu_bar_class_init(TrgMenuBarClass * klass) "Local Prefs Button"); trg_menu_bar_install_widget_prop(object_class, PROP_QUIT, "quit-button", "Quit Button"); + trg_menu_bar_install_widget_prop(object_class, PROP_DIR_FILTERS, + "dir-filters", "Dir Filters"); + trg_menu_bar_install_widget_prop(object_class, PROP_TRACKER_FILTERS, + "tracker-filters", "Tracker Filters"); + + + g_object_class_install_property(object_class, + PROP_PREFS, + g_param_spec_object("prefs", + "prefs", + "Prefs", + TRG_TYPE_PREFS, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY + | + G_PARAM_STATIC_NAME + | + G_PARAM_STATIC_NICK + | + G_PARAM_STATIC_BLURB)); } static void trg_menu_bar_init(TrgMenuBar * self) { - TrgMenuBarPrivate *priv = TRG_MENU_BAR_GET_PRIVATE(self); - - gtk_menu_shell_append(GTK_MENU_SHELL(self), - trg_menu_bar_file_file_menu_new(priv)); - gtk_menu_shell_append(GTK_MENU_SHELL(self), - trg_menu_bar_torrent_menu_new(priv)); - gtk_menu_shell_append(GTK_MENU_SHELL(self), - trg_menu_bar_options_menu_new(priv)); - gtk_menu_shell_append(GTK_MENU_SHELL(self), - trg_menu_bar_view_menu_new(priv)); - trg_menu_bar_help_menu_new(TRG_MENU_BAR(self)); } -TrgMenuBar *trg_menu_bar_new(TrgMainWindow * win G_GNUC_UNUSED) +TrgMenuBar *trg_menu_bar_new(TrgPrefs *prefs) { - GObject *obj = g_object_new(TRG_TYPE_MENU_BAR, NULL); - return TRG_MENU_BAR(obj); + return g_object_new(TRG_TYPE_MENU_BAR, "prefs", prefs, NULL); } diff --git a/src/trg-menu-bar.h b/src/trg-menu-bar.h index cc148be..1f9fe29 100644 --- a/src/trg-menu-bar.h +++ b/src/trg-menu-bar.h @@ -23,6 +23,7 @@ #include <glib-object.h> #include <gtk/gtk.h> +#include "trg-prefs.h" #include "trg-main-window.h" G_BEGIN_DECLS @@ -47,7 +48,7 @@ typedef struct { GType trg_menu_bar_get_type(void); -TrgMenuBar *trg_menu_bar_new(TrgMainWindow * win); +TrgMenuBar *trg_menu_bar_new(TrgPrefs * prefs); GtkWidget *trg_menu_bar_item_new(GtkMenuShell * shell, char *text, char *stock_id, gboolean sensitive); diff --git a/src/trg-preferences-dialog.c b/src/trg-preferences-dialog.c index aa2f18b..fd9add2 100644 --- a/src/trg-preferences-dialog.c +++ b/src/trg-preferences-dialog.c @@ -274,12 +274,6 @@ static void toggle_filter_trackers(GtkToggleButton * w, gpointer win) { gtk_toggle_button_get_active(w)); } -static void toggle_filter_dirs(GtkToggleButton * w, gpointer win) { - TrgStateSelector *selector = trg_main_window_get_state_selector( - TRG_MAIN_WINDOW(win)); - trg_state_selector_set_show_dirs(selector, gtk_toggle_button_get_active(w)); -} - static void toggle_graph(GtkToggleButton * w, gpointer win) { if (gtk_toggle_button_get_active(w)) trg_main_window_add_graph(TRG_MAIN_WINDOW(win), TRUE); @@ -294,6 +288,12 @@ static void toggle_tray_icon(GtkToggleButton * w, gpointer win) { trg_main_window_remove_status_icon(TRG_MAIN_WINDOW(win)); } +static void menu_bar_toggle_filter_dirs(GtkToggleButton * w, gpointer win) { + TrgStateSelector *selector = trg_main_window_get_state_selector( + TRG_MAIN_WINDOW(win)); + trg_state_selector_set_show_dirs(selector, gtk_toggle_button_get_active(w)); +} + static GtkWidget *trg_prefs_desktopPage(TrgPreferencesDialog *dlg) { TrgPreferencesDialogPrivate *priv = TRG_PREFERENCES_DIALOG_GET_PRIVATE(dlg); @@ -307,7 +307,7 @@ static GtkWidget *trg_prefs_desktopPage(TrgPreferencesDialog *dlg) { w = trgp_check_new(dlg, _("Directory filters"), TRG_PREFS_KEY_FILTER_DIRS, TRG_PREFS_GLOBAL); g_signal_connect(G_OBJECT(w), "toggled", - G_CALLBACK(toggle_filter_dirs), priv->win); + G_CALLBACK(menu_bar_toggle_filter_dirs), priv->win); hig_workarea_add_wide_control(t, &row, w); w = trgp_check_new(dlg, _("Tracker filters"), diff --git a/src/trg-prefs.c b/src/trg-prefs.c index 9a507b1..7ea742f 100644 --- a/src/trg-prefs.c +++ b/src/trg-prefs.c @@ -73,12 +73,12 @@ static void trg_prefs_create_defaults(TrgPrefs *p) { trg_prefs_add_default_int(p, TRG_PREFS_KEY_UPDATE_INTERVAL, TRG_INTERVAL_DEFAULT); trg_prefs_add_default_int(p, TRG_PREFS_KEY_MINUPDATE_INTERVAL, TRG_MININTERVAL_DEFAULT); - trg_prefs_add_default_bool(p, TRG_PREFS_KEY_FILTER_DIRS, TRUE); - trg_prefs_add_default_bool(p, TRG_PREFS_KEY_FILTER_TRACKERS, TRUE); - trg_prefs_add_default_bool(p, TRG_PREFS_KEY_AUTO_CONNECT, FALSE); - trg_prefs_add_default_bool(p, TRG_PREFS_KEY_SHOW_GRAPH, TRUE); - trg_prefs_add_default_bool(p, TRG_PREFS_KEY_SHOW_GRAPH, TRUE); - trg_prefs_add_default_bool(p, TRG_PREFS_KEY_ADD_OPTIONS_DIALOG, TRUE); + trg_prefs_add_default_bool_true(p, TRG_PREFS_KEY_FILTER_DIRS); + trg_prefs_add_default_bool_true(p, TRG_PREFS_KEY_FILTER_TRACKERS); + trg_prefs_add_default_bool_true(p, TRG_PREFS_KEY_SHOW_GRAPH); + trg_prefs_add_default_bool_true(p, TRG_PREFS_KEY_ADD_OPTIONS_DIALOG); + trg_prefs_add_default_bool_true(p, TRG_PREFS_KEY_SHOW_STATE_SELECTOR); + trg_prefs_add_default_bool_true(p, TRG_PREFS_KEY_SHOW_NOTEBOOK); } static GObject *trg_prefs_constructor(GType type, guint n_construct_properties, @@ -138,9 +138,10 @@ void trg_prefs_add_default_double(TrgPrefs *p, gchar *key, double value) { json_object_set_double_member(priv->defaultsObj, key, value); } -void trg_prefs_add_default_bool(TrgPrefs *p, gchar *key, gboolean value) { +/* Not much point adding a default of FALSE, as that's the fallback */ +void trg_prefs_add_default_bool_true(TrgPrefs *p, gchar *key) { TrgPrefsPrivate *priv = GET_PRIVATE(p); - json_object_set_boolean_member(priv->defaultsObj, key, value); + json_object_set_boolean_member(priv->defaultsObj, key, TRUE); } gint trg_prefs_get_profile_id(TrgPrefs *p) { @@ -171,9 +172,8 @@ JsonNode *trg_prefs_get_value(TrgPrefs *p, gchar *key, int flags) { } } - if (priv->defaultsObj && json_object_has_member(priv->defaultsObj, key)) { + if (priv->defaultsObj && json_object_has_member(priv->defaultsObj, key)) return json_object_get_member(priv->defaultsObj, key); - } return NULL; } diff --git a/src/trg-prefs.h b/src/trg-prefs.h index af4a2ca..dc01daf 100644 --- a/src/trg-prefs.h +++ b/src/trg-prefs.h @@ -51,6 +51,8 @@ #define TRG_PREFS_KEY_SYSTEM_TRAY_MINIMISE "system-tray-minimise" #define TRG_PREFS_KEY_FILTER_TRACKERS "filter-trackers" #define TRG_PREFS_KEY_FILTER_DIRS "filter-dirs" +#define TRG_PREFS_KEY_SHOW_STATE_SELECTOR "show-state-selector" +#define TRG_PREFS_KEY_SHOW_NOTEBOOK "show-notebook" #define TRG_PREFS_KEY_LAST_TORRENT_DIR "last-torrent-dir" #define TRG_PREFS_KEY_ADD_OPTIONS_DIALOG "add-options-dialog" #define TRG_PREFS_KEY_START_PAUSED "start-paused" @@ -102,7 +104,7 @@ TrgPrefs* trg_prefs_new (void); void trg_prefs_add_default_int(TrgPrefs *p, gchar *key, int value); void trg_prefs_add_default_string(TrgPrefs *p, gchar *key, gchar *value); void trg_prefs_add_default_double(TrgPrefs *p, gchar *key, double value); -void trg_prefs_add_default_bool(TrgPrefs *p, gchar *key, gboolean value); +void trg_prefs_add_default_bool_true(TrgPrefs *p, gchar *key); JsonNode *trg_prefs_get_value(TrgPrefs *p, gchar *key, int flags); gchar *trg_prefs_get_string(TrgPrefs *p, gchar *key, int flags); diff --git a/src/trg-torrent-add-dialog.c b/src/trg-torrent-add-dialog.c index e3718c7..d02b4e6 100644 --- a/src/trg-torrent-add-dialog.c +++ b/src/trg-torrent-add-dialog.c @@ -174,7 +174,7 @@ void launch_add_thread(struct add_torrent_threadfunc_args *args) g_thread_create(add_files_threadfunc, args, FALSE, &error); if (error) { - g_printf("thread creation error: %s\n", error->message); + g_error("thread creation error: %s\n", error->message); g_error_free(error); g_str_slist_free(args->list); g_free(args); |