Updating branch refs/heads/master to 28a8049fa005c08eb1d6d1f38844dbd733a061f2 (commit) from 19246a22a8d392b17c72b6b2270c121bfdd82d63 (commit)
commit 28a8049fa005c08eb1d6d1f38844dbd733a061f2 Author: Sean Davis <smd.seanda...@gmail.com> Date: Fri Dec 7 02:25:26 2012 -0500 Replaced Open Network Location dialog. data/interfaces/open-location.ui | 113 +++++++++++++++++++++++-------------- src/parole-open-location.c | 34 +++--------- 2 files changed, 78 insertions(+), 69 deletions(-) diff --git a/data/interfaces/open-location.ui b/data/interfaces/open-location.ui index 31acb0e..80f04c9 100644 --- a/data/interfaces/open-location.ui +++ b/data/interfaces/open-location.ui @@ -2,28 +2,23 @@ <interface> <requires lib="gtk+" version="2.24"/> <!-- interface-naming-policy project-wide --> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-clear</property> - </object> - <object class="GtkImage" id="image3"> + <object class="GtkImage" id="image1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="stock">gtk-clear</property> </object> <object class="GtkDialog" id="open-location"> <property name="can_focus">False</property> - <property name="title" translatable="yes">Open Location</property> + <property name="title" translatable="yes">Open Network Location</property> <property name="modal">True</property> - <property name="default_width">300</property> + <property name="default_width">450</property> <property name="icon_name">parole</property> <property name="type_hint">normal</property> <child internal-child="vbox"> <object class="GtkVBox" id="dialog-vbox1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">2</property> + <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkHButtonBox" id="dialog-action_area1"> <property name="visible">True</property> @@ -50,6 +45,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_action_appearance">False</property> <property name="use_stock">True</property> @@ -60,6 +56,22 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkButton" id="clear-history"> + <property name="label" translatable="yes">Clear History</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> + <property name="image">image1</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">2</property> + <property name="secondary">True</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> @@ -69,66 +81,81 @@ </packing> </child> <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Please enter a network URL:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox2"> + <object class="GtkHBox" id="hbox1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">5</property> + <property name="border_width">12</property> + <property name="spacing">12</property> <child> - <object class="GtkEntry" id="entry"> + <object class="GtkImage" id="image4"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">●</property> - <property name="invisible_char_set">True</property> - <property name="primary_icon_activatable">False</property> - <property name="secondary_icon_activatable">False</property> - <property name="primary_icon_sensitive">True</property> - <property name="secondary_icon_sensitive">True</property> + <property name="can_focus">False</property> + <property name="yalign">0</property> + <property name="pixel_size">48</property> + <property name="icon_name">network-workgroup</property> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> - <property name="padding">5</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkButton" id="clear-history"> + <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_action_appearance">False</property> - <property name="image">image3</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes"><big><b>Open Network Location</b></big></property> + <property name="use_markup">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="has_focus">True</property> + <property name="has_entry">True</property> + <property name="entry_text_column">0</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="expand">True</property> + <property name="fill">True</property> <property name="position">1</property> </packing> </child> </object> <packing> - <property name="expand">True</property> - <property name="fill">False</property> - <property name="position">2</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> + <child> + <placeholder/> + </child> </object> </child> <action-widgets> <action-widget response="-6">cancel</action-widget> <action-widget response="-5">open</action-widget> + <action-widget response="0">clear-history</action-widget> </action-widgets> </object> </interface> diff --git a/src/parole-open-location.c b/src/parole-open-location.c index 7f973be..aeb12f0 100644 --- a/src/parole-open-location.c +++ b/src/parole-open-location.c @@ -73,10 +73,13 @@ static void parole_open_location_response_cb (GtkDialog *dialog, gint response_id, ParoleOpenLocation *self) { const gchar *location; + + if ( response_id == 0 ) + return; if ( response_id == GTK_RESPONSE_OK ) { - location = gtk_entry_get_text (GTK_ENTRY (self->entry)); + location = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(self->entry)); if ( !location || strlen (location) == 0) goto out; @@ -108,10 +111,13 @@ parole_open_location_get_completion_model (void) { for ( i = 0; lines[i]; i++) { + if ( g_strcmp0(lines[i], "") != 0 ) + { gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, COL_ADDRESS, lines [i], -1); + } } g_strfreev (lines); @@ -119,19 +125,6 @@ parole_open_location_get_completion_model (void) return GTK_TREE_MODEL (store); } -static gboolean -parole_open_location_match (GtkEntryCompletion *cmpl, const gchar *key, - GtkTreeIter *iter, gpointer data) -{ - gchar *uri, *match; - - gtk_tree_model_get (data, iter, 0, &uri, -1); - match = strstr (uri, key); - g_free (uri); - - return (match != NULL); -} - static void parole_open_location_class_init (ParoleOpenLocationClass *klass) { @@ -173,7 +166,6 @@ ParoleOpenLocation *parole_open_location (GtkWidget *parent) { ParoleOpenLocation *self; GtkWidget *dialog; - GtkEntryCompletion *cmpl; GtkTreeModel *model; GtkBuilder *builder; @@ -191,17 +183,7 @@ ParoleOpenLocation *parole_open_location (GtkWidget *parent) self->entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry")); model = parole_open_location_get_completion_model (); - gtk_entry_set_activates_default (GTK_ENTRY (self->entry), TRUE); - cmpl = gtk_entry_completion_new (); - - gtk_entry_set_completion (GTK_ENTRY (self->entry), cmpl); - gtk_entry_completion_set_model (cmpl, model); - - gtk_entry_completion_set_text_column (cmpl, 0); - gtk_entry_completion_set_match_func (cmpl, - (GtkEntryCompletionMatchFunc) parole_open_location_match, - model, - NULL); + gtk_combo_box_set_model(GTK_COMBO_BOX(self->entry), model); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits