summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-22 13:36:25 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-04-22 13:36:25 +0000
commitf9a48fb5e46c387e87c190fc62046e732e776b94 (patch)
treeac839b4f89d7cb09e2193190251684b904eabcac
parent935c6cc0529ae5bd284d3f4e9030c04e3ecddd6a (diff)
handle multiple files via libunique, also use the more reliable get_uris() in libunique
-rw-r--r--src/main.c14
-rw-r--r--src/trg-main-window.c102
-rw-r--r--src/trg-main-window.h6
-rw-r--r--src/trg-torrent-add-dialog.c29
-rw-r--r--src/trg-torrent-add-dialog.h16
-rw-r--r--src/trg-torrent-model.c26
-rw-r--r--src/trg-torrent-model.h2
-rw-r--r--src/trg-torrent-move-dialog.c4
-rw-r--r--src/trg-torrent-props-dialog.c13
-rw-r--r--src/trg-torrent-tree-view.h3
-rw-r--r--src/trg-valgrind.sh3
-rw-r--r--src/util.c1
12 files changed, 131 insertions, 88 deletions
diff --git a/src/main.c b/src/main.c
index 9a5c627..2183b94 100644
--- a/src/main.c
+++ b/src/main.c
@@ -50,7 +50,7 @@ message_received_cb(UniqueApp * app G_GNUC_UNUSED,
{
TrgMainWindow *win;
UniqueResponse res;
- gchar *fileName;
+ gchar **uris;
win = TRG_MAIN_WINDOW(user_data);
@@ -62,10 +62,10 @@ message_received_cb(UniqueApp * app G_GNUC_UNUSED,
res = UNIQUE_RESPONSE_OK;
break;
case COMMAND_ADD:
- fileName = unique_message_data_get_filename(message);
+ uris = unique_message_data_get_uris(message);
res =
trg_add_from_filename(win,
- fileName) ? UNIQUE_RESPONSE_OK :
+ uris) ? UNIQUE_RESPONSE_OK :
UNIQUE_RESPONSE_FAIL;
break;
default:
@@ -104,9 +104,15 @@ int main(int argc, char *argv[])
UniqueMessageData *message;
if (argc > 1) {
+ gchar **files = g_new0(gchar *, argc);
+ int i;
+ for (i = 1; i < argc; i++)
+ files[i - 1] = g_strdup(argv[i]);
+
command = COMMAND_ADD;
message = unique_message_data_new();
- unique_message_data_set_filename(message, argv[1]);
+ unique_message_data_set_uris(message, files);
+ g_strfreev(files);
} else {
command = UNIQUE_ACTIVATE;
message = NULL;
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index e86cba2..accc00d 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -70,7 +70,7 @@
#include "trg-preferences-dialog.h"
static void update_selected_torrent_notebook(TrgMainWindow * win,
- gint mode, gint64 id);
+ gint mode, gint64 id);
static void torrent_event_notification(TrgTorrentModel * model,
gchar * icon, gchar * desc,
gint tmout, gchar * prefKey,
@@ -138,7 +138,8 @@ static TrgTorrentTreeView
static gboolean trg_dialog_error_handler(TrgMainWindow * win,
JsonObject * response,
int status);
-static gboolean torrent_selection_changed(GtkTreeSelection * selection, gpointer data);
+static gboolean torrent_selection_changed(GtkTreeSelection * selection,
+ gpointer data);
static void trg_main_window_torrent_scrub(TrgMainWindow * win);
static void entry_filter_changed_cb(GtkWidget * w, gpointer data);
static void torrent_state_selection_changed(TrgStateSelector * selector,
@@ -240,36 +241,37 @@ static void trg_main_window_init(TrgMainWindow * self G_GNUC_UNUSED)
{
}
-GtkTreeModel *trg_main_window_get_torrent_model(TrgMainWindow *win)
+GtkTreeModel *trg_main_window_get_torrent_model(TrgMainWindow * win)
{
TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win);
return GTK_TREE_MODEL(priv->torrentModel);
}
-gint trg_mw_get_selected_torrent_id(TrgMainWindow *win)
+gint trg_mw_get_selected_torrent_id(TrgMainWindow * win)
{
TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win);
return priv->selectedTorrentId;
}
static void update_selected_torrent_notebook(TrgMainWindow * win,
- gint mode, gint64 id)
+ gint mode, gint64 id)
{
TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win);
trg_client *client = priv->client;
JsonObject *t;
GtkTreeIter iter;
- if (id >= 0 && id != priv->selectedTorrentId && get_torrent_data(client->torrentTable, id, &t, &iter)) {
- trg_toolbar_torrent_actions_sensitive(priv->toolBar, TRUE);
- trg_menu_bar_torrent_actions_sensitive(priv->menuBar, TRUE);
- trg_general_panel_update(priv->genDetails, t, &iter);
- trg_trackers_model_update(priv->trackersModel, client->updateSerial, t,
- mode);
- trg_files_model_update(priv->filesModel, client->updateSerial, t,
- mode);
- trg_peers_model_update(priv->peersModel, client->updateSerial, t,
- mode);
+ if (id >= 0 && id != priv->selectedTorrentId
+ && get_torrent_data(client->torrentTable, id, &t, &iter)) {
+ trg_toolbar_torrent_actions_sensitive(priv->toolBar, TRUE);
+ trg_menu_bar_torrent_actions_sensitive(priv->menuBar, TRUE);
+ trg_general_panel_update(priv->genDetails, t, &iter);
+ trg_trackers_model_update(priv->trackersModel,
+ client->updateSerial, t, mode);
+ trg_files_model_update(priv->filesModel, client->updateSerial, t,
+ mode);
+ trg_peers_model_update(priv->peersModel, client->updateSerial, t,
+ mode);
} else if (id < 0) {
trg_main_window_torrent_scrub(win);
@@ -418,32 +420,38 @@ static void pause_all_cb(GtkWidget * w G_GNUC_UNUSED, gpointer data)
on_generic_interactive_action, data);
}
-gboolean trg_add_from_filename(TrgMainWindow * win, gchar * fileName)
+gboolean trg_add_from_filename(TrgMainWindow * win, gchar ** uris)
{
TrgMainWindowPrivate *priv = TRG_MAIN_WINDOW_GET_PRIVATE(win);
+ trg_client *client = priv->client;
+ GSList *filesList = NULL;
+ int i;
- if (g_file_test(fileName, G_FILE_TEST_EXISTS) == TRUE) {
- if (pref_get_add_options_dialog(priv->client->gconf)) {
- GSList *filesList = g_slist_append(NULL, fileName);
- TrgTorrentAddDialog *dialog =
- trg_torrent_add_dialog_new(win, priv->client, filesList);
+ for (i = 0; uris[i]; i++)
+ filesList = g_slist_append(filesList, g_strdup(uris[i]));
- gtk_widget_show_all(GTK_WIDGET(dialog));
- } else {
- JsonNode *torrentAddReq = torrent_add(fileName,
- pref_get_start_paused
- (priv->client->gconf));
- dispatch_async(priv->client, torrentAddReq,
- on_generic_interactive_action, win);
- g_free(fileName);
- }
- return TRUE;
+ if (pref_get_add_options_dialog(client->gconf)) {
+ gdk_threads_enter();
+ TrgTorrentAddDialog *dialog =
+ trg_torrent_add_dialog_new(win, client, filesList);
+
+ gtk_widget_show_all(GTK_WIDGET(dialog));
+ gdk_threads_leave();
} else {
- g_printf("file doesn't exist: \"%s\"\n", fileName);
- g_free(fileName);
+ struct add_torrent_threadfunc_args *args =
+ g_new(struct add_torrent_threadfunc_args, 1);
+ args->list = filesList;
+ args->cb_data = win;
+ args->client = client;
+ args->paused = pref_get_start_paused(client->gconf);
+ args->extraArgs = FALSE;
+
+ launch_add_thread(args);
}
- return FALSE;
+ g_strfreev(uris);
+
+ return TRUE;
}
static void resume_all_cb(GtkWidget * w G_GNUC_UNUSED, gpointer data)
@@ -777,7 +785,8 @@ GtkWidget *trg_main_window_notebook_new(TrgMainWindow * win)
gtk_widget_set_size_request(notebook, -1, 175);
- priv->genDetails = trg_general_panel_new(GTK_TREE_MODEL(priv->torrentModel));
+ priv->genDetails =
+ trg_general_panel_new(GTK_TREE_MODEL(priv->torrentModel));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
GTK_WIDGET(priv->genDetails),
gtk_label_new(_("General")));
@@ -942,7 +951,8 @@ on_torrent_get(JsonObject * response, int mode, int status, gpointer data)
trg_torrent_model_update(priv->torrentModel, priv->client,
response, &stats, mode);
- update_selected_torrent_notebook(TRG_MAIN_WINDOW(data), mode, priv->selectedTorrentId);
+ update_selected_torrent_notebook(TRG_MAIN_WINDOW(data), mode,
+ priv->selectedTorrentId);
trg_status_bar_update(priv->statusBar, &stats, client);
@@ -988,10 +998,10 @@ static gboolean trg_update_torrents_timerfunc(gpointer data)
if (priv->client->session)
dispatch_async(priv->client,
- torrent_get(priv->
- client->activeOnlyUpdate ? -2 : -1),
- priv->client->
- activeOnlyUpdate ? on_torrent_get_active :
+ torrent_get(priv->client->
+ activeOnlyUpdate ? -2 : -1),
+ priv->
+ client->activeOnlyUpdate ? on_torrent_get_active :
on_torrent_get_update, data);
return FALSE;
@@ -1134,9 +1144,10 @@ torrent_selection_changed(GtkTreeSelection * selection, gpointer data)
if (firstNode) {
GtkTreeIter iter;
if (gtk_tree_model_get_iter
- (priv->sortedTorrentModel, &iter, (GtkTreePath *) firstNode->data)) {
- gtk_tree_model_get(GTK_TREE_MODEL(priv->sortedTorrentModel), &iter,
- TORRENT_COLUMN_ID, &id, -1);
+ (priv->sortedTorrentModel, &iter,
+ (GtkTreePath *) firstNode->data)) {
+ gtk_tree_model_get(GTK_TREE_MODEL(priv->sortedTorrentModel),
+ &iter, TORRENT_COLUMN_ID, &id, -1);
}
}
@@ -1186,7 +1197,7 @@ void trg_main_window_torrent_scrub(TrgMainWindow * win)
gtk_list_store_clear(GTK_LIST_STORE(priv->peersModel));
trg_general_panel_clear(priv->genDetails);
trg_trackers_model_set_no_selection(TRG_TRACKERS_MODEL
- (priv->trackersModel));
+ (priv->trackersModel));
}
static void entry_filter_changed_cb(GtkWidget * w, gpointer data)
@@ -1453,7 +1464,8 @@ static GtkWidget *limit_menu_new(TrgMainWindow * win, gchar * title,
gint64 limit;
if (ids)
- get_torrent_data(client->torrentTable, priv->selectedTorrentId, &current, &iter);
+ get_torrent_data(client->torrentTable, priv->selectedTorrentId,
+ &current, &iter);
else
current = client->session;
diff --git a/src/trg-main-window.h b/src/trg-main-window.h
index 1c3eda8..4c46a34 100644
--- a/src/trg-main-window.h
+++ b/src/trg-main-window.h
@@ -57,7 +57,7 @@ typedef struct {
#define TORRENT_ADD_NOTIFY_TMOUT 3000
GType trg_main_window_get_type(void);
-gboolean trg_add_from_filename(TrgMainWindow * win, gchar * fileName);
+gboolean trg_add_from_filename(TrgMainWindow * win, gchar ** uris);
void on_session_set(JsonObject * response, int status, gpointer data);
void on_generic_interactive_action(JsonObject * response, int status,
gpointer data);
@@ -68,8 +68,8 @@ void trg_main_window_remove_status_icon(TrgMainWindow * win);
void trg_main_window_add_graph(TrgMainWindow * win, gboolean show);
void trg_main_window_remove_graph(TrgMainWindow * win);
TrgStateSelector *trg_main_window_get_state_selector(TrgMainWindow * win);
-gint trg_mw_get_selected_torrent_id(TrgMainWindow *win);
-GtkTreeModel *trg_main_window_get_torrent_model(TrgMainWindow *win);
+gint trg_mw_get_selected_torrent_id(TrgMainWindow * win);
+GtkTreeModel *trg_main_window_get_torrent_model(TrgMainWindow * win);
G_END_DECLS
#endif /* MAIN_WINDOW_H_ */
diff --git a/src/trg-torrent-add-dialog.c b/src/trg-torrent-add-dialog.c
index cbaa3ac..cd6308f 100644
--- a/src/trg-torrent-add-dialog.c
+++ b/src/trg-torrent-add-dialog.c
@@ -125,21 +125,6 @@ trg_torrent_add_dialog_get_property(GObject * object,
}
}
-/* Use synchronous dispatch() in our dedicated thread function.
- * This means torrents are added in sequence, instead of dispatch_async()
- * working concurrently for each upload.
- */
-
-struct add_torrent_threadfunc_args {
- GSList *list;
- trg_client *client;
- gpointer cb_data;
- gboolean paused;
- gchar *dir;
- gint priority;
- gboolean extraArgs;
-};
-
static void add_set_common_args(JsonObject * args, gint priority,
gchar * dir)
{
@@ -236,7 +221,7 @@ static GtkWidget *trg_destination_folder_new(trg_client * client)
return combo;
}
-static void launch_add_thread(struct add_torrent_threadfunc_args *args)
+void launch_add_thread(struct add_torrent_threadfunc_args *args)
{
GError *error = NULL;
g_thread_create(add_files_threadfunc, args, FALSE, &error);
@@ -774,8 +759,12 @@ static void trg_torrent_add_dialog_set_filenames(TrgTorrentAddDialog * d,
gchar *file_name_base = g_path_get_basename(file_name);
trg_torrent_file *tor_data = trg_parse_torrent_file(file_name);
- gtk_button_set_label(chooser, file_name_base);
- g_free(file_name_base);
+ if (file_name_base) {
+ gtk_button_set_label(chooser, file_name_base);
+ g_free(file_name_base);
+ } else {
+ gtk_button_set_label(chooser, file_name);
+ }
if (!tor_data) {
torrent_not_parsed_warning(GTK_WINDOW(priv->parent));
@@ -901,8 +890,8 @@ static GObject *trg_torrent_add_dialog_constructor(GType type,
priv->paused_check =
gtk_check_button_new_with_mnemonic(_("Start _paused"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->paused_check),
- pref_get_start_paused(priv->client->
- gconf));
+ pref_get_start_paused(priv->
+ client->gconf));
priv->priority_combo = gtr_priority_combo_new();
gtk_combo_box_set_active(GTK_COMBO_BOX(priv->priority_combo), 1);
diff --git a/src/trg-torrent-add-dialog.h b/src/trg-torrent-add-dialog.h
index 0b932ff..a64379d 100644
--- a/src/trg-torrent-add-dialog.h
+++ b/src/trg-torrent-add-dialog.h
@@ -46,12 +46,28 @@ typedef struct {
GtkDialogClass parent_class;
} TrgTorrentAddDialogClass;
+/* Use synchronous dispatch() in our dedicated thread function.
+ * This means torrents are added in sequence, instead of dispatch_async()
+ * working concurrently for each upload.
+ */
+
+struct add_torrent_threadfunc_args {
+ GSList *list;
+ trg_client *client;
+ gpointer cb_data;
+ gboolean paused;
+ gchar *dir;
+ gint priority;
+ gboolean extraArgs;
+};
+
GType trg_torrent_add_dialog_get_type(void);
TrgTorrentAddDialog *trg_torrent_add_dialog_new(TrgMainWindow * win,
trg_client * client,
GSList * filenames);
void trg_torrent_add_dialog(TrgMainWindow * win, trg_client * client);
+void launch_add_thread(struct add_torrent_threadfunc_args *args);
G_END_DECLS
#endif /* TRG_TORRENT_ADD_DIALOG_H_ */
diff --git a/src/trg-torrent-model.c b/src/trg-torrent-model.c
index 4c8add8..7045ed9 100644
--- a/src/trg-torrent-model.c
+++ b/src/trg-torrent-model.c
@@ -135,11 +135,14 @@ static void trg_torrent_model_ref_free(gpointer data)
GtkTreeIter iter;
JsonObject *json;
if (gtk_tree_model_get_iter(model, &iter, path)) {
- gtk_tree_model_get(model, &iter, TORRENT_COLUMN_JSON, &json, -1);
+ gtk_tree_model_get(model, &iter, TORRENT_COLUMN_JSON, &json,
+ -1);
json_object_unref(json);
- g_object_set_data(G_OBJECT(model), PROP_REMOVE_IN_PROGRESS, GINT_TO_POINTER(TRUE));
+ g_object_set_data(G_OBJECT(model), PROP_REMOVE_IN_PROGRESS,
+ GINT_TO_POINTER(TRUE));
gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
- g_object_set_data(G_OBJECT(model), PROP_REMOVE_IN_PROGRESS, GINT_TO_POINTER(FALSE));
+ g_object_set_data(G_OBJECT(model), PROP_REMOVE_IN_PROGRESS,
+ GINT_TO_POINTER(FALSE));
}
gtk_tree_path_free(path);
@@ -181,12 +184,15 @@ static void trg_torrent_model_init(TrgTorrentModel * self)
(GDestroyNotify) g_free,
trg_torrent_model_ref_free);
- g_object_set_data(G_OBJECT(self), PROP_REMOVE_IN_PROGRESS, GINT_TO_POINTER(FALSE));
+ g_object_set_data(G_OBJECT(self), PROP_REMOVE_IN_PROGRESS,
+ GINT_TO_POINTER(FALSE));
}
-gboolean trg_torrent_model_is_remove_in_progress(TrgTorrentModel *model)
+gboolean trg_torrent_model_is_remove_in_progress(TrgTorrentModel * model)
{
- return (gboolean)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(model), PROP_REMOVE_IN_PROGRESS));
+ return (gboolean)
+ GPOINTER_TO_INT(g_object_get_data
+ (G_OBJECT(model), PROP_REMOVE_IN_PROGRESS));
}
static guint32 torrent_get_flags(JsonObject * t, gint64 status)
@@ -398,13 +404,14 @@ GList *trg_torrent_model_find_removed(GtkTreeModel * model,
return args.toRemove;
}
-gboolean get_torrent_data(GHashTable *table, gint64 id, JsonObject **t, GtkTreeIter *out_iter)
+gboolean get_torrent_data(GHashTable * table, gint64 id, JsonObject ** t,
+ GtkTreeIter * out_iter)
{
gpointer result = g_hash_table_lookup(table, &id);
gboolean found = FALSE;
if (result) {
- GtkTreeRowReference *rr = (GtkTreeRowReference*)result;
+ GtkTreeRowReference *rr = (GtkTreeRowReference *) result;
GtkTreePath *path = gtk_tree_row_reference_get_path(rr);
GtkTreeIter iter;
if (path) {
@@ -413,7 +420,8 @@ gboolean get_torrent_data(GHashTable *table, gint64 id, JsonObject **t, GtkTreeI
if (out_iter)
*out_iter = iter;
if (t)
- gtk_tree_model_get(model, &iter, TORRENT_COLUMN_JSON, t, -1);
+ gtk_tree_model_get(model, &iter, TORRENT_COLUMN_JSON, t,
+ -1);
found = TRUE;
gtk_tree_path_free(path);
}
diff --git a/src/trg-torrent-model.h b/src/trg-torrent-model.h
index 4f13e9d..1924b78 100644
--- a/src/trg-torrent-model.h
+++ b/src/trg-torrent-model.h
@@ -75,7 +75,7 @@ void trg_torrent_model_update(TrgTorrentModel * model, trg_client * tc,
gint mode);
GHashTable *get_torrent_table(TrgTorrentModel * model);
-gboolean trg_torrent_model_is_remove_in_progress(TrgTorrentModel *model);
+gboolean trg_torrent_model_is_remove_in_progress(TrgTorrentModel * model);
enum {
TORRENT_COLUMN_ICON,
diff --git a/src/trg-torrent-move-dialog.c b/src/trg-torrent-move-dialog.c
index f850672..bd0bd1c 100644
--- a/src/trg-torrent-move-dialog.c
+++ b/src/trg-torrent-move-dialog.c
@@ -145,7 +145,9 @@ TrgTorrentMoveDialog *trg_torrent_move_dialog_new(TrgMainWindow * win,
gchar *name;
const gchar *current_location;
- get_torrent_data(client->torrentTable, trg_mw_get_selected_torrent_id(win), &json, &iter);
+ get_torrent_data(client->torrentTable,
+ trg_mw_get_selected_torrent_id(win), &json,
+ &iter);
gtk_tree_model_get(trg_main_window_get_torrent_model(priv->win),
&iter, TORRENT_COLUMN_NAME, &name, -1);
current_location = torrent_get_download_dir(json);
diff --git a/src/trg-torrent-props-dialog.c b/src/trg-torrent-props-dialog.c
index 622a89f..5d11a99 100644
--- a/src/trg-torrent-props-dialog.c
+++ b/src/trg-torrent-props-dialog.c
@@ -138,10 +138,12 @@ trg_torrent_props_response_cb(GtkDialog * dlg, gint res_id,
(priv->seedRatioLimit), args);
json_object_set_int_member(args, FIELD_SEED_RATIO_MODE,
gtk_combo_box_get_active(GTK_COMBO_BOX
- (priv->seedRatioMode)));
+ (priv->
+ seedRatioMode)));
json_object_set_int_member(args, FIELD_BANDWIDTH_PRIORITY,
gtk_combo_box_get_active(GTK_COMBO_BOX
- (priv->bandwidthPriorityCombo))
+ (priv->
+ bandwidthPriorityCombo))
- 1);
gtk_spin_button_json_int_out(GTK_SPIN_BUTTON
@@ -271,7 +273,9 @@ static GObject *trg_torrent_props_dialog_constructor(GType type,
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->tv));
rowCount = gtk_tree_selection_count_selected_rows(selection);
- get_torrent_data(priv->client->torrentTable, trg_mw_get_selected_torrent_id(priv->parent), &json, NULL);
+ get_torrent_data(priv->client->torrentTable,
+ trg_mw_get_selected_torrent_id(priv->parent), &json,
+ NULL);
priv->targetIds = build_json_id_array(priv->tv);
if (rowCount > 1) {
@@ -284,7 +288,8 @@ static GObject *trg_torrent_props_dialog_constructor(GType type,
gtk_window_set_title(GTK_WINDOW(object), torrent_get_name(json));
}
- gtk_window_set_transient_for(GTK_WINDOW(object), GTK_WINDOW(priv->parent));
+ gtk_window_set_transient_for(GTK_WINDOW(object),
+ GTK_WINDOW(priv->parent));
gtk_window_set_destroy_with_parent(GTK_WINDOW(object), TRUE);
gtk_dialog_add_button(GTK_DIALOG(object), GTK_STOCK_CLOSE,
diff --git a/src/trg-torrent-tree-view.h b/src/trg-torrent-tree-view.h
index 382d50e..20929e4 100644
--- a/src/trg-torrent-tree-view.h
+++ b/src/trg-torrent-tree-view.h
@@ -51,7 +51,8 @@ GType trg_torrent_tree_view_get_type(void);
TrgTorrentTreeView *trg_torrent_tree_view_new(GtkTreeModel * model);
JsonArray *build_json_id_array(TrgTorrentTreeView * tv);
-gboolean get_torrent_data(GHashTable *table, gint64 id, JsonObject **t, GtkTreeIter *out_iter);
+gboolean get_torrent_data(GHashTable * table, gint64 id, JsonObject ** t,
+ GtkTreeIter * out_iter);
G_END_DECLS
#endif /* _TRG_TORRENT_TREE_VIEW_H_ */
diff --git a/src/trg-valgrind.sh b/src/trg-valgrind.sh
new file mode 100644
index 0000000..030a840
--- /dev/null
+++ b/src/trg-valgrind.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20 --log-file=valgrind.log ./transmission-remote-gtk
diff --git a/src/util.c b/src/util.c
index 1ad04c5..077568d 100644
--- a/src/util.c
+++ b/src/util.c
@@ -123,6 +123,7 @@ gboolean gconf_client_get_bool_or_true(GConfClient * gconf, gchar * key)
g_error_free(error);
} else if (value) {
ret = gconf_value_get_bool(value);
+ gconf_value_free(value);
}
return ret;
}