summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-23 14:16:39 +0100
committerinfirit <[email protected]>2014-11-23 14:16:39 +0100
commit2a5cd7714b342b840b0d96c03eb8b94816b1cf87 (patch)
tree44fb266a85c2037acc50c0fc213490183b306b31
parent6f8e92ebb87b15aa5afb02953964743e599ef619 (diff)
downloadmate-panel-2a5cd7714b342b840b0d96c03eb8b94816b1cf87.tar.bz2
mate-panel-2a5cd7714b342b840b0d96c03eb8b94816b1cf87.tar.xz
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 <[email protected]>
-rw-r--r--mate-panel/panel-run-dialog.c18
1 files 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);