diff options
author | Alan Fitton <ajf@eth0.org.uk> | 2011-10-21 23:12:21 +0000 |
---|---|---|
committer | Alan Fitton <ajf@eth0.org.uk> | 2011-10-21 23:12:21 +0000 |
commit | 34c56c7db7c57f5db0184489d01866902e992300 (patch) | |
tree | 8707a14ac8f786ff684279be77e66946f235b751 /src/trg-destination-combo.c | |
parent | 3b8fd9e7274477cfad98d66e41a43417ce8d21bf (diff) |
make the execute command tree view in preferences a generic widget, the "persistent tree view"
Diffstat (limited to 'src/trg-destination-combo.c')
-rw-r--r-- | src/trg-destination-combo.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/trg-destination-combo.c b/src/trg-destination-combo.c index 976e3bb..5fe32b0 100644 --- a/src/trg-destination-combo.c +++ b/src/trg-destination-combo.c @@ -26,7 +26,7 @@ #include "util.h" G_DEFINE_TYPE(TrgDestinationCombo, trg_destination_combo, - GTK_TYPE_COMBO_BOX_ENTRY) + GTK_TYPE_COMBO_BOX) #define TRG_DESTINATION_COMBO_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRG_TYPE_DESTINATION_COMBO, TrgDestinationComboPrivate)) typedef struct _TrgDestinationComboPrivate TrgDestinationComboPrivate; @@ -104,7 +104,7 @@ static GObject *trg_destination_combo_constructor(GType type, GSList *sli; GList *li; GList *torrentItemRefs; - + GtkCellRenderer *renderer; GtkTreeRowReference *rr; GtkTreeModel *model; GtkTreePath *path; @@ -115,7 +115,7 @@ static GObject *trg_destination_combo_constructor(GType type, g_strdup(session_get_download_dir(trg_client_get_session(client))); rm_trailing_slashes(defaultDownDir); - comboModel = gtk_list_store_new(1, G_TYPE_STRING); + comboModel = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); trg_client_updatelock(client); torrentItemRefs = g_hash_table_get_values(trg_client_get_torrent_table(client)); @@ -150,12 +150,15 @@ static GObject *trg_destination_combo_constructor(GType type, for (sli = dirs; sli; sli = g_slist_next(sli)) gtk_list_store_insert_with_values(comboModel, NULL, INT_MAX, 0, - (gchar *) sli->data, -1); + (gchar *) sli->data, + 1, (gchar *) sli->data, -1); gtk_combo_box_set_model(GTK_COMBO_BOX(object), GTK_TREE_MODEL(comboModel)); - gtk_combo_box_entry_set_text_column(GTK_COMBO_BOX_ENTRY(object), 0); + renderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(object), renderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(object), renderer, "text", 0, NULL); g_object_unref(comboModel); g_slist_foreach(dirs, (GFunc)g_free, NULL); @@ -164,6 +167,15 @@ static GObject *trg_destination_combo_constructor(GType type, return object; } +gchar *trg_destination_combo_get_dir(TrgDestinationCombo *combo) +{ + GtkTreeIter iter; + gchar *value; + gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter); + gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(combo)), &iter, 1, &value, -1); + return value; +} + static void trg_destination_combo_class_init(TrgDestinationComboClass * klass) { |