[totem/gnome-2-32] Disable Open button in TotemOpenLocation dialog when URI entry is empty
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/gnome-2-32] Disable Open button in TotemOpenLocation dialog when URI entry is empty
- Date: Wed, 4 Aug 2010 15:32:16 +0000 (UTC)
commit a662dbfdfb859f3340e5503dc78b06b301b4a2b6
Author: Alexander Saprykin <xelfium gmail com>
Date: Wed Jun 30 11:53:45 2010 +0400
Disable Open button in TotemOpenLocation dialog when URI entry is empty
Helps: bgo#623127
data/uri.ui | 1 +
src/totem-open-location.c | 11 +++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/data/uri.ui b/data/uri.ui
index 10439d0..3f86cfb 100644
--- a/data/uri.ui
+++ b/data/uri.ui
@@ -25,6 +25,7 @@
<object class="GtkEntry" id="uri">
<property name="visible">True</property>
<property name="activates_default">True</property>
+ <signal name="changed" handler="uri_entry_changed_cb"/>
</object>
<packing>
<property name="position">1</property>
diff --git a/src/totem-open-location.c b/src/totem-open-location.c
index 714f284..8fb4fa7 100644
--- a/src/totem-open-location.c
+++ b/src/totem-open-location.c
@@ -50,6 +50,9 @@ struct TotemOpenLocationPrivate
G_DEFINE_TYPE (TotemOpenLocation, totem_open_location, GTK_TYPE_DIALOG)
+/* GtkBuilder callbacks */
+G_MODULE_EXPORT void uri_entry_changed_cb (GtkEditable *entry, GtkDialog *dialog);
+
static void
totem_open_location_class_init (TotemOpenLocationClass *klass)
{
@@ -143,6 +146,13 @@ totem_open_location_set_from_clipboard (TotemOpenLocation *open_location)
return NULL;
}
+void
+uri_entry_changed_cb (GtkEditable *entry, GtkDialog *dialog)
+{
+ gboolean sensitive = (gtk_entry_get_text_length (GTK_ENTRY (entry)) > 0);
+ gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, sensitive);
+}
+
GtkWidget*
totem_open_location_new (Totem *totem)
{
@@ -165,6 +175,7 @@ totem_open_location_new (Totem *totem)
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (open_location), GTK_RESPONSE_OK, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (open_location), 5);
gtk_dialog_set_default_response (GTK_DIALOG (open_location), GTK_RESPONSE_OK);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]