[nautilus-actions] Doucle-click validates the Add capability dialog
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Doucle-click validates the Add capability dialog
- Date: Sat, 3 Jul 2010 11:37:57 +0000 (UTC)
commit e2b2a06fafa5af5e139bab9aaf9c7ec10c2188bd
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Jul 3 13:37:29 2010 +0200
Doucle-click validates the Add capability dialog
ChangeLog | 3 ++
TODO | 2 -
src/nact/nact-add-capability-dialog.c | 36 ++++++++++++++++++++++++++++++--
3 files changed, 36 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 479ab0c..d000b7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2010-07-03 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-add-capability-dialog.c (on_base_runtime_init_dialog):
+ Doucle-click validates the dialog.
+
* src/nact/nact-add-scheme-dialog.c (on_base_runtime_init_dialog):
Doucle-click validates the dialog.
diff --git a/TODO b/TODO
index 6250d44..97f0f2e 100644
--- a/TODO
+++ b/TODO
@@ -499,7 +499,5 @@ 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 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-capability-dialog.c b/src/nact/nact-add-capability-dialog.c
index 1d90dc7..05fbfd7 100644
--- a/src/nact/nact-add-capability-dialog.c
+++ b/src/nact/nact-add-capability-dialog.c
@@ -32,6 +32,7 @@
#include <config.h>
#endif
+#include <gdk/gdkkeysyms.h>
#include <glib/gi18n.h>
#include <api/na-core-utils.h>
@@ -92,6 +93,7 @@ static gchar *base_get_ui_filename( const BaseWindow *dialog );
static void on_base_initial_load_dialog( NactAddCapabilityDialog *editor, gpointer user_data );
static void on_base_runtime_init_dialog( NactAddCapabilityDialog *editor, gpointer user_data );
static void on_base_all_widgets_showed( NactAddCapabilityDialog *editor, gpointer user_data );
+static gboolean on_button_press_event( GtkWidget *widget, GdkEventButton *event, NactAddCapabilityDialog *editor );
static void on_cancel_clicked( GtkButton *button, NactAddCapabilityDialog *editor );
static void on_ok_clicked( GtkButton *button, NactAddCapabilityDialog *editor );
static void on_selection_changed( GtkTreeSelection *selection, BaseWindow *window );
@@ -99,6 +101,7 @@ static void display_keyword( GtkTreeViewColumn *column, GtkCellRenderer *cel
static void display_description( GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, BaseWindow *window );
static void display_label( GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, BaseWindow *window, guint column_id );
static gboolean setup_values_iter( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter* iter, GSList *capabilities );
+static void send_ok( NactAddCapabilityDialog *dialog );
static void validate_dialog( NactAddCapabilityDialog *editor );
static gboolean base_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
@@ -389,6 +392,13 @@ on_base_runtime_init_dialog( NactAddCapabilityDialog *dialog, gpointer user_data
gtk_tree_model_foreach( GTK_TREE_MODEL( model ), ( GtkTreeModelForeachFunc ) setup_values_iter, 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 ));
+
base_window_signal_connect(
BASE_WINDOW( dialog ),
G_OBJECT( gtk_tree_view_get_selection( listview )),
@@ -431,6 +441,20 @@ on_base_all_widgets_showed( NactAddCapabilityDialog *dialog, gpointer user_data
}
}
+static gboolean
+on_button_press_event( GtkWidget *widget, GdkEventButton *event, NactAddCapabilityDialog *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, NactAddCapabilityDialog *dialog )
{
@@ -442,9 +466,7 @@ on_cancel_clicked( GtkButton *button, NactAddCapabilityDialog *dialog )
static void
on_ok_clicked( GtkButton *button, NactAddCapabilityDialog *dialog )
{
- GtkWindow *toplevel = base_window_get_toplevel( BASE_WINDOW( dialog ));
-
- gtk_dialog_response( GTK_DIALOG( toplevel ), GTK_RESPONSE_OK );
+ send_ok( dialog );
}
static void
@@ -517,6 +539,14 @@ setup_values_iter( GtkTreeModel *model, GtkTreePath *path, GtkTreeIter* iter, GS
}
static void
+send_ok( NactAddCapabilityDialog *dialog )
+{
+ GtkWindow *toplevel = base_window_get_toplevel( BASE_WINDOW( dialog ));
+
+ gtk_dialog_response( GTK_DIALOG( toplevel ), GTK_RESPONSE_OK );
+}
+
+static void
validate_dialog( NactAddCapabilityDialog *dialog )
{
GtkTreeView *listview;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]