[nautilus-actions] Prevent inline edition of capabilities
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Prevent inline edition of capabilities
- Date: Tue, 27 Jul 2010 21:47:18 +0000 (UTC)
commit 79b707111a1f67a637e7902dc9c81defd4c12124
Author: Pierre Wieser <pwieser trychlos org>
Date: Mon Jul 26 21:37:17 2010 +0200
Prevent inline edition of capabilities
ChangeLog | 15 +++++++++++++
src/nact/nact-ibasenames-tab.c | 2 +-
src/nact/nact-icapabilities-tab.c | 2 +-
src/nact/nact-ifolders-tab.c | 2 +-
src/nact/nact-imimetypes-tab.c | 2 +-
src/nact/nact-ischemes-tab.c | 2 +-
src/nact/nact-match-list.c | 41 ++++++++++++++++++++----------------
src/nact/nact-match-list.h | 7 ++++-
8 files changed, 48 insertions(+), 25 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0b38564..d6d5e3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2010-07-26 Pierre Wieser <pwieser trychlos org>
+ Prevent of inline edition of capabilities.
+
+ * src/nact/nact-match-list.c:
+ * src/nact/nact-match-list.h (nact_match_list_create_model):
+ Add editable_filter input parameter.
+
+ * src/nact/nact-match-list.c (nact_match_list_on_selection_changed):
+ Only enable the column if filter and item are both editable.
+
+ * src/nact/nact-ibasenames-tab.c:
+ * src/nact/nact-icapabilities-tab.c:
+ * src/nact/nact-ifolders-tab.c:
+ * src/nact/nact-imimetypes-tab.c:
+ * src/nact/nact-ischemes-tab.c: Updated accordingly.
+
Prevent a capability to be inserted twice.
* src/nact/nact-add-capability-dialog.c (on_button_press_event):
diff --git a/src/nact/nact-ibasenames-tab.c b/src/nact/nact-ibasenames-tab.c
index 7d9a4e7..d898e44 100644
--- a/src/nact/nact-ibasenames-tab.c
+++ b/src/nact/nact-ibasenames-tab.c
@@ -162,7 +162,7 @@ nact_ibasenames_tab_initial_load_toplevel( NactIBasenamesTab *instance )
( pset_filters ) set_basenames,
NULL,
MATCH_LIST_MUST_MATCH_ONE_OF,
- _( "Basename filter" ));
+ _( "Basename filter" ), TRUE );
}
}
diff --git a/src/nact/nact-icapabilities-tab.c b/src/nact/nact-icapabilities-tab.c
index 6675a80..a0ed424 100644
--- a/src/nact/nact-icapabilities-tab.c
+++ b/src/nact/nact-icapabilities-tab.c
@@ -155,7 +155,7 @@ nact_icapabilities_tab_initial_load_toplevel( NactICapabilitiesTab *instance )
( pset_filters ) set_capabilities,
( pon_add_cb ) on_add_clicked,
MATCH_LIST_MUST_MATCH_ALL_OF,
- _( "Capability filter" ));
+ _( "Capability filter" ), FALSE );
}
}
diff --git a/src/nact/nact-ifolders-tab.c b/src/nact/nact-ifolders-tab.c
index b823b08..1822c1d 100644
--- a/src/nact/nact-ifolders-tab.c
+++ b/src/nact/nact-ifolders-tab.c
@@ -167,7 +167,7 @@ nact_ifolders_tab_initial_load_toplevel( NactIFoldersTab *instance )
( pset_filters ) set_folders,
NULL,
MATCH_LIST_MUST_MATCH_ONE_OF,
- _( "Folder filter" ));
+ _( "Folder filter" ), TRUE );
}
}
diff --git a/src/nact/nact-imimetypes-tab.c b/src/nact/nact-imimetypes-tab.c
index 1015eb6..2928ae1 100644
--- a/src/nact/nact-imimetypes-tab.c
+++ b/src/nact/nact-imimetypes-tab.c
@@ -160,7 +160,7 @@ nact_imimetypes_tab_initial_load_toplevel( NactIMimetypesTab *instance )
( pset_filters ) set_mimetypes,
NULL,
MATCH_LIST_MUST_MATCH_ONE_OF,
- _( "Mimetype filter" ));
+ _( "Mimetype filter" ), TRUE );
}
}
diff --git a/src/nact/nact-ischemes-tab.c b/src/nact/nact-ischemes-tab.c
index eca15a6..3a61dd9 100644
--- a/src/nact/nact-ischemes-tab.c
+++ b/src/nact/nact-ischemes-tab.c
@@ -158,7 +158,7 @@ nact_ischemes_tab_initial_load_toplevel( NactISchemesTab *instance )
( pset_filters ) set_schemes,
NULL,
MATCH_LIST_MUST_MATCH_ONE_OF,
- _( "Scheme filter" ));
+ _( "Scheme filter" ), TRUE );
}
}
diff --git a/src/nact/nact-match-list.c b/src/nact/nact-match-list.c
index 1811aed..06384f4 100644
--- a/src/nact/nact-match-list.c
+++ b/src/nact/nact-match-list.c
@@ -110,7 +110,8 @@ nact_match_list_create_model( BaseWindow *window,
GtkWidget *listview, GtkWidget *addbutton, GtkWidget *removebutton,
pget_filters pget, pset_filters pset, pon_add_cb pon_add,
guint match_header,
- const gchar *item_header )
+ const gchar *item_header,
+ gboolean editable_filter )
{
MatchListStr *data;
GtkListStore *model;
@@ -129,7 +130,8 @@ nact_match_list_create_model( BaseWindow *window,
data->pon_add = pon_add;
data->match_header = match_header;
data->item_header = g_strdup( item_header );
- data->editable = FALSE;
+ data->editable_filter = editable_filter;
+ data->editable_item = FALSE;
data->sort_column = 0;
data->sort_order = 0;
g_object_set_data( G_OBJECT( window ), tab_name, data );
@@ -158,8 +160,7 @@ nact_match_list_create_model( BaseWindow *window,
radio_cell = gtk_cell_renderer_toggle_new();
gtk_cell_renderer_toggle_set_radio( GTK_CELL_RENDERER_TOGGLE( radio_cell ), TRUE );
column = gtk_tree_view_column_new_with_attributes(
- /* i18n: label of the header of a column which let the user select a negative filter
- */
+ /* i18n: label of the header of a column which let the user select a negative filter */
_( "Must not match any of" ),
radio_cell,
"active", MUST_NOT_MATCH_COLUMN,
@@ -205,13 +206,15 @@ nact_match_list_init_view( BaseWindow *window, const gchar *tab_name )
G_CALLBACK( on_filter_clicked ),
data );
- renderers = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( column ));
- base_window_signal_connect_with_data(
- window,
- G_OBJECT( renderers->data ),
- "edited",
- G_CALLBACK( on_filter_edited ),
- data );
+ if( data->editable_filter ){
+ renderers = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( column ));
+ base_window_signal_connect_with_data(
+ window,
+ G_OBJECT( renderers->data ),
+ "edited",
+ G_CALLBACK( on_filter_edited ),
+ data );
+ }
column = gtk_tree_view_get_column( data->listview, MUST_MATCH_COLUMN );
base_window_signal_connect_with_data(
@@ -321,7 +324,7 @@ nact_match_list_on_selection_changed( BaseWindow *window, const gchar *tab_name,
data = ( MatchListStr * ) g_object_get_data( G_OBJECT( window ), tab_name );
g_return_if_fail( data != NULL );
- context = nact_main_tab_get_context( NACT_MAIN_WINDOW( window ), &data->editable );
+ context = nact_main_tab_get_context( NACT_MAIN_WINDOW( window ), &data->editable_item );
enable_tab = ( context != NULL );
nact_main_tab_enable_page( NACT_MAIN_WINDOW( data->window ), data->tab_id, enable_tab );
@@ -342,10 +345,10 @@ nact_match_list_on_selection_changed( BaseWindow *window, const gchar *tab_name,
}
column = gtk_tree_view_get_column( data->listview, ITEM_COLUMN );
- nact_gtk_utils_set_editable( GTK_OBJECT( column ), data->editable );
+ nact_gtk_utils_set_editable( GTK_OBJECT( column ), data->editable_item && data->editable_filter );
- nact_gtk_utils_set_editable( GTK_OBJECT( data->addbutton ), data->editable );
- nact_gtk_utils_set_editable( GTK_OBJECT( data->removebutton ), data->editable );
+ nact_gtk_utils_set_editable( GTK_OBJECT( data->addbutton ), data->editable_item );
+ nact_gtk_utils_set_editable( GTK_OBJECT( data->removebutton ), data->editable_item );
gtk_widget_set_sensitive( data->removebutton, FALSE );
st_on_selection_change = FALSE;
@@ -518,8 +521,10 @@ on_key_pressed_event( GtkWidget *widget, GdkEventKey *event, MatchListStr *data
stop = FALSE;
if( event->keyval == GDK_F2 ){
- edit_inline( data );
- stop = TRUE;
+ if( data->editable_filter ){
+ edit_inline( data );
+ stop = TRUE;
+ }
}
if( event->keyval == GDK_Insert || event->keyval == GDK_KP_Insert ){
@@ -651,7 +656,7 @@ static void
on_selection_changed( GtkTreeSelection *selection, MatchListStr *data )
{
gtk_widget_set_sensitive( data->removebutton,
- data->editable && gtk_tree_selection_count_selected_rows( selection ) > 0 );
+ data->editable_item && gtk_tree_selection_count_selected_rows( selection ) > 0 );
}
static void
diff --git a/src/nact/nact-match-list.h b/src/nact/nact-match-list.h
index eec0982..89c5d4b 100644
--- a/src/nact/nact-match-list.h
+++ b/src/nact/nact-match-list.h
@@ -61,7 +61,9 @@ typedef struct {
pon_add_cb pon_add;
guint match_header;
gchar *item_header;
- gboolean editable;
+ gboolean editable_filter;
+ /* dynamic data */
+ gboolean editable_item;
guint sort_column;
guint sort_order;
}
@@ -72,7 +74,8 @@ void nact_match_list_create_model ( BaseWindow *window, const gchar *t
GtkWidget *listview, GtkWidget *addbutton, GtkWidget *removebutton,
pget_filters pget, pset_filters pset, pon_add_cb pon_add,
guint match_header,
- const gchar *item_header );
+ const gchar *item_header,
+ gboolean editable_filter );
void nact_match_list_init_view ( BaseWindow *window, const gchar *tab_name );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]