[nautilus-actions] Review NactICapabilitiesTab page
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Review NactICapabilitiesTab page
- Date: Wed, 16 Jun 2010 22:07:05 +0000 (UTC)
commit f959f65021ee2346f7e31de3cff658af54620316
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Jun 16 21:55:08 2010 +0200
Review NactICapabilitiesTab page
ChangeLog | 3 +
src/nact/nact-icapabilities-tab.c | 314 +----------------------------
src/nact/nautilus-actions-config-tool.ui | 141 +++++++-------
3 files changed, 83 insertions(+), 375 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 06c292c..3d3b69e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2010-06-16 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-icapabilities-tab.c:
+ * src/nact/nautilus-actions-config-tool.ui: Review NactICapabilitiesTab page.
+
* src/nact/nact-ischemes-tab.c: Review NactISchemesTab page.
* src/nact/nact-ifolders-tab.c: Review NactIFoldersTab page.
diff --git a/src/nact/nact-icapabilities-tab.c b/src/nact/nact-icapabilities-tab.c
index 714eef3..41a82ba 100644
--- a/src/nact/nact-icapabilities-tab.c
+++ b/src/nact/nact-icapabilities-tab.c
@@ -33,12 +33,9 @@
#endif
#include <glib/gi18n.h>
-#include <stdlib.h>
-#include <api/na-core-utils.h>
#include <api/na-object-api.h>
-#include "nact-gtk-utils.h"
#include "nact-main-tab.h"
#include "nact-match-list.h"
#include "nact-add-capability-dialog.h"
@@ -50,50 +47,20 @@ struct NactICapabilitiesTabInterfacePrivate {
void *empty; /* so that gcc -pedantic is happy */
};
-/* columns in the selection count combobox
- */
-enum {
- COUNT_SIGN_COLUMN = 0,
- COUNT_LABEL_COLUMN,
- COUNT_N_COLUMN
-};
-
-typedef struct {
- gchar *sign;
- gchar *label;
-}
- SelectionCountStruct;
-
-/* i18n notes: selection count symbol, respectively 'less than', 'equal to' and 'greater than' */
-static SelectionCountStruct st_counts[] = {
- { "<", N_( "(strictly lesser than)" ) },
- { "=", N_( "(equal to)" ) },
- { ">", N_( "(strictly greater than)" ) },
- { NULL }
-};
-
#define ITAB_NAME "capabilities"
static gboolean st_initialized = FALSE;
static gboolean st_finalized = FALSE;
-static GType register_type( void );
-static void interface_base_init( NactICapabilitiesTabInterface *klass );
-static void interface_base_finalize( NactICapabilitiesTabInterface *klass );
-
-static void runtime_init_connect_signals( NactICapabilitiesTab *instance, GtkTreeView *listview );
-static void on_tab_updatable_selection_changed( NactICapabilitiesTab *instance, gint count_selected );
-static void on_selcount_ope_changed( GtkComboBox *combo, NactICapabilitiesTab *instance );
-static void on_selcount_int_changed( GtkEntry *entry, NactICapabilitiesTab *instance );
-static void on_add_clicked( GtkButton *button, BaseWindow *window );
-static gboolean tab_set_sensitive( NactICapabilitiesTab *instance );
-static GtkTreeView *get_capabilities_tree_view( NactICapabilitiesTab *instance );
-static GSList *get_capabilities( NAIContext *context );
-static void set_capabilities( NAIContext *context, GSList *list );
-static void init_count_combobox( NactICapabilitiesTab *instance );
-static void set_selection_count_selection( NactICapabilitiesTab *instance, const gchar *ope, const gchar *uint );
-static gchar *get_selection_count_selection( NactICapabilitiesTab *instance );
-static void dispose_count_combobox( NactICapabilitiesTab *instance );
+static GType register_type( void );
+static void interface_base_init( NactICapabilitiesTabInterface *klass );
+static void interface_base_finalize( NactICapabilitiesTabInterface *klass );
+
+static void on_tab_updatable_selection_changed( NactICapabilitiesTab *instance, gint count_selected );
+
+static void on_add_clicked( GtkButton *button, BaseWindow *window );
+static GSList *get_capabilities( NAIContext *context );
+static void set_capabilities( NAIContext *context, GSList *list );
GType
nact_icapabilities_tab_get_type( void )
@@ -176,8 +143,6 @@ nact_icapabilities_tab_initial_load_toplevel( NactICapabilitiesTab *instance )
g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
- init_count_combobox( instance );
-
list = base_window_get_widget( BASE_WINDOW( instance ), "CapabilitiesTreeView" );
add = base_window_get_widget( BASE_WINDOW( instance ), "AddCapabilityButton" );
remove = base_window_get_widget( BASE_WINDOW( instance ), "RemoveCapabilityButton" );
@@ -197,7 +162,6 @@ void
nact_icapabilities_tab_runtime_init_toplevel( NactICapabilitiesTab *instance )
{
static const gchar *thisfn = "nact_icapabilities_tab_runtime_init_toplevel";
- GtkTreeView *listview;
g_return_if_fail( NACT_IS_ICAPABILITIES_TAB( instance ));
@@ -205,42 +169,13 @@ nact_icapabilities_tab_runtime_init_toplevel( NactICapabilitiesTab *instance )
g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
- listview = get_capabilities_tree_view( instance );
nact_match_list_init_view( BASE_WINDOW( instance ), ITAB_NAME );
- runtime_init_connect_signals( instance, listview );
- }
-}
-
-static void
-runtime_init_connect_signals( NactICapabilitiesTab *instance, GtkTreeView *listview )
-{
- static const gchar *thisfn = "nact_icapabilities_tab_runtime_init_connect_signals";
- GtkWidget *selcount_ope, *selcount_int;
-
- if( st_initialized && !st_finalized ){
-
- g_debug( "%s: instance=%p, listview=%p", thisfn, ( void * ) instance, ( void * ) listview );
- g_return_if_fail( NACT_IS_ICAPABILITIES_TAB( instance ));
base_window_signal_connect(
BASE_WINDOW( instance ),
G_OBJECT( instance ),
MAIN_WINDOW_SIGNAL_SELECTION_CHANGED,
G_CALLBACK( on_tab_updatable_selection_changed ));
-
- selcount_ope = base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountSigneCombobox" );
- base_window_signal_connect(
- BASE_WINDOW( instance ),
- G_OBJECT( selcount_ope ),
- "changed",
- G_CALLBACK( on_selcount_ope_changed ));
-
- selcount_int = base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountNumberEntry" );
- base_window_signal_connect(
- BASE_WINDOW( instance ),
- G_OBJECT( selcount_int ),
- "changed",
- G_CALLBACK( on_selcount_int_changed ));
}
}
@@ -268,7 +203,6 @@ nact_icapabilities_tab_dispose( NactICapabilitiesTab *instance )
g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
- dispose_count_combobox( instance );
nact_match_list_dispose( BASE_WINDOW( instance ), ITAB_NAME );
}
}
@@ -276,119 +210,17 @@ nact_icapabilities_tab_dispose( NactICapabilitiesTab *instance )
static void
on_tab_updatable_selection_changed( NactICapabilitiesTab *instance, gint count_selected )
{
- static const gchar *thisfn = "nact_icapabilities_tab_on_tab_updatable_selection_changed";
- NAObjectItem *item;
- NAObjectProfile *profile;
- NAIContext *context;
- GSList *capabilities;
- gboolean editable;
- gchar *sel_count;
- gchar *selcount_ope, *selcount_int;
- GtkWidget *combo, *entry;
-
- capabilities = NULL;
- if( st_initialized && !st_finalized ){
-
- g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
- g_return_if_fail( NACT_IS_ICAPABILITIES_TAB( instance ));
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
- TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
- TAB_UPDATABLE_PROP_EDITABLE, &editable,
- NULL );
-
- context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
-
- sel_count = context ? na_object_get_selection_count( context ) : g_strdup( ">0" );
- na_core_utils_selcount_get_ope_int( sel_count, &selcount_ope, &selcount_int );
- set_selection_count_selection( instance, selcount_ope, selcount_int );
- g_free( selcount_int );
- g_free( selcount_ope );
- g_free( sel_count );
-
- combo = base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountSigneCombobox" );
- gtk_widget_set_sensitive( combo, context != NULL );
- nact_gtk_utils_set_editable( GTK_OBJECT( combo ), editable );
-
- entry = base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountNumberEntry" );
- gtk_widget_set_sensitive( entry, context != NULL );
- nact_gtk_utils_set_editable( GTK_OBJECT( entry ), editable );
-
- nact_match_list_on_selection_changed( BASE_WINDOW( instance ), ITAB_NAME, count_selected );
- tab_set_sensitive( instance );
- }
-}
-
-static void
-on_selcount_ope_changed( GtkComboBox *combo, NactICapabilitiesTab *instance )
-{
- NAObjectItem *edited;
- NAObjectProfile *profile;
- NAIContext *context;
- gboolean editable;
- gchar *selcount;
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_SELECTED_ITEM, &edited,
- TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
- TAB_UPDATABLE_PROP_EDITABLE, &editable,
- NULL );
-
- context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) edited );
-
- if( context && editable ){
- selcount = get_selection_count_selection( instance );
- na_object_set_selection_count( context, selcount );
- g_free( selcount );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
- }
-}
-
-static void
-on_selcount_int_changed( GtkEntry *entry, NactICapabilitiesTab *instance )
-{
- NAObjectItem *edited;
- NAObjectProfile *profile;
- NAIContext *context;
- gboolean editable;
- gchar *selcount;
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_SELECTED_ITEM, &edited,
- TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
- TAB_UPDATABLE_PROP_EDITABLE, &editable,
- NULL );
-
- context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) edited );
-
- if( context && editable ){
- selcount = get_selection_count_selection( instance );
- na_object_set_selection_count( context, selcount );
- g_free( selcount );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
- }
+ nact_match_list_on_selection_changed( BASE_WINDOW( instance ), ITAB_NAME, count_selected );
}
static void
on_add_clicked( GtkButton *button, BaseWindow *window )
{
- NAObjectItem *item;
- NAObjectProfile *profile;
NAIContext *context;
GSList *capabilities;
gchar *new_cap;
- g_object_get(
- G_OBJECT( window ),
- TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
- TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
- NULL );
-
- context = ( profile ? NA_ICONTEXT( profile ) : ( NAIContext * ) item );
+ context = nact_main_tab_get_context( NACT_MAIN_WINDOW( window ), NULL );
if( context ){
capabilities = na_object_get_capabilities( context );
@@ -402,36 +234,6 @@ on_add_clicked( GtkButton *button, BaseWindow *window )
}
}
-static gboolean
-tab_set_sensitive( NactICapabilitiesTab *instance )
-{
- NAObjectItem *item;
- NAObjectProfile *profile;
- gboolean enable_tab;
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
- TAB_UPDATABLE_PROP_SELECTED_PROFILE, &profile,
- NULL );
-
- enable_tab = ( item != NULL );
- nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_CAPABILITIES, enable_tab );
-
- return( enable_tab );
-}
-
-static GtkTreeView *
-get_capabilities_tree_view( NactICapabilitiesTab *instance )
-{
- GtkWidget *treeview;
-
- treeview = base_window_get_widget( BASE_WINDOW( instance ), "CapabilitiesTreeView" );
- g_assert( GTK_IS_TREE_VIEW( treeview ));
-
- return( GTK_TREE_VIEW( treeview ));
-}
-
static GSList *
get_capabilities( NAIContext *context )
{
@@ -443,97 +245,3 @@ set_capabilities( NAIContext *context, GSList *list )
{
na_object_set_capabilities( context, list );
}
-
-static void
-init_count_combobox( NactICapabilitiesTab *instance )
-{
- GtkTreeModel *model;
- guint i;
- GtkTreeIter row;
- GtkComboBox *combo;
- GtkCellRenderer *cell_renderer_text;
-
- model = GTK_TREE_MODEL( gtk_list_store_new( COUNT_N_COLUMN, G_TYPE_STRING, G_TYPE_STRING ));
- i = 0;
- while( st_counts[i].sign ){
- gtk_list_store_append( GTK_LIST_STORE( model ), &row );
- gtk_list_store_set( GTK_LIST_STORE( model ), &row, COUNT_SIGN_COLUMN, st_counts[i].sign, -1 );
- gtk_list_store_set( GTK_LIST_STORE( model ), &row, COUNT_LABEL_COLUMN, st_counts[i].label, -1 );
- i += 1;
- }
-
- combo = GTK_COMBO_BOX( base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountSigneCombobox" ));
- gtk_combo_box_set_model( combo, model );
- g_object_unref( model );
-
- gtk_cell_layout_clear( GTK_CELL_LAYOUT( combo ));
-
- cell_renderer_text = gtk_cell_renderer_text_new();
- gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( combo ), cell_renderer_text, FALSE );
- gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT( combo ), cell_renderer_text, "text", COUNT_SIGN_COLUMN );
-
- cell_renderer_text = gtk_cell_renderer_text_new();
- gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( combo ), cell_renderer_text, TRUE );
- g_object_set( G_OBJECT( cell_renderer_text ), "xalign", ( gdouble ) 0.0, "style", PANGO_STYLE_ITALIC, "style-set", TRUE, NULL );
- gtk_cell_layout_add_attribute( GTK_CELL_LAYOUT( combo ), cell_renderer_text, "text", COUNT_LABEL_COLUMN );
-
- gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 );
-}
-
-static void
-set_selection_count_selection( NactICapabilitiesTab *instance, const gchar *ope, const gchar *uint )
-{
- GtkComboBox *combo;
- GtkEntry *entry;
- gint i, index;
-
- combo = GTK_COMBO_BOX( base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountSigneCombobox" ));
-
- index = -1;
- for( i=0 ; st_counts[i].sign && index==-1 ; ++i ){
- if( !strcmp( st_counts[i].sign, ope )){
- index = i;
- }
- }
- gtk_combo_box_set_active( combo, index );
-
- entry = GTK_ENTRY( base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountNumberEntry" ));
- gtk_entry_set_text( entry, uint );
-}
-
-static gchar *
-get_selection_count_selection( NactICapabilitiesTab *instance )
-{
- GtkComboBox *combo;
- GtkEntry *entry;
- gint index;
- gchar *uints, *selcount;
- guint uinti;
-
- combo = GTK_COMBO_BOX( base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountSigneCombobox" ));
- index = gtk_combo_box_get_active( combo );
- if( index == -1 ){
- return( NULL );
- }
-
- entry = GTK_ENTRY( base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountNumberEntry" ));
- uinti = abs( atoi( gtk_entry_get_text( entry )));
- uints = g_strdup_printf( "%d", uinti );
- gtk_entry_set_text( entry, uints );
- g_free( uints );
-
- selcount = g_strdup_printf( "%s%d", st_counts[index].sign, uinti );
-
- return( selcount );
-}
-
-static void
-dispose_count_combobox( NactICapabilitiesTab *instance )
-{
- GtkComboBox *combo;
- GtkTreeModel *model;
-
- combo = GTK_COMBO_BOX( base_window_get_widget( BASE_WINDOW( instance ), "ConditionsCountSigneCombobox" ));
- model = gtk_combo_box_get_model( combo );
- gtk_list_store_clear( GTK_LIST_STORE( model ));
-}
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index ee0bf2e..6416a84 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -1417,74 +1417,6 @@ Defining several profiles lets you have several commands, each applying with a d
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
- <object class="GtkFrame" id="frame12">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkAlignment" id="alignment12">
- <property name="visible">True</property>
- <property name="top_padding">6</property>
- <property name="bottom_padding">6</property>
- <property name="left_padding">12</property>
- <property name="right_padding">6</property>
- <child>
- <object class="GtkHBox" id="hbox10">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label17">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Count :</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkComboBox" id="ConditionsCountSigneCombobox">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="ConditionsCountNumberEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes"><b>Appears if selection contains</b></property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<object class="GtkFrame" id="frame16">
<property name="visible">True</property>
<property name="label_xalign">0</property>
@@ -1505,7 +1437,7 @@ Defining several profiles lets you have several commands, each applying with a d
<object class="GtkLabel" id="label77">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">The current item will appear if each element of the selection matches all capabilities of the 'Must match' column, while not matching any capability of the 'Must not match' column.</property>
+ <property name="label" translatable="yes">The current item will appear if each element of the selection matches all capabilities of the 'Must match all of' column, while not matching any capability of the 'Must not match any of' column.</property>
<property name="wrap">True</property>
</object>
<packing>
@@ -1602,7 +1534,7 @@ Defining several profiles lets you have several commands, each applying with a d
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
@@ -1629,7 +1561,72 @@ Defining several profiles lets you have several commands, each applying with a d
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
- <placeholder/>
+ <object class="GtkFrame" id="frame12">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkAlignment" id="alignment12">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox10">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Count :</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="SelectionCountSigneCombobox">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="SelectionCountNumberEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Appears if selection contains</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<object class="GtkFrame" id="frame4">
@@ -1728,7 +1725,7 @@ Defining several profiles lets you have several commands, each applying with a d
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTreeView" id="EnvironmentsTreeView">
+ <object class="GtkTreeView" id="EnvironmentsDesktopTreeView">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]