Line
Link Here
|
0 |
-- src/trg-destination-combo.c |
0 |
++ src/trg-destination-combo.c |
Lines 163-172
gtk_combo_box_entry_active_changed(GtkComboBox * combo_box,
Link Here
|
163 |
editableEntry = FALSE; |
163 |
editableEntry = FALSE; |
164 |
} |
164 |
} |
165 |
} |
165 |
} |
166 |
gtk_editable_set_editable(GTK_EDITABLE |
166 |
//~ gtk_editable_set_editable(GTK_EDITABLE |
167 |
(trg_destination_combo_get_entry |
167 |
//~ (trg_destination_combo_get_entry |
168 |
(TRG_DESTINATION_COMBO(combo_box))), |
168 |
//~ (TRG_DESTINATION_COMBO(combo_box))), |
169 |
editableEntry); |
169 |
//~ editableEntry); |
170 |
} |
170 |
} |
171 |
|
171 |
|
172 |
gboolean trg_destination_combo_has_text(TrgDestinationCombo * combo) |
172 |
gboolean trg_destination_combo_has_text(TrgDestinationCombo * combo) |
Lines 179-189
gboolean trg_destination_combo_has_text(TrgDestinationCombo * combo)
Link Here
|
179 |
|
179 |
|
180 |
GtkEntry *trg_destination_combo_get_entry(TrgDestinationCombo * combo) |
180 |
GtkEntry *trg_destination_combo_get_entry(TrgDestinationCombo * combo) |
181 |
{ |
181 |
{ |
182 |
TrgDestinationComboPrivate *priv = |
182 |
//~ TrgDestinationComboPrivate *priv = |
183 |
TRG_DESTINATION_COMBO_GET_PRIVATE(combo); |
183 |
//~ TRG_DESTINATION_COMBO_GET_PRIVATE(combo); |
184 |
return GTK_ENTRY(priv->entry); |
184 |
//~ return GTK_ENTRY(priv->entry); |
|
|
185 |
return GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo))); |
185 |
} |
186 |
} |
186 |
|
187 |
|
|
|
188 |
|
187 |
static void |
189 |
static void |
188 |
add_entry_cb(GtkEntry * entry, |
190 |
add_entry_cb(GtkEntry * entry, |
189 |
GtkEntryIconPosition icon_pos, |
191 |
GtkEntryIconPosition icon_pos, |
Lines 265-270
static GObject *trg_destination_combo_constructor(GType type,
Link Here
|
265 |
(trg_destination_combo_parent_class)->constructor(type, |
267 |
(trg_destination_combo_parent_class)->constructor(type, |
266 |
n_construct_properties, |
268 |
n_construct_properties, |
267 |
construct_params); |
269 |
construct_params); |
|
|
270 |
|
268 |
TrgDestinationComboPrivate *priv = |
271 |
TrgDestinationComboPrivate *priv = |
269 |
TRG_DESTINATION_COMBO_GET_PRIVATE(object); |
272 |
TRG_DESTINATION_COMBO_GET_PRIVATE(object); |
270 |
|
273 |
|
Lines 281-286
static GObject *trg_destination_combo_constructor(GType type,
Link Here
|
281 |
gchar *defaultDir; |
284 |
gchar *defaultDir; |
282 |
gchar *lastDestination = NULL; |
285 |
gchar *lastDestination = NULL; |
283 |
|
286 |
|
|
|
287 |
gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(object),1); |
288 |
|
284 |
comboModel = gtk_list_store_new(N_DEST_COLUMNS, G_TYPE_STRING, |
289 |
comboModel = gtk_list_store_new(N_DEST_COLUMNS, G_TYPE_STRING, |
285 |
G_TYPE_STRING, G_TYPE_UINT); |
290 |
G_TYPE_STRING, G_TYPE_UINT); |
286 |
gtk_combo_box_set_model(GTK_COMBO_BOX(object), |
291 |
gtk_combo_box_set_model(GTK_COMBO_BOX(object), |
Lines 290-297
static GObject *trg_destination_combo_constructor(GType type,
Link Here
|
290 |
g_signal_connect(object, "changed", |
295 |
g_signal_connect(object, "changed", |
291 |
G_CALLBACK(gtk_combo_box_entry_active_changed), NULL); |
296 |
G_CALLBACK(gtk_combo_box_entry_active_changed), NULL); |
292 |
|
297 |
|
293 |
priv->entry = gtk_entry_new(); |
298 |
//~ priv->entry = gtk_entry_new(); |
294 |
gtk_container_add(GTK_CONTAINER(object), priv->entry); |
299 |
//~ gtk_container_add(GTK_CONTAINER(object), priv->entry); |
295 |
|
300 |
|
296 |
priv->text_renderer = gtk_cell_renderer_text_new(); |
301 |
priv->text_renderer = gtk_cell_renderer_text_new(); |
297 |
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(object), |
302 |
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(object), |
Lines 303-314
static GObject *trg_destination_combo_constructor(GType type,
Link Here
|
303 |
g_slist_foreach(dirs, (GFunc) g_free, NULL); |
308 |
g_slist_foreach(dirs, (GFunc) g_free, NULL); |
304 |
g_slist_free(dirs); |
309 |
g_slist_free(dirs); |
305 |
|
310 |
|
306 |
gtk_entry_set_icon_from_stock(GTK_ENTRY(priv->entry), |
311 |
//~ gtk_entry_set_icon_from_stock(GTK_ENTRY(priv->entry), |
307 |
GTK_ENTRY_ICON_SECONDARY, |
312 |
//~ GTK_ENTRY_ICON_SECONDARY, |
308 |
GTK_STOCK_CLEAR); |
313 |
//~ GTK_STOCK_CLEAR); |
309 |
|
314 |
|
310 |
g_signal_connect(priv->entry, "icon-release", |
315 |
//~ g_signal_connect(GTK_ENTRY(priv->entry), "icon-release", |
311 |
G_CALLBACK(add_entry_cb), object); |
316 |
//~ G_CALLBACK(add_entry_cb), object); |
312 |
|
317 |
|
313 |
defaultDir = |
318 |
defaultDir = |
314 |
g_strdup(session_get_download_dir(trg_client_get_session(client))); |
319 |
g_strdup(session_get_download_dir(trg_client_get_session(client))); |
Lines 453-460
static void trg_destination_combo_init(TrgDestinationCombo * self)
Link Here
|
453 |
GtkWidget *trg_destination_combo_new(TrgClient * client, |
458 |
GtkWidget *trg_destination_combo_new(TrgClient * client, |
454 |
const gchar * lastSelectionKey) |
459 |
const gchar * lastSelectionKey) |
455 |
{ |
460 |
{ |
456 |
return GTK_WIDGET(g_object_new(TRG_TYPE_DESTINATION_COMBO, |
461 |
//~ return GTK_WIDGET(g_object_new(TRG_TYPE_DESTINATION_COMBO, |
|
|
462 |
//~ "trg-client", client, |
463 |
//~ "last-selection-key", lastSelectionKey, |
464 |
//~ NULL)); |
465 |
GtkWidget *gw; |
466 |
GtkEntry *gentry; |
467 |
gw = GTK_WIDGET(g_object_new(TRG_TYPE_DESTINATION_COMBO, |
457 |
"trg-client", client, |
468 |
"trg-client", client, |
458 |
"last-selection-key", lastSelectionKey, |
469 |
"last-selection-key", lastSelectionKey, |
|
|
470 |
"has-entry", TRUE, |
471 |
//~ "entry-text-column", 1, |
459 |
NULL)); |
472 |
NULL)); |
|
|
473 |
gentry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(gw))); |
474 |
gtk_entry_set_text(gentry,session_get_download_dir(trg_client_get_session(client))); |
475 |
gtk_entry_set_icon_from_stock(gentry, |
476 |
GTK_ENTRY_ICON_SECONDARY, |
477 |
GTK_STOCK_CLEAR); |
478 |
|
479 |
g_signal_connect(gentry, "icon-release", |
480 |
G_CALLBACK(add_entry_cb), gw); |
481 |
|
482 |
return gw; |
460 |
} |
483 |
} |