[gnome-panel/gtk3] panel: Add panel_run_dialog_get_combo_text() helper



commit 412ac2e4fa6a19c454b7046b9f57b9622a7b97d0
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Jan 31 19:12:17 2011 +0100

    panel: Add panel_run_dialog_get_combo_text() helper
    
    Instead of writing some long line again and again, use a small helper.

 gnome-panel/panel-run-dialog.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gnome-panel/panel-run-dialog.c b/gnome-panel/panel-run-dialog.c
index a16ee92..319c48d 100644
--- a/gnome-panel/panel-run-dialog.c
+++ b/gnome-panel/panel-run-dialog.c
@@ -244,6 +244,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)
 {
@@ -423,7 +433,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]) {
@@ -674,7 +684,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;
@@ -1617,7 +1627,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))
@@ -1802,7 +1812,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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]