Index: trunk/src/connect.c
===================================================================
--- trunk/src/connect.c (revision 16)
+++ trunk/src/connect.c (revision 26)
@@ -886,9 +886,6 @@
gtk_box_pack_start (GTK_BOX (hbxProfileLauncher), event, TRUE, TRUE, 0);
optProfileLauncher = gtk_combo_box_new_text();
- gtk_combo_box_append_text (GTK_COMBO_BOX(optProfileLauncher), _("Quick Connect"));
- gtk_combo_box_set_active (GTK_COMBO_BOX(optProfileLauncher), 0);
- g_signal_connect (G_OBJECT (optProfileLauncher), "changed", G_CALLBACK (tsc_quick_pick_activate), NULL);
gtk_container_add (GTK_CONTAINER (event), optProfileLauncher);
hbxFileOps = gtk_hbox_new (TRUE, 0);
@@ -1367,16 +1364,9 @@
rdp_file_get_screen (rdp, main_window);
rdp_file_save (rdp, filename);
g_free (rdp);
- // Add to quick pick list
- lastdelim = g_strrstr (filename, tsc_home_path ());
- if (lastdelim) {
- GtkWidget *opt = lookup_widget (main_window, "optProfileLauncher");
- lastdelim += strlen (home) + 1;
- mi = gtk_menu_item_new_with_label (lastdelim);
- g_signal_connect (G_OBJECT(mi), "activate", G_CALLBACK(tsc_quick_pick_activate), g_strdup (lastdelim));
- gtk_container_add (GTK_CONTAINER(GTK_OPTION_MENU(opt)->menu), mi);
- gtk_widget_show (mi);
- }
+
+ rdp_load_profile_launcher (main_window);
+
// Try to avoid *some* memory leaks
g_free (filename);
g_free (home);
Index: trunk/src/rdpfile.c
===================================================================
--- trunk/src/rdpfile.c (revision 16)
+++ trunk/src/rdpfile.c (revision 26)
@@ -6,6 +6,7 @@
#include <glib.h>
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>
@@ -935,28 +936,44 @@
int rdp_load_profile_launcher (GtkWidget *main_window)
{
- GtkWidget *opt;
- GSList *lptr = NULL;
- gint cnt, ret;
+ GtkComboBox *opt;
+ GSList *lptr = NULL;
+ gchar *text;
+ static gulong handler_id = 0;
+ gint n, i;
#ifdef TSCLIENT_DEBUG
printf ("rdp_load_profile_launcher\n");
#endif
- opt = lookup_widget (main_window, "optProfileLauncher");
- ret = rdp_files_to_list (&lptr);
- cnt = 0;
+ opt = GTK_COMBO_BOX (lookup_widget (main_window, "optProfileLauncher"));
+ if (handler_id != 0)
+ g_signal_handler_disconnect (opt, handler_id);
+
+ n = gtk_tree_model_iter_n_children (gtk_combo_box_get_model (opt),
+ NULL);
+ for (i=0; i<n; i++)
+ gtk_combo_box_remove_text (opt, 0);
+
+ gtk_combo_box_append_text (opt, _("Quick Connect"));
+
+ rdp_files_to_list (&lptr);
+
while (lptr) {
- gtk_combo_box_append_text (GTK_COMBO_BOX(opt), lptr->data);
+ gtk_combo_box_append_text (opt, lptr->data);
g_free (lptr->data);
lptr = lptr->next;
- cnt++;
}
+ gtk_combo_box_set_active (opt, 0);
+ handler_id = g_signal_connect (opt,
+ "changed",
+ G_CALLBACK (tsc_quick_pick_activate),
+ NULL);
+
g_slist_free (lptr);
- gtk_widget_set_sensitive (opt, cnt > 0);
/* complete successfully */
return 0;