From 2a5cd7714b342b840b0d96c03eb8b94816b1cf87 Mon Sep 17 00:00:00 2001 From: infirit Date: Sun, 23 Nov 2014 14:16:39 +0100 Subject: panel: Add panel_run_dialog_get_combo_text() helper Instead of writing some long line again and again, use a small helper. Taken from gnome-panel commit: 412ac2e4fa6a19c454b7046b9f57b9622a7b97d0 From: Vincent Untz --- mate-panel/panel-run-dialog.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/mate-panel/panel-run-dialog.c b/mate-panel/panel-run-dialog.c index 7e2f17ec..0e9068f8 100644 --- a/mate-panel/panel-run-dialog.c +++ b/mate-panel/panel-run-dialog.c @@ -226,6 +226,16 @@ panel_run_dialog_destroy (PanelRunDialog *dialog) g_free (dialog); } +static const char * +panel_run_dialog_get_combo_text (PanelRunDialog *dialog) +{ + GtkWidget *entry; + + entry = gtk_bin_get_child (GTK_BIN (dialog->combobox)); + + return gtk_entry_get_text (GTK_ENTRY (entry)); +} + static void panel_run_dialog_set_default_icon (PanelRunDialog *dialog, gboolean set_drag) { @@ -417,7 +427,7 @@ panel_run_dialog_execute (PanelRunDialog *dialog) char *disk; char *scheme; - command = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dialog->combobox))))); + command = g_strdup (panel_run_dialog_get_combo_text (dialog)); command = g_strchug (command); if (!command || !command [0]) { @@ -671,7 +681,7 @@ panel_run_dialog_find_command_idle (PanelRunDialog *dialog) return FALSE; } - text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dialog->combobox))))); + text = g_strdup (panel_run_dialog_get_combo_text (dialog)); found_icon = NULL; found_name = NULL; fuzzy = FALSE; @@ -1545,7 +1555,7 @@ combobox_changed (GtkComboBox *combobox, char *start; char *msg; - text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combobox))))); + text = g_strdup (panel_run_dialog_get_combo_text (dialog)); start = text; while (*start != '\0' && g_ascii_isspace (*start)) @@ -1730,7 +1740,7 @@ panel_run_dialog_create_desktop_file (PanelRunDialog *dialog) char *scheme; char *save_uri; - text = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dialog->combobox))))); + text = g_strdup (panel_run_dialog_get_combo_text (dialog)); if (!text || !text [0]) { g_free (text); -- cgit v1.2.1