~ubuntu-branches/ubuntu/oneiric/gnome-panel/oneiric

« back to all changes in this revision

Viewing changes to gnome-panel/panel-run-dialog.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-05-30 11:04:49 UTC
  • mfrom: (1.3.4 upstream)
  • mto: This revision was merged to the branch mainline in revision 204.
  • Revision ID: james.westby@ubuntu.com-20110530110449-ut1tc5t61rpvf9e3
Tags: upstream-3.0.2
ImportĀ upstreamĀ versionĀ 3.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include <glib/gi18n.h>
41
41
#include <gio/gio.h>
42
42
#include <gdk/gdkkeysyms.h>
43
 
#include <gconf/gconf-client.h>
44
43
#include <gmenu-tree.h>
45
44
 
46
 
#define GNOME_DESKTOP_USE_UNSTABLE_API
47
 
#include <libgnome/gnome-desktop-utils.h>
 
45
#include <libgnome-desktop/gnome-desktop-utils.h>
48
46
 
49
47
#include <libpanel-util/panel-error.h>
50
48
#include <libpanel-util/panel-glib.h>
53
51
#include <libpanel-util/panel-show.h>
54
52
 
55
53
#include "nothing.h"
56
 
#include "panel-gconf.h"
57
54
#include "panel-util.h"
58
55
#include "panel-globals.h"
59
56
#include "panel-enums.h"
60
 
#include "panel-profile.h"
61
57
#include "panel-stock-icons.h"
62
58
#include "panel-multiscreen.h"
63
59
#include "menu.h"
64
60
#include "panel-lockdown.h"
65
61
#include "panel-xutils.h"
66
62
#include "panel-icon-names.h"
 
63
#include "panel-schemas.h"
67
64
 
68
65
typedef struct {
69
66
        GtkWidget        *run_dialog;
70
67
 
 
68
        GSettings        *run_settings;
 
69
 
71
70
        GtkWidget        *main_box;
72
 
        GtkWidget        *program_list_box;
73
71
 
74
72
        GtkWidget        *combobox;
75
73
        GtkWidget        *pixmap;
93
91
        int               add_icons_idle_id;
94
92
        int               add_items_idle_id;
95
93
        int               find_command_idle_id;
96
 
        int               content_notify_id;
97
94
        gboolean          use_program_list;
98
95
        gboolean          completion_started;
99
96
        
117
114
 
118
115
static void panel_run_dialog_disconnect_pixmap (PanelRunDialog *dialog);
119
116
 
120
 
#define PANEL_RUN_HISTORY_KEY "/apps/gnome-settings/gnome-panel/history-gnome-run"
121
 
#define PANEL_RUN_MAX_HISTORY 10
 
117
#define PANEL_RUN_MAX_HISTORY 20
122
118
 
123
119
static GtkTreeModel *
124
 
_panel_run_get_recent_programs_list (void)
 
120
_panel_run_get_recent_programs_list (PanelRunDialog *dialog)
125
121
{
126
 
        GtkListStore *list;
127
 
        GSList       *gconf_items;
128
 
        GSList       *command;
129
 
        int           i = 0;
 
122
        GtkListStore  *list;
 
123
        char         **commands;
 
124
        int            i;
130
125
 
131
126
        list = gtk_list_store_new (1, G_TYPE_STRING);
132
127
 
133
 
        gconf_items = gconf_client_get_list (panel_gconf_get_client (),
134
 
                                             PANEL_RUN_HISTORY_KEY,
135
 
                                             GCONF_VALUE_STRING, NULL);
 
128
        commands = g_settings_get_strv (dialog->run_settings,
 
129
                                        PANEL_RUN_HISTORY_KEY);
136
130
 
137
 
        for (command = gconf_items;
138
 
             command && i < PANEL_RUN_MAX_HISTORY;
139
 
             command = command->next) {
 
131
        for (i = 0; commands[i] != NULL; i++) {
140
132
                GtkTreeIter iter;
141
133
                gtk_list_store_prepend (list, &iter);
142
 
                gtk_list_store_set (list, &iter, 0, command->data, -1);
143
 
                i++;
 
134
                gtk_list_store_set (list, &iter, 0, commands[i], -1);
144
135
        }
145
136
 
146
 
        g_slist_free (gconf_items);
 
137
        g_strfreev (commands);
147
138
 
148
139
        return GTK_TREE_MODEL (list);
149
140
}
150
141
 
151
142
static void
152
 
_panel_run_save_recent_programs_list (GtkComboBoxEntry *entry,
153
 
                                      char             *lastcommand)
 
143
_panel_run_save_recent_programs_list (PanelRunDialog *dialog,
 
144
                                      char           *last_command)
154
145
{
155
 
        GtkTreeModel *model;
156
 
        GtkTreeIter   iter;
157
 
        GSList       *gconf_items = NULL;
158
 
        int           i = 0;
159
 
 
160
 
        gconf_items = g_slist_prepend (gconf_items, lastcommand);
161
 
        i++;
162
 
 
163
 
        model = gtk_combo_box_get_model (GTK_COMBO_BOX (entry));
164
 
 
165
 
        if (gtk_tree_model_get_iter_first (model, &iter)) {
166
 
                char *command;
167
 
 
168
 
                do {
169
 
                        gtk_tree_model_get (model, &iter, 0, &command, -1);
170
 
 
171
 
                        if (strcmp (command, lastcommand) == 0)
172
 
                                continue;
173
 
 
174
 
                        gconf_items = g_slist_prepend (gconf_items, command);
175
 
                        i++;
176
 
                } while (gtk_tree_model_iter_next (model, &iter) &&
177
 
                         i < PANEL_RUN_MAX_HISTORY);
178
 
        }
179
 
 
180
 
        gconf_client_set_list (panel_gconf_get_client (),
181
 
                               PANEL_RUN_HISTORY_KEY,
182
 
                               GCONF_VALUE_STRING, gconf_items,
183
 
                               NULL);
184
 
 
185
 
        g_slist_free (gconf_items);
 
146
        char **commands;
 
147
        char **new_commands;
 
148
        int    i;
 
149
        int    size;
 
150
 
 
151
        commands = g_settings_get_strv (dialog->run_settings,
 
152
                                        PANEL_RUN_HISTORY_KEY);
 
153
 
 
154
        /* do not save the same command twice in a row */
 
155
        if (g_strcmp0 (commands[0], last_command) == 0)
 
156
                return;
 
157
 
 
158
        for (i = 0; commands[i] != NULL; i++);
 
159
        size = MIN (i + 1, PANEL_RUN_MAX_HISTORY);
 
160
 
 
161
        new_commands = g_new (char *, size + 1);
 
162
 
 
163
        new_commands[0] = last_command;
 
164
        new_commands[size] = NULL; /* last item */
 
165
 
 
166
        for (i = 1; i < size; i++)
 
167
                new_commands[i] = commands[i-1];
 
168
 
 
169
        g_settings_set_strv (dialog->run_settings,
 
170
                             PANEL_RUN_HISTORY_KEY,
 
171
                             (const char **) new_commands);
 
172
 
 
173
        g_free (new_commands); /* we don't own the strings */
 
174
        g_strfreev (commands);
186
175
}
187
176
 
188
177
static void
192
181
        
193
182
        dialog->changed_id = 0;
194
183
 
195
 
        g_object_unref (dialog->program_list_box);
 
184
        g_object_unref (dialog->list_expander);
196
185
        
197
186
        g_slist_foreach (dialog->add_icon_paths, (GFunc) gtk_tree_path_free, NULL);
198
187
        g_slist_free (dialog->add_icon_paths);
217
206
                g_source_remove (dialog->find_command_idle_id);
218
207
        dialog->find_command_idle_id = 0;
219
208
 
220
 
        if (dialog->content_notify_id)
221
 
                gconf_client_notify_remove (panel_gconf_get_client (),
222
 
                                            dialog->content_notify_id);
223
 
        dialog->content_notify_id = 0;
224
 
 
225
209
        if (dialog->dir_hash)
226
210
                g_hash_table_destroy (dialog->dir_hash);
227
211
        dialog->dir_hash = NULL;
241
225
        dialog->completion = NULL;
242
226
 
243
227
        panel_run_dialog_disconnect_pixmap (dialog);
244
 
        
 
228
 
 
229
        if (dialog->run_settings)
 
230
                g_object_unref (dialog->run_settings);
 
231
        dialog->run_settings = NULL;
 
232
 
245
233
        g_free (dialog);
246
234
}
247
235
 
 
236
static const char *
 
237
panel_run_dialog_get_combo_text (PanelRunDialog *dialog)
 
238
{
 
239
        GtkWidget *entry;
 
240
 
 
241
        entry = gtk_bin_get_child (GTK_BIN (dialog->combobox));
 
242
 
 
243
        return gtk_entry_get_text (GTK_ENTRY (entry));
 
244
}
 
245
 
248
246
static void
249
247
panel_run_dialog_set_default_icon (PanelRunDialog *dialog, gboolean set_drag)
250
248
{
356
354
        return TRUE;
357
355
}
358
356
 
 
357
/*
 
358
 * Set the DISPLAY variable, to be use by g_spawn_async.
 
359
 */
 
360
static void
 
361
set_environment (gpointer display)
 
362
{
 
363
  g_setenv ("DISPLAY", display, TRUE);
 
364
}
 
365
 
359
366
static gboolean
360
367
panel_run_dialog_launch_command (PanelRunDialog *dialog,
361
368
                                 const char     *command,
362
369
                                 const char     *locale_command)
363
370
{
364
371
        GdkScreen  *screen;
365
 
        gboolean    result;     
 
372
        gboolean    result;
366
373
        GError     *error = NULL;
367
374
        char      **argv;
368
375
        int         argc;
369
 
        
 
376
        char    *display;
 
377
 
370
378
        if (!command_is_executable (locale_command, &argc, &argv))
371
379
                return FALSE;
372
380
 
373
 
        screen = gtk_window_get_screen (GTK_WINDOW (dialog->run_dialog));       
374
 
                
 
381
        screen = gtk_window_get_screen (GTK_WINDOW (dialog->run_dialog));
 
382
 
375
383
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->terminal_checkbox)))
376
384
                gnome_desktop_prepend_terminal_to_vector (&argc, &argv);
377
 
                   
378
 
        result = gdk_spawn_on_screen (screen,
379
 
                                      NULL, /* working directory */
380
 
                                      argv,
381
 
                                      NULL, /* envp */
382
 
                                      G_SPAWN_SEARCH_PATH,
383
 
                                      NULL, /* child setup func */
384
 
                                      NULL, /* user data */
385
 
                                      NULL, /* child pid */
386
 
                                      &error);
387
 
                        
 
385
 
 
386
        display = gdk_screen_make_display_name (screen);
 
387
 
 
388
        result = g_spawn_async (NULL, /* working directory */
 
389
                                argv,
 
390
                                NULL, /* envp */
 
391
                                G_SPAWN_SEARCH_PATH,
 
392
                                set_environment,
 
393
                                display,
 
394
                                NULL,
 
395
                                &error);
 
396
 
388
397
        if (!result) {
389
398
                char *primary;
390
399
 
397
406
 
398
407
                g_error_free (error);
399
408
        }
400
 
                                
 
409
 
 
410
        g_free (display);
401
411
        g_strfreev (argv);
402
 
        
 
412
 
403
413
        return result;
404
414
}
405
415
 
412
422
        char     *disk;
413
423
        char     *scheme;       
414
424
        
415
 
        command = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->combobox));
 
425
        command = g_strdup (panel_run_dialog_get_combo_text (dialog));
416
426
        command = g_strchug (command);
417
427
 
418
428
        if (!command || !command [0]) {
427
437
                g_free (command);
428
438
                gtk_widget_destroy (dialog->run_dialog);
429
439
                return;
430
 
        } else if (!strcmp (command, "gegls from outer space")) {
431
 
                start_geginv ();
432
 
 
433
 
                g_free (command);
434
 
                gtk_widget_destroy (dialog->run_dialog);
435
 
                return;
436
440
        }
437
441
                
438
442
        error = NULL;
478
482
                
479
483
        if (result) {
480
484
                /* only save working commands in history */
481
 
                _panel_run_save_recent_programs_list
482
 
                        (GTK_COMBO_BOX_ENTRY (dialog->combobox), command);
 
485
                _panel_run_save_recent_programs_list (dialog, command);
483
486
                
484
487
                /* only close the dialog if we successfully showed or launched
485
488
                 * something */
538
541
panel_run_dialog_append_file_utf8 (PanelRunDialog *dialog,
539
542
                                   const char     *file)
540
543
{
541
 
        char       *text;
 
544
        const char *text;
542
545
        char       *quoted, *temp;
543
546
        GtkWidget  *entry;
544
547
        
548
551
        
549
552
        quoted = quote_string (file);
550
553
        entry = gtk_bin_get_child (GTK_BIN (dialog->combobox));
551
 
        text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->combobox));
 
554
        text = gtk_entry_get_text (GTK_ENTRY (entry));
552
555
        if (text && text [0]) {
553
556
                temp = g_strconcat (text, " ", quoted, NULL);
554
557
                gtk_entry_set_text (GTK_ENTRY (entry), temp);
556
559
        } else
557
560
                gtk_entry_set_text (GTK_ENTRY (entry), quoted);
558
561
        
559
 
        g_free (text);
560
562
        g_free (quoted);
561
563
}
562
564
 
664
666
                return FALSE;
665
667
        }
666
668
 
667
 
        text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->combobox));
 
669
        text = g_strdup (panel_run_dialog_get_combo_text (dialog));
668
670
        found_icon = NULL;
669
671
        found_name = NULL;
670
672
        fuzzy = FALSE;
1128
1130
        GtkTreeSelection *selection;
1129
1131
        
1130
1132
        dialog->program_list = PANEL_GTK_BUILDER_GET (gui, "program_list");
1131
 
        dialog->program_list_box = PANEL_GTK_BUILDER_GET (gui, "program_list_box");
1132
1133
        dialog->program_label = PANEL_GTK_BUILDER_GET (gui, "program_label");
1133
1134
        dialog->main_box = PANEL_GTK_BUILDER_GET (gui, "main_box");
1134
1135
        
1135
 
        /* Ref the box so it doesn't get destroyed when it is
1136
 
         * removed from the visible area of the dialog box.
1137
 
         */
1138
 
        g_object_ref (dialog->program_list_box);
1139
 
        
1140
 
        if (panel_profile_get_enable_program_list ()) {
1141
 
                selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->program_list));
1142
 
                gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
1143
 
 
1144
 
                g_signal_connect (selection, "changed",
1145
 
                                  G_CALLBACK (program_list_selection_changed),
1146
 
                                  dialog);
1147
 
 
1148
 
                g_signal_connect (dialog->program_list, "row-activated",
1149
 
                                  G_CALLBACK (program_list_selection_activated),
1150
 
                                  dialog);
1151
 
 
1152
 
                /* start loading the list of applications */
1153
 
                dialog->add_items_idle_id = 
1154
 
                        g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc) panel_run_dialog_add_items_idle, 
1155
 
                                         dialog, NULL);
1156
 
        }
1157
 
}
1158
 
 
1159
 
static void
1160
 
panel_run_dialog_update_content (PanelRunDialog *dialog,
1161
 
                                 gboolean        show_list)
1162
 
{
1163
 
        if (!panel_profile_get_enable_program_list ()) {
1164
 
                GtkWidget *parent;
1165
 
 
1166
 
                parent = gtk_widget_get_parent (dialog->list_expander);
 
1136
        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->program_list));
 
1137
        gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
 
1138
 
 
1139
        g_signal_connect (selection, "changed",
 
1140
                          G_CALLBACK (program_list_selection_changed),
 
1141
                          dialog);
 
1142
 
 
1143
        g_signal_connect (dialog->program_list, "row-activated",
 
1144
                          G_CALLBACK (program_list_selection_activated),
 
1145
                          dialog);
 
1146
}
 
1147
 
 
1148
static void
 
1149
panel_run_dialog_setup_list_expander (PanelRunDialog *dialog,
 
1150
                                      GtkBuilder     *gui)
 
1151
{
 
1152
        dialog->list_expander = PANEL_GTK_BUILDER_GET (gui, "list_expander");
 
1153
 
 
1154
        /* Ref the expander so it doesn't get destroyed when it is
 
1155
         * removed from the visible area of the dialog box. */
 
1156
        g_object_ref (dialog->list_expander);
 
1157
 
 
1158
        g_settings_bind (dialog->run_settings,
 
1159
                         PANEL_RUN_SHOW_LIST_KEY,
 
1160
                         dialog->list_expander,
 
1161
                         "expanded",
 
1162
                         G_SETTINGS_BIND_DEFAULT);
 
1163
}
 
1164
 
 
1165
static void
 
1166
panel_run_dialog_update_program_list (GSettings      *settings,
 
1167
                                      char           *key,
 
1168
                                      PanelRunDialog *dialog)
 
1169
{
 
1170
        gboolean   enabled;
 
1171
        gboolean   shown;
 
1172
        GtkWidget *parent;
 
1173
 
 
1174
        enabled = g_settings_get_boolean (dialog->run_settings,
 
1175
                                          PANEL_RUN_ENABLE_LIST_KEY);
 
1176
 
 
1177
        parent = gtk_widget_get_parent (dialog->list_expander);
 
1178
 
 
1179
        if (enabled) {
 
1180
                if (dialog->program_list_store == NULL) {
 
1181
                        /* start loading the list of applications */
 
1182
                        dialog->add_items_idle_id =
 
1183
                                g_idle_add_full (G_PRIORITY_LOW,
 
1184
                                                 (GSourceFunc) panel_run_dialog_add_items_idle,
 
1185
                                                 dialog, NULL);
 
1186
                }
 
1187
 
 
1188
                if (!parent)
 
1189
                        gtk_box_pack_end (GTK_BOX (dialog->main_box),
 
1190
                                          dialog->list_expander,
 
1191
                                          TRUE, TRUE, 0);
 
1192
        } else {
1167
1193
                if (parent)
1168
1194
                        gtk_container_remove (GTK_CONTAINER (parent),
1169
1195
                                              dialog->list_expander);
1170
 
 
1171
 
                gtk_window_set_resizable (GTK_WINDOW (dialog->run_dialog), FALSE);
1172
 
                gtk_widget_grab_focus (dialog->combobox);
1173
 
                
1174
 
        } else if (show_list) {
 
1196
        }
 
1197
 
 
1198
        shown = g_settings_get_boolean (dialog->run_settings,
 
1199
                                        PANEL_RUN_SHOW_LIST_KEY);
 
1200
 
 
1201
        if (enabled && shown) {
1175
1202
                gtk_window_resize (GTK_WINDOW (dialog->run_dialog), 100, 300);
1176
1203
                gtk_window_set_resizable (GTK_WINDOW (dialog->run_dialog), TRUE);
1177
1204
                gtk_widget_grab_focus (dialog->program_list);
1178
 
                
1179
 
        } else if (!show_list) {
 
1205
        } else {
1180
1206
                gtk_window_set_resizable (GTK_WINDOW (dialog->run_dialog), FALSE);
1181
1207
                gtk_widget_grab_focus (dialog->combobox);
1182
 
        }
1183
 
}
1184
 
 
1185
 
static void
1186
 
panel_run_dialog_content_notify (GConfClient    *client,
1187
 
                                 int             notify_id,
1188
 
                                 GConfEntry     *entry,
1189
 
                                 PanelRunDialog *dialog)
1190
 
{
1191
 
        panel_run_dialog_update_content (dialog, gconf_value_get_bool (entry->value));
1192
 
}
1193
 
 
1194
 
static void
1195
 
list_expander_toggled (GtkExpander    *expander,
1196
 
                       GParamSpec     *pspec,
1197
 
                       PanelRunDialog *dialog)
1198
 
{
1199
 
        panel_profile_set_show_program_list (gtk_expander_get_expanded (expander));
1200
 
}
1201
 
 
1202
 
static void
1203
 
panel_run_dialog_setup_list_expander (PanelRunDialog *dialog,
1204
 
                                      GtkBuilder     *gui)
1205
 
{
1206
 
        GConfClient *client;
1207
 
        const char *key;
1208
 
        
1209
 
        dialog->list_expander = PANEL_GTK_BUILDER_GET (gui, "list_expander");
1210
 
 
1211
 
        if (panel_profile_get_enable_program_list ()) {
1212
 
                gtk_expander_set_expanded (GTK_EXPANDER (dialog->list_expander),
1213
 
                                           panel_profile_get_show_program_list ());
1214
 
 
1215
 
                if ( ! panel_profile_is_writable_show_program_list ())
1216
 
                        gtk_widget_set_sensitive (dialog->list_expander, FALSE);
1217
 
                
1218
 
                g_signal_connect (dialog->list_expander, "notify::expanded",
1219
 
                                  G_CALLBACK (list_expander_toggled),
1220
 
                                  dialog);
1221
 
        
1222
 
                client = panel_gconf_get_client ();
1223
 
                key = panel_gconf_general_key ("show_program_list");
1224
 
        
1225
 
                dialog->content_notify_id =
1226
 
                        gconf_client_notify_add (client, key,
1227
 
                                                 (GConfClientNotifyFunc) panel_run_dialog_content_notify,
1228
 
                                                 dialog, NULL, NULL);
1229
 
                                         
1230
 
                if (!dialog->content_notify_id)
1231
 
                        g_warning ("error setting up content change notification");
1232
1208
        }
1233
1209
}
1234
1210
 
1507
1483
        selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->program_list));
1508
1484
        gtk_tree_selection_unselect_all (selection);
1509
1485
 
1510
 
        if (!panel_profile_get_enable_autocompletion ())
 
1486
        if (!g_settings_get_boolean (dialog->run_settings,
 
1487
                                     PANEL_RUN_ENABLE_COMPLETION_KEY))
1511
1488
                return FALSE;
1512
1489
 
1513
1490
        /* tab completion */
1514
 
        if (event->keyval == GDK_Tab) {
 
1491
        if (event->keyval == GDK_KEY_Tab) {
1515
1492
                gtk_editable_get_selection_bounds (entry, &pos, &tmp);
1516
1493
 
1517
1494
                if (dialog->completion_started &&
1603
1580
combobox_changed (GtkComboBox    *combobox,
1604
1581
                  PanelRunDialog *dialog)
1605
1582
{
1606
 
        char *text;
1607
 
        char *start;
1608
 
        char *msg;
1609
 
 
1610
 
        text = gtk_combo_box_get_active_text (combobox);
 
1583
        gboolean  program_list_enabled;
 
1584
        char     *text;
 
1585
        char     *start;
 
1586
        char     *msg;
 
1587
 
 
1588
        program_list_enabled = g_settings_get_boolean (dialog->run_settings,
 
1589
                                                       PANEL_RUN_ENABLE_LIST_KEY);
 
1590
 
 
1591
        text = g_strdup (panel_run_dialog_get_combo_text (dialog));
1611
1592
 
1612
1593
        start = text;
1613
1594
        while (*start != '\0' && g_ascii_isspace (*start))
1632
1613
                gtk_widget_set_sensitive (dialog->run_button, FALSE);
1633
1614
                gtk_drag_source_unset (dialog->run_dialog);
1634
1615
 
1635
 
                if (panel_profile_get_enable_program_list ())
 
1616
                if (program_list_enabled)
1636
1617
                        gtk_label_set_text (GTK_LABEL (dialog->program_label),
1637
1618
                                            _("Select an application to view its description."));
1638
1619
 
1643
1624
                        dialog->find_command_idle_id = 0;
1644
1625
                }
1645
1626
 
1646
 
                if (panel_profile_get_enable_program_list ()) {
 
1627
                if (program_list_enabled) {
1647
1628
                        GtkTreeIter  iter;
1648
1629
                        GtkTreePath *path;
1649
1630
 
1670
1651
                             GDK_ACTION_COPY);
1671
1652
        gtk_drag_source_add_uri_targets (dialog->run_dialog);
1672
1653
 
1673
 
        if (panel_profile_get_enable_program_list () &&
 
1654
        if (program_list_enabled &&
1674
1655
            !dialog->use_program_list) {
1675
1656
                msg = g_strdup_printf (_("Will run command: '%s'"),
1676
1657
                                       start);
1679
1660
        }
1680
1661
        
1681
1662
        /* look up icon for the command */
1682
 
        if (panel_profile_get_enable_program_list () &&
 
1663
        if (program_list_enabled &&
1683
1664
            !dialog->use_program_list &&
1684
1665
            !dialog->find_command_idle_id)
1685
1666
                dialog->find_command_idle_id =
1750
1731
        gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
1751
1732
 
1752
1733
        gtk_combo_box_set_model (GTK_COMBO_BOX (dialog->combobox),
1753
 
                                 _panel_run_get_recent_programs_list ());
1754
 
        gtk_combo_box_entry_set_text_column
1755
 
                (GTK_COMBO_BOX_ENTRY (dialog->combobox), 0);
 
1734
                                 _panel_run_get_recent_programs_list (dialog));
 
1735
        gtk_combo_box_set_entry_text_column
 
1736
                (GTK_COMBO_BOX (dialog->combobox), 0);
1756
1737
 
1757
1738
        screen = gtk_window_get_screen (GTK_WINDOW (dialog->run_dialog));
1758
1739
 
1792
1773
        char     *scheme;
1793
1774
        char     *save_uri;
1794
1775
 
1795
 
        text = gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->combobox));
 
1776
        text = g_strdup (panel_run_dialog_get_combo_text (dialog));
1796
1777
        
1797
1778
        if (!text || !text [0]) {
1798
1779
                g_free (text);
1881
1862
}
1882
1863
 
1883
1864
static void
1884
 
panel_run_dialog_style_set (GtkWidget      *widget,
1885
 
                            GtkStyle       *prev_style,
1886
 
                            PanelRunDialog *dialog)
 
1865
panel_run_dialog_style_updated (GtkWidget      *widget,
 
1866
                                PanelRunDialog *dialog)
1887
1867
{
1888
1868
  if (dialog->icon_path) {
1889
1869
          char *icon_path;
1914
1894
{
1915
1895
        dialog->pixmap = PANEL_GTK_BUILDER_GET (gui, "icon_pixmap");
1916
1896
        
1917
 
        g_signal_connect (dialog->pixmap, "style-set",
1918
 
                          G_CALLBACK (panel_run_dialog_style_set),
 
1897
        g_signal_connect (dialog->pixmap, "style-updated",
 
1898
                          G_CALLBACK (panel_run_dialog_style_updated),
1919
1899
                          dialog);
1920
1900
        g_signal_connect (dialog->pixmap, "screen-changed",
1921
1901
                          G_CALLBACK (panel_run_dialog_screen_changed),
1936
1916
        dialog = g_new0 (PanelRunDialog, 1);
1937
1917
 
1938
1918
        dialog->run_dialog = PANEL_GTK_BUILDER_GET (gui, "panel_run_dialog");
 
1919
 
 
1920
        dialog->run_settings = g_settings_new (PANEL_RUN_SCHEMA);
1939
1921
        
1940
1922
        g_signal_connect_swapped (dialog->run_dialog, "response",
1941
1923
                                  G_CALLBACK (panel_run_dialog_response), dialog);
1954
1936
 
1955
1937
        panel_run_dialog_set_default_icon    (dialog, FALSE);
1956
1938
 
1957
 
        panel_run_dialog_update_content (dialog, panel_profile_get_show_program_list ());
 
1939
        g_signal_connect (dialog->run_settings, "changed::"PANEL_RUN_ENABLE_LIST_KEY,
 
1940
                          G_CALLBACK (panel_run_dialog_update_program_list), dialog);
 
1941
        g_signal_connect (dialog->run_settings, "changed::"PANEL_RUN_SHOW_LIST_KEY,
 
1942
                          G_CALLBACK (panel_run_dialog_update_program_list), dialog);
 
1943
 
 
1944
        panel_run_dialog_update_program_list (dialog->run_settings, NULL, dialog);
1958
1945
 
1959
1946
        gtk_widget_set_sensitive (dialog->run_button, FALSE);
1960
1947
        
1976
1963
panel_run_dialog_disconnect_pixmap (PanelRunDialog *dialog)
1977
1964
{
1978
1965
        g_signal_handlers_disconnect_by_func (dialog->pixmap,
1979
 
                                              G_CALLBACK (panel_run_dialog_style_set),
 
1966
                                              G_CALLBACK (panel_run_dialog_style_updated),
1980
1967
                                              dialog);
1981
1968
        g_signal_handlers_disconnect_by_func (dialog->pixmap,
1982
1969
                                              G_CALLBACK (panel_run_dialog_screen_changed),
1997
1984
        GtkBuilder *gui;
1998
1985
        GError     *error;
1999
1986
 
2000
 
        if (panel_lockdown_get_disable_command_line ())
 
1987
        if (panel_lockdown_get_disable_command_line_s ())
2001
1988
                return;
2002
1989
 
2003
1990
        if (static_dialog) {