[nautilus-actions] Doucle-click validates the Add scheme dialog
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Doucle-click validates the Add scheme dialog
- Date: Sat, 3 Jul 2010 11:37:51 +0000 (UTC)
commit 80025ab4db94b6b816f564ff00d18cb4b58f42b1
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Jul 3 13:32:43 2010 +0200
Doucle-click validates the Add scheme dialog
ChangeLog | 3 ++
TODO | 2 -
src/nact/nact-add-scheme-dialog.c | 39 +++++++++++++++++++++++++++++++++---
3 files changed, 38 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index eec0d1f..479ab0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2010-07-03 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-add-scheme-dialog.c (on_base_runtime_init_dialog):
+ Doucle-click validates the dialog.
+
* src/nact/nact-schemes-list.c (nact_schemes_list_create_model):
Scheme keyword and description are editable in user preferences.
diff --git a/TODO b/TODO
index 546285a..6250d44 100644
--- a/TODO
+++ b/TODO
@@ -499,8 +499,6 @@ Parameter Description
- 2010-07-02: bug 'wipe selected' action has a '%M' parameter which should have been converted at import time
-- 2010-07-02: adding a scheme from defaults: double-click should select and validate the scheme
-
- 2010-07-02: adding a capability: double-click should select and validate the capability
- 2010-07-02: legend dialog: may be closed with the legend button kept toggled -> inconsistency
diff --git a/src/nact/nact-add-scheme-dialog.c b/src/nact/nact-add-scheme-dialog.c
index 1491d8b..cff20dd 100644
--- a/src/nact/nact-add-scheme-dialog.c
+++ b/src/nact/nact-add-scheme-dialog.c
@@ -32,6 +32,8 @@
#include <config.h>
#endif
+#include <gdk/gdkkeysyms.h>
+
#include <api/na-core-utils.h>
#include "nact-schemes-list.h"
@@ -67,11 +69,13 @@ static gchar *base_get_ui_filename( const BaseWindow *dialog );
static void on_base_initial_load_dialog( NactAddSchemeDialog *editor, gpointer user_data );
static void on_base_runtime_init_dialog( NactAddSchemeDialog *editor, gpointer user_data );
static void on_base_all_widgets_showed( NactAddSchemeDialog *editor, gpointer user_data );
+static gboolean on_button_press_event( GtkWidget *widget, GdkEventButton *event, NactAddSchemeDialog *dialog );
static void on_cancel_clicked( GtkButton *button, NactAddSchemeDialog *editor );
static void on_ok_clicked( GtkButton *button, NactAddSchemeDialog *editor );
static void on_selection_changed( const gchar *scheme, gboolean used, NactAddSchemeDialog *dialog );
-static gboolean base_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
+static void send_ok( NactAddSchemeDialog *dialog );
static void validate_dialog( NactAddSchemeDialog *editor );
+static gboolean base_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
GType
nact_add_scheme_dialog_get_type( void )
@@ -315,6 +319,13 @@ on_base_runtime_init_dialog( NactAddSchemeDialog *dialog, gpointer user_data )
nact_schemes_list_setup_values( BASE_WINDOW( dialog ), dialog->private->already_used );
+ /* catch double-click */
+ base_window_signal_connect(
+ BASE_WINDOW( dialog ),
+ G_OBJECT( listview ),
+ "button-press-event",
+ G_CALLBACK( on_button_press_event ));
+
/* dialog buttons
*/
base_window_signal_connect_by_name(
@@ -345,6 +356,20 @@ on_base_all_widgets_showed( NactAddSchemeDialog *dialog, gpointer user_data )
}
}
+static gboolean
+on_button_press_event( GtkWidget *widget, GdkEventButton *event, NactAddSchemeDialog *dialog )
+{
+ gboolean stop = FALSE;
+
+ /* double-click of left button */
+ if( event->type == GDK_2BUTTON_PRESS && event->button == 1 ){
+ send_ok( dialog );
+ stop = TRUE;
+ }
+
+ return( stop );
+}
+
static void
on_cancel_clicked( GtkButton *button, NactAddSchemeDialog *dialog )
{
@@ -356,9 +381,7 @@ on_cancel_clicked( GtkButton *button, NactAddSchemeDialog *dialog )
static void
on_ok_clicked( GtkButton *button, NactAddSchemeDialog *dialog )
{
- GtkWindow *toplevel = base_window_get_toplevel( BASE_WINDOW( dialog ));
-
- gtk_dialog_response( GTK_DIALOG( toplevel ), GTK_RESPONSE_OK );
+ send_ok( dialog );
}
/*
@@ -375,6 +398,14 @@ on_selection_changed( const gchar *scheme, gboolean used, NactAddSchemeDialog *d
}
static void
+send_ok( NactAddSchemeDialog *dialog )
+{
+ GtkWindow *toplevel = base_window_get_toplevel( BASE_WINDOW( dialog ));
+
+ gtk_dialog_response( GTK_DIALOG( toplevel ), GTK_RESPONSE_OK );
+}
+
+static void
validate_dialog( NactAddSchemeDialog *dialog )
{
dialog->private->scheme = nact_schemes_list_get_current_scheme( BASE_WINDOW( dialog ));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]