[nautilus-actions] Define IProfileItem interface
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus-actions] Define IProfileItem interface
- Date: Wed, 15 Jul 2009 23:38:37 +0000 (UTC)
commit 61b78a6c14d4a1c7a027287cd8dbe8618bb2b811
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Jul 16 01:40:20 2009 +0200
Define IProfileItem interface
ChangeLog | 20 +
TODO | 22 +-
src/common/na-action.c | 31 +-
src/common/na-action.h | 1 +
src/nact/Makefile.am | 6 +-
src/nact/nact-action-conditions-editor.c | 61 +-
src/nact/nact-action-conditions-editor.h | 2 +-
src/nact/nact-action-profiles-editor.c | 121 +++--
...ct-iprofile-conditions.c => nact-iconditions.c} | 86 ++--
...ct-iprofile-conditions.h => nact-iconditions.h} | 38 +-
src/nact/nact-iprefs.c | 12 +-
src/nact/nact-iprefs.h | 4 +-
src/nact/nact-iprofile-item.c | 237 +++++++
src/nact/nact-iprofile-item.h | 80 +++
src/nact/nact-main-window.c | 16 +-
src/nact/nact-profile-conditions-editor.c | 259 ++++++--
src/nact/nact-profile-conditions-editor.h | 4 +-
src/nact/nact-window.c | 31 +
src/nact/nact-window.h | 2 +
src/nact/nautilus-actions-config.ui | 660 ++++++++++++++++++--
20 files changed, 1430 insertions(+), 263 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e6d159a..85a3a6a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2009-07-16 Pierre Wieser <pwieser trychlos org>
+
+ * src/common/na-action.c:
+ * src/common/na-action.h (na_action_get_new_profile_name):
+ New function.
+
+ * src/nact/nact-iprofile-conditions.c:
+ * src/nact/nact-iprofile-conditions.h:
+ Renamed as nact-iconditions.{c,h}.
+ IProfileConditions renamed accordingly.
+
+ * src/nact/nact-iprofile-item.c:
+ * src/nact/nact-iprofile-item.h: New files.
+ Define IProfileItem interface.
+
+ * src/nact/nact-action-conditions-editor.c:
+ * src/nact/nact-profile-conditions-editor.c:
+ * src/nact/nact-iprefs.c:
+ * src/nact/Makefile.am: Updated accordingly.
+
2009-07-15 Pierre Wieser <pwieser trychlos org>
* src/nact/nact-action-conditions-editor.c (on_save_clicked):
diff --git a/TODO b/TODO
index 395b577..9c06142 100644
--- a/TODO
+++ b/TODO
@@ -1,11 +1,27 @@
-Last Modified: 07/11/2005
-
-Important things to do before next release :
- Create a command line tool to install a schema (wrapper to
"gconftool-2 --install-schema-file")
+
- Implement the Help button in nact (or hide it meanwhile)
+
- i18n doen't works in the command line tool and for some part of NACT
like the scheme list, it seems.
+
- Add better error handling in import/export stuff of nact and some feedback to
user throught error dialog when import/export failed.
+
+- na-action and na-action-profile are included in nact-window.h
+ so are not needed in all other derived window files
+
+- try to import a schema for an action (without schema)
+
+- see if we could define signals in base classes, and if this signals
+ can be caught by interfaces - this would prevent us to define and
+ call specific api (initial_load, runtime_init, etc)
+
+- is it required to pass an action or a profile at initial_load ??
+ (would be better only at runtime_init)
+
+- gtk_window_set_transient_for (see nact-conditions-editor.c) should be
+ called in base_window_do_initial_load, but requires a parent window
+ which should be passed as a virtual or in the constructor
diff --git a/src/common/na-action.c b/src/common/na-action.c
index 89fc892..51a289e 100644
--- a/src/common/na-action.c
+++ b/src/common/na-action.c
@@ -769,6 +769,35 @@ na_action_are_equal( NAAction *first, NAAction *second )
}
/**
+ * Returns a name suitable as a new profile name.
+ *
+ * @action: the action for which we are searching a new profile name.
+ *
+ * Basically, we increment a counter until finding a unique name.
+ */
+gchar *
+na_action_get_new_profile_name( const NAAction *action )
+{
+ g_assert( NA_IS_ACTION( action ));
+ int i;
+ gboolean ok = FALSE;
+ gchar *candidate = NULL;
+
+ for( i=1 ; !ok ; ++i ){
+ g_free( candidate );
+ candidate = g_strdup_printf( "%s%d", ACTION_PROFILE_PREFIX, i );
+ if( !na_action_get_profile( action, candidate )){
+ ok = TRUE;
+ }
+ }
+ if( !ok ){
+ g_free( candidate );
+ candidate = NULL;
+ }
+ return( candidate );
+}
+
+/**
* Returns the profile with the required name.
*
* @action: the action whose profiles has to be retrieved.
@@ -788,7 +817,7 @@ na_action_get_profile( const NAAction *action, const gchar *name )
for( ip = action->private->profiles ; ip && !found ; ip = ip->next ){
NAActionProfile *iprofile = NA_ACTION_PROFILE( ip->data );
gchar *iname = na_action_profile_get_name( iprofile );
- if( !g_ascii_strcasecmp( name, iname )){
+ if( !strcmp( name, iname )){
found = NA_OBJECT( iprofile );
}
g_free( iname );
diff --git a/src/common/na-action.h b/src/common/na-action.h
index 6a05c7b..4c6c6f3 100644
--- a/src/common/na-action.h
+++ b/src/common/na-action.h
@@ -108,6 +108,7 @@ void na_action_set_icon( NAAction *action, const gchar *icon_name );
gboolean na_action_are_equal( NAAction *first, NAAction *second );
+gchar *na_action_get_new_profile_name( const NAAction *action );
NAObject *na_action_get_profile( const NAAction *action, const gchar *name );
GSList *na_action_get_profiles( const NAAction *action );
void na_action_add_profile( NAAction *action, NAObject *profile );
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index f3752d7..d68191c 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -63,12 +63,14 @@ nautilus_actions_config_SOURCES = \
nact-gconf-writer.h \
nact-iactions-list.c \
nact-iactions-list.h \
+ nact-iconditions.c \
+ nact-iconditions.h \
nact-imenu-item.c \
nact-imenu-item.h \
nact-iprefs.c \
nact-iprefs.h \
- nact-iprofile-conditions.c \
- nact-iprofile-conditions.h \
+ nact-iprofile-item.c \
+ nact-iprofile-item.h \
nact-iprofiles-list.c \
nact-iprofiles-list.h \
nact-main.c \
diff --git a/src/nact/nact-action-conditions-editor.c b/src/nact/nact-action-conditions-editor.c
index 709fc93..7e07da3 100644
--- a/src/nact/nact-action-conditions-editor.c
+++ b/src/nact/nact-action-conditions-editor.c
@@ -39,7 +39,7 @@
#include "nact-application.h"
#include "nact-action-conditions-editor.h"
#include "nact-imenu-item.h"
-#include "nact-iprofile-conditions.h"
+#include "nact-iconditions.h"
#include "nact-iprefs.h"
#include "nact-main-window.h"
@@ -63,7 +63,7 @@ static GObjectClass *st_parent_class = NULL;
static GType register_type( void );
static void class_init( NactActionConditionsEditorClass *klass );
static void imenu_item_iface_init( NactIMenuItemInterface *iface );
-static void iprofile_conditions_iface_init( NactIProfileConditionsInterface *iface );
+static void iconditions_iface_init( NactIConditionsInterface *iface );
static void instance_init( GTypeInstance *instance, gpointer klass );
static void instance_dispose( GObject *dialog );
static void instance_finalize( GObject *dialog );
@@ -128,15 +128,15 @@ register_type( void )
g_type_add_interface_static( type, NACT_IMENU_ITEM_TYPE, &imenu_item_iface_info );
- /* implement IProfileConditions interface
+ /* implement IConditions interface
*/
- static const GInterfaceInfo iprofile_conditions_iface_info = {
- ( GInterfaceInitFunc ) iprofile_conditions_iface_init,
+ static const GInterfaceInfo iconditions_iface_info = {
+ ( GInterfaceInitFunc ) iconditions_iface_init,
NULL,
NULL
};
- g_type_add_interface_static( type, NACT_IPROFILE_CONDITIONS_TYPE, &iprofile_conditions_iface_info );
+ g_type_add_interface_static( type, NACT_ICONDITIONS_TYPE, &iconditions_iface_info );
return( type );
}
@@ -177,9 +177,9 @@ imenu_item_iface_init( NactIMenuItemInterface *iface )
}
static void
-iprofile_conditions_iface_init( NactIProfileConditionsInterface *iface )
+iconditions_iface_init( NactIConditionsInterface *iface )
{
- static const gchar *thisfn = "nact_action_conditions_editor_iprofile_conditions_iface_init";
+ static const gchar *thisfn = "nact_action_conditions_editor_iconditions_iface_init";
g_debug( "%s: iface=%p", thisfn, iface );
iface->get_edited_profile = get_edited_profile;
@@ -216,7 +216,7 @@ instance_dispose( GObject *dialog )
self->private->dispose_has_run = TRUE;
nact_imenu_item_dispose( NACT_WINDOW( dialog ));
- nact_iprofile_conditions_dispose( NACT_WINDOW( dialog ));
+ nact_iconditions_dispose( NACT_WINDOW( dialog ));
g_object_unref( self->private->original );
g_object_unref( self->private->edited );
@@ -265,10 +265,10 @@ action_conditions_editor_new( BaseApplication *application )
* new NAAction is created.
*/
void
-nact_action_conditions_editor_run_editor( NactWindow *parent, gpointer user_data )
+nact_action_conditions_editor_run_editor( NactWindow *parent, NAAction *action )
{
static const gchar *thisfn = "nact_action_conditions_editor_run_editor";
- g_debug( "%s: parent=%p, user_data=%p", thisfn, parent, user_data );
+ g_debug( "%s: parent=%p, action=%p", thisfn, parent, action );
g_assert( NACT_IS_MAIN_WINDOW( parent ));
@@ -278,9 +278,6 @@ nact_action_conditions_editor_run_editor( NactWindow *parent, gpointer user_data
NactActionConditionsEditor *dialog = action_conditions_editor_new( application );
dialog->private->parent = parent;
- g_assert( NA_IS_ACTION( user_data ) || !user_data );
- NAAction *action = NA_ACTION( user_data );
-
if( !action ){
dialog->private->original = na_action_new_with_profile();
dialog->private->is_new = TRUE;
@@ -308,7 +305,7 @@ static gchar *
do_get_dialog_name( BaseWindow *dialog )
{
/*g_debug( "nact_action_conditions_editor_do_get_dialog_name" );*/
- return( g_strdup( "EditActionDialogExt" ));
+ return( g_strdup( "ActionConditionsDialog" ));
}
static void
@@ -328,13 +325,13 @@ on_initial_load_dialog( BaseWindow *dialog )
nact_imenu_item_initial_load( NACT_WINDOW( window ), window->private->edited );
NAActionProfile *profile = NA_ACTION_PROFILE( na_action_get_profiles( window->private->edited )->data );
- nact_iprofile_conditions_initial_load( NACT_WINDOW( window ), profile );
+ nact_iconditions_initial_load( NACT_WINDOW( window ), profile );
/* label alignements */
- /*GtkSizeGroup *label_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL );
+ GtkSizeGroup *label_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL );
nact_imenu_item_size_labels( NACT_WINDOW( window ), G_OBJECT( label_group ));
- nact_iprofile_conditions_size_labels( NACT_WINDOW( window ), G_OBJECT( label_group ));
- g_object_unref( label_group );*/
+ nact_iconditions_size_labels( NACT_WINDOW( window ), G_OBJECT( label_group ));
+ g_object_unref( label_group );
/* buttons size
* nb: while label sizing group works well with Glade 3.3 and GtkBuilder,
@@ -342,7 +339,7 @@ on_initial_load_dialog( BaseWindow *dialog )
*/
GtkSizeGroup *button_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL );
nact_imenu_item_size_buttons( NACT_WINDOW( window ), G_OBJECT( button_group ));
- nact_iprofile_conditions_size_buttons( NACT_WINDOW( window ), G_OBJECT( button_group ));
+ nact_iconditions_size_buttons( NACT_WINDOW( window ), G_OBJECT( button_group ));
g_object_unref( button_group );
}
@@ -358,18 +355,22 @@ on_runtime_init_dialog( BaseWindow *dialog )
g_debug( "%s: dialog=%p", thisfn, dialog );
g_assert( NACT_IS_ACTION_CONDITIONS_EDITOR( dialog ));
- NactActionConditionsEditor *window = NACT_ACTION_CONDITIONS_EDITOR( dialog );
+ NactActionConditionsEditor *editor = NACT_ACTION_CONDITIONS_EDITOR( dialog );
- setup_dialog_title( window, FALSE );
+ GtkWindow *toplevel = base_window_get_toplevel_dialog( dialog );
+ GtkWindow *parent_toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( editor->private->parent ));
+ gtk_window_set_transient_for( toplevel, parent_toplevel );
- nact_imenu_item_runtime_init( NACT_WINDOW( window ), window->private->edited );
+ setup_dialog_title( editor, FALSE );
- /*na_object_dump( NA_OBJECT( window->private->edited ));*/
- NAActionProfile *profile = NA_ACTION_PROFILE( na_action_get_profiles( window->private->edited )->data );
- nact_iprofile_conditions_runtime_init( NACT_WINDOW( window ), profile );
+ nact_imenu_item_runtime_init( NACT_WINDOW( editor ), editor->private->edited );
+
+ /*na_object_dump( NA_OBJECT( editor->private->edited ));*/
+ NAActionProfile *profile = NA_ACTION_PROFILE( na_action_get_profiles( editor->private->edited )->data );
+ nact_iconditions_runtime_init( NACT_WINDOW( editor ), profile );
- nact_window_signal_connect_by_name( NACT_WINDOW( window ), "CancelButton", "clicked", G_CALLBACK( on_cancel_clicked ));
- nact_window_signal_connect_by_name( NACT_WINDOW( window ), "SaveButton", "clicked", G_CALLBACK( on_save_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( editor ), "CancelButton", "clicked", G_CALLBACK( on_cancel_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( editor ), "SaveButton", "clicked", G_CALLBACK( on_save_clicked ));
}
static void
@@ -384,11 +385,11 @@ on_all_widgets_showed( BaseWindow *dialog )
g_debug( "%s: dialog=%p", thisfn, dialog );
- GtkNotebook *notebook = GTK_NOTEBOOK( base_window_get_widget( dialog, "notebook2" ));
+ GtkNotebook *notebook = GTK_NOTEBOOK( base_window_get_widget( dialog, "Notebook" ));
gtk_notebook_set_current_page( notebook, 0 );
nact_imenu_item_all_widgets_showed( NACT_WINDOW( dialog ));
- nact_iprofile_conditions_all_widgets_showed( NACT_WINDOW( dialog ));
+ nact_iconditions_all_widgets_showed( NACT_WINDOW( dialog ));
}
static void
diff --git a/src/nact/nact-action-conditions-editor.h b/src/nact/nact-action-conditions-editor.h
index 26ce700..6b54531 100644
--- a/src/nact/nact-action-conditions-editor.h
+++ b/src/nact/nact-action-conditions-editor.h
@@ -67,7 +67,7 @@ typedef struct {
GType nact_action_conditions_editor_get_type( void );
-void nact_action_conditions_editor_run_editor( NactWindow *parent, gpointer user_data );
+void nact_action_conditions_editor_run_editor( NactWindow *parent, NAAction *action );
G_END_DECLS
diff --git a/src/nact/nact-action-profiles-editor.c b/src/nact/nact-action-profiles-editor.c
index 7b0ad79..c2f2ca8 100644
--- a/src/nact/nact-action-profiles-editor.c
+++ b/src/nact/nact-action-profiles-editor.c
@@ -39,9 +39,9 @@
#include "nact-application.h"
#include "nact-action-profiles-editor.h"
+#include "nact-profile-conditions-editor.h"
#include "nact-imenu-item.h"
#include "nact-iprofiles-list.h"
-#include "nact-iprefs.h"
/* private class data
*/
@@ -82,14 +82,17 @@ static void on_profiles_list_selection_changed( GtkTreeSelection *selection,
static gboolean on_profiles_list_double_click( GtkWidget *widget, GdkEventButton *event, gpointer data );
static gboolean on_profiles_list_enter_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer data );
static void on_modified_field( NactWindow *dialog );
+static void on_new_button_clicked( GtkButton *button, gpointer user_data );
static void on_edit_button_clicked( GtkButton *button, gpointer user_data );
+static void on_duplicate_button_clicked( GtkButton *button, gpointer user_data );
+static void on_delete_button_clicked( GtkButton *button, gpointer user_data );
static void on_cancel_clicked( GtkButton *button, gpointer user_data );
static gboolean on_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
static GSList *do_get_profiles( NactWindow *window );
static GObject *get_edited_action( NactWindow *window );
static gboolean is_edited_modified( NactActionProfilesEditor *dialog );
-static void do_set_current_profile( NactActionProfilesEditor *dialog, const NAActionProfile *profile );
+/*static void do_set_current_profile( NactActionProfilesEditor *dialog, const NAActionProfile *profile );*/
GType
nact_action_profiles_editor_get_type( void )
@@ -276,31 +279,19 @@ action_profiles_editor_new( BaseApplication *application )
void
nact_action_profiles_editor_run_editor( NactWindow *parent, gpointer user_data )
{
- g_assert( NACT_IS_ACTION_PROFILES_EDITOR( parent ));
-
BaseApplication *application = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( parent )));
g_assert( NACT_IS_APPLICATION( application ));
NactActionProfilesEditor *dialog = action_profiles_editor_new( application );
dialog->private->parent = parent;
- g_assert( NA_IS_ACTION( user_data ) || !user_data );
+ g_assert( NA_IS_ACTION( user_data ));
NAAction *action = NA_ACTION( user_data );
+ g_assert( na_action_get_profiles_count( action ) > 1 );
- if( !action ){
- dialog->private->original = na_action_new_with_profile();
- dialog->private->is_new = TRUE;
-
- } else {
- dialog->private->original = na_action_duplicate( action );
- dialog->private->is_new = FALSE;
- }
-
+ dialog->private->original = na_action_duplicate( action );
dialog->private->edited = na_action_duplicate( dialog->private->original );
- g_assert( na_action_get_profiles_count( dialog->private->original ) > 1 );
- g_assert( na_action_get_profiles_count( dialog->private->edited ) > 1 );
-
base_window_run( BASE_WINDOW( dialog ));
}
@@ -313,7 +304,7 @@ do_get_iprefs_window_id( NactWindow *window )
static gchar *
do_get_dialog_name( BaseWindow *dialog )
{
- return( g_strdup( "EditActionDialog"));
+ return( g_strdup( "ActionProfilesDialog"));
}
static void
@@ -328,14 +319,14 @@ on_initial_load_dialog( BaseWindow *dialog )
g_debug( "%s: dialog=%p", thisfn, dialog );
g_assert( NACT_IS_ACTION_PROFILES_EDITOR( dialog ));
- NactActionProfilesEditor *window = NACT_ACTION_PROFILES_EDITOR( dialog );
+ NactActionProfilesEditor *editor = NACT_ACTION_PROFILES_EDITOR( dialog );
- nact_imenu_item_initial_load( NACT_WINDOW( window ), window->private->edited );
+ nact_imenu_item_initial_load( NACT_WINDOW( editor ), editor->private->edited );
- g_assert( NACT_IS_IPROFILES_LIST( window ));
- nact_iprofiles_list_initial_load( NACT_WINDOW( window ));
- nact_iprofiles_list_set_multiple_selection( NACT_WINDOW( window ), FALSE );
- nact_iprofiles_list_set_send_selection_changed_on_fill_list( NACT_WINDOW( window ), FALSE );
+ g_assert( NACT_IS_IPROFILES_LIST( editor ));
+ nact_iprofiles_list_initial_load( NACT_WINDOW( editor ));
+ nact_iprofiles_list_set_multiple_selection( NACT_WINDOW( editor ), FALSE );
+ nact_iprofiles_list_set_send_selection_changed_on_fill_list( NACT_WINDOW( editor ), FALSE );
}
static void
@@ -350,14 +341,23 @@ on_runtime_init_dialog( BaseWindow *dialog )
g_debug( "%s: dialog=%p", thisfn, dialog );
g_assert( NACT_IS_ACTION_PROFILES_EDITOR( dialog ));
- NactActionProfilesEditor *window = NACT_ACTION_PROFILES_EDITOR( dialog );
+ NactActionProfilesEditor *editor = NACT_ACTION_PROFILES_EDITOR( dialog );
- setup_dialog_title( window, FALSE );
+ GtkWindow *toplevel = base_window_get_toplevel_dialog( dialog );
+ GtkWindow *parent_toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( editor->private->parent ));
+ gtk_window_set_transient_for( toplevel, parent_toplevel );
- nact_imenu_item_runtime_init( NACT_WINDOW( window ), window->private->edited );
- nact_iprofiles_list_runtime_init( NACT_WINDOW( window ));
+ setup_dialog_title( editor, FALSE );
- nact_window_signal_connect_by_name( NACT_WINDOW( window ), "CancelButton", "clicked", G_CALLBACK( on_cancel_clicked ));
+ nact_imenu_item_runtime_init( NACT_WINDOW( editor ), editor->private->edited );
+ nact_iprofiles_list_runtime_init( NACT_WINDOW( editor ));
+
+ nact_window_signal_connect_by_name( NACT_WINDOW( editor ), "NewProfileButton", "clicked", G_CALLBACK( on_new_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( editor ), "EditProfileButton", "clicked", G_CALLBACK( on_edit_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( editor ), "DuplicateProfileButton", "clicked", G_CALLBACK( on_duplicate_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( editor ), "DeleteProfileButton", "clicked", G_CALLBACK( on_delete_button_clicked ));
+
+ nact_window_signal_connect_by_name( NACT_WINDOW( editor ), "CancelButton", "clicked", G_CALLBACK( on_cancel_clicked ));
}
static void
@@ -378,16 +378,9 @@ on_all_widgets_showed( BaseWindow *dialog )
static void
setup_dialog_title( NactActionProfilesEditor *dialog, gboolean is_modified )
{
- GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( dialog ));
-
- gchar *title;
- if( dialog->private->is_new ){
- title = g_strdup( _( "Adding a new action" ));
- } else {
- gchar *label = na_action_get_label( dialog->private->original );
- title = g_strdup_printf( _( "Editing \"%s\" action" ), label );
- g_free( label );
- }
+ gchar *label = na_action_get_label( dialog->private->original );
+ gchar *title = g_strdup_printf( _( "Editing \"%s\" action" ), label );
+ g_free( label );
if( is_modified ){
gchar *tmp = g_strdup_printf( "*%s", title );
@@ -395,6 +388,7 @@ setup_dialog_title( NactActionProfilesEditor *dialog, gboolean is_modified )
title = tmp;
}
+ GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( dialog ));
gtk_window_set_title( toplevel, title );
g_free( title );
}
@@ -429,9 +423,9 @@ on_profiles_list_selection_changed( GtkTreeSelection *selection, gpointer user_d
g_assert( NACT_IS_ACTION_PROFILES_EDITOR( user_data ));
BaseWindow *window = BASE_WINDOW( user_data );
- GtkWidget *edit_button = base_window_get_widget( window, "EditActionButton" );
- GtkWidget *delete_button = base_window_get_widget( window, "DeleteActionButton" );
- GtkWidget *duplicate_button = base_window_get_widget( window, "DuplicateActionButton" );
+ GtkWidget *edit_button = base_window_get_widget( window, "EditProfileButton" );
+ GtkWidget *delete_button = base_window_get_widget( window, "DeleteProfileButton" );
+ GtkWidget *duplicate_button = base_window_get_widget( window, "DuplicateProfileButton" );
gboolean enabled = ( gtk_tree_selection_count_selected_rows( selection ) > 0 );
@@ -439,8 +433,8 @@ on_profiles_list_selection_changed( GtkTreeSelection *selection, gpointer user_d
gtk_widget_set_sensitive( delete_button, enabled );
gtk_widget_set_sensitive( duplicate_button, enabled );
- NAActionProfile *profile = NA_ACTION_PROFILE( nact_iprofiles_list_get_selected_profile( NACT_WINDOW( window )));
- do_set_current_profile( NACT_ACTION_PROFILES_EDITOR( window ), profile );
+ /*NAActionProfile *profile = NA_ACTION_PROFILE( nact_iprofiles_list_get_selected_profile( NACT_WINDOW( window )));
+ do_set_current_profile( NACT_ACTION_PROFILES_EDITOR( window ), profile );*/
}
static gboolean
@@ -470,13 +464,27 @@ on_modified_field( NactWindow *window )
NactActionProfilesEditor *dialog = ( NACT_ACTION_PROFILES_EDITOR( window ));
gboolean is_modified = is_edited_modified( dialog );
- /*g_debug( "%s: is_modified=%s", thisfn, is_modified ? "True":"False" );*/
setup_dialog_title( dialog, is_modified );
gboolean can_save = is_modified && nact_imenu_item_has_label( window );
setup_buttons( dialog, can_save );
}
+/*
+ * creating a new profile
+ */
+static void
+on_new_button_clicked( GtkButton *button, gpointer user_data )
+{
+ g_assert( NACT_IS_ACTION_PROFILES_EDITOR( user_data ));
+ NactWindow *window = NACT_WINDOW( user_data );
+ NactActionProfilesEditor *editor = NACT_ACTION_PROFILES_EDITOR( window );
+
+ nact_profile_conditions_editor_run_editor( window, editor->private->edited, NULL );
+
+ nact_iprofiles_list_set_focus( window );
+}
+
static void
on_edit_button_clicked( GtkButton *button, gpointer user_data )
{
@@ -484,6 +492,18 @@ on_edit_button_clicked( GtkButton *button, gpointer user_data )
}
static void
+on_delete_button_clicked( GtkButton *button, gpointer user_data )
+{
+
+}
+
+static void
+on_duplicate_button_clicked( GtkButton *button, gpointer user_data )
+{
+
+}
+
+static void
on_cancel_clicked( GtkButton *button, gpointer user_data )
{
GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( user_data ));
@@ -533,8 +553,9 @@ static GSList *
do_get_profiles( NactWindow *window )
{
g_assert( NACT_IS_ACTION_PROFILES_EDITOR( window ));
+ NactActionProfilesEditor *editor = NACT_ACTION_PROFILES_EDITOR( window );
- return( NULL );
+ return( na_action_get_profiles( editor->private->edited ));
}
static GObject *
@@ -550,12 +571,12 @@ is_edited_modified( NactActionProfilesEditor *dialog )
return( !na_action_are_equal( dialog->private->original, dialog->private->edited ));
}
-static void
+/*static void
do_set_current_profile( NactActionProfilesEditor *dialog, const NAActionProfile *profile )
{
- /*gchar *uuid = na_action_get_uuid( dialog->private->original );
+ gchar *uuid = na_action_get_uuid( dialog->private->original );
gchar *label = na_action_get_label( dialog->private->original );
nact_window_set_current_action( dialog->private->parent, uuid, label );
g_free( label );
- g_free( uuid );*/
-}
+ g_free( uuid );
+}*/
diff --git a/src/nact/nact-iprofile-conditions.c b/src/nact/nact-iconditions.c
similarity index 92%
rename from src/nact/nact-iprofile-conditions.c
rename to src/nact/nact-iconditions.c
index 543a14c..d5dc383 100644
--- a/src/nact/nact-iprofile-conditions.c
+++ b/src/nact/nact-iconditions.c
@@ -39,12 +39,12 @@
#include <common/na-action-profile.h>
#include <common/na-utils.h>
-#include "nact-iprofile-conditions.h"
+#include "nact-iconditions.h"
#include "nact-iprefs.h"
/* private interface data
*/
-struct NactIProfileConditionsInterfacePrivate {
+struct NactIConditionsInterfacePrivate {
};
/* column ordering
@@ -58,16 +58,16 @@ enum {
/* the GConf key used to read/write size and position of auxiliary dialogs
*/
-#define IPREFS_LEGEND_DIALOG "iprofile-conditions-legend-dialog"
-#define IPREFS_COMMAND_CHOOSER "iprofile-conditions-command-chooser"
+#define IPREFS_LEGEND_DIALOG "iconditions-legend-dialog"
+#define IPREFS_COMMAND_CHOOSER "iconditions-command-chooser"
/* a data set in the LegendDialog GObject
*/
-#define LEGEND_DIALOG_IS_VISIBLE "iprofile-conditions-legend-dialog-visible"
+#define LEGEND_DIALOG_IS_VISIBLE "iconditions-legend-dialog-visible"
static GType register_type( void );
-static void interface_base_init( NactIProfileConditionsInterface *klass );
-static void interface_base_finalize( NactIProfileConditionsInterface *klass );
+static void interface_base_init( NactIConditionsInterface *klass );
+static void interface_base_finalize( NactIConditionsInterface *klass );
static GObject *v_get_edited_profile( NactWindow *window );
static void v_field_modified( NactWindow *window );
@@ -117,7 +117,7 @@ static void set_action_schemes( gchar *scheme, GtkTreeModel *model );
static GtkButton *get_remove_button( NactWindow *window );
GType
-nact_iprofile_conditions_get_type( void )
+nact_iconditions_get_type( void )
{
static GType iface_type = 0;
@@ -131,11 +131,11 @@ nact_iprofile_conditions_get_type( void )
static GType
register_type( void )
{
- static const gchar *thisfn = "nact_iprofile_conditions_register_type";
+ static const gchar *thisfn = "nact_iconditions_register_type";
g_debug( "%s", thisfn );
static const GTypeInfo info = {
- sizeof( NactIProfileConditionsInterface ),
+ sizeof( NactIConditionsInterface ),
( GBaseInitFunc ) interface_base_init,
( GBaseFinalizeFunc ) interface_base_finalize,
NULL,
@@ -146,7 +146,7 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIProfileConditions", &info, 0 );
+ GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIConditions", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -154,15 +154,15 @@ register_type( void )
}
static void
-interface_base_init( NactIProfileConditionsInterface *klass )
+interface_base_init( NactIConditionsInterface *klass )
{
- static const gchar *thisfn = "nact_iprofile_conditions_interface_base_init";
+ static const gchar *thisfn = "nact_iconditions_interface_base_init";
static gboolean initialized = FALSE;
if( !initialized ){
g_debug( "%s: klass=%p", thisfn, klass );
- klass->private = g_new0( NactIProfileConditionsInterfacePrivate, 1 );
+ klass->private = g_new0( NactIConditionsInterfacePrivate, 1 );
klass->get_edited_profile = NULL;
klass->field_modified = NULL;
@@ -172,9 +172,9 @@ interface_base_init( NactIProfileConditionsInterface *klass )
}
static void
-interface_base_finalize( NactIProfileConditionsInterface *klass )
+interface_base_finalize( NactIConditionsInterface *klass )
{
- static const gchar *thisfn = "nact_iprofile_conditions_interface_base_finalize";
+ static const gchar *thisfn = "nact_iconditions_interface_base_finalize";
static gboolean finalized = FALSE ;
if( !finalized ){
@@ -187,13 +187,13 @@ interface_base_finalize( NactIProfileConditionsInterface *klass )
}
void
-nact_iprofile_conditions_initial_load( NactWindow *dialog, NAActionProfile *profile )
+nact_iconditions_initial_load( NactWindow *dialog, NAActionProfile *profile )
{
create_schemes_selection_list( dialog );
}
void
-nact_iprofile_conditions_size_labels( NactWindow *window, GObject *size_group )
+nact_iconditions_size_labels( NactWindow *window, GObject *size_group )
{
g_assert( NACT_IS_WINDOW( window ));
g_assert( GTK_IS_SIZE_GROUP( size_group ));
@@ -206,7 +206,7 @@ nact_iprofile_conditions_size_labels( NactWindow *window, GObject *size_group )
}
void
-nact_iprofile_conditions_size_buttons( NactWindow *window, GObject *size_group )
+nact_iconditions_size_buttons( NactWindow *window, GObject *size_group )
{
g_assert( NACT_IS_WINDOW( window ));
g_assert( GTK_IS_SIZE_GROUP( size_group ));
@@ -219,9 +219,9 @@ nact_iprofile_conditions_size_buttons( NactWindow *window, GObject *size_group )
}
void
-nact_iprofile_conditions_runtime_init( NactWindow *dialog, NAActionProfile *profile )
+nact_iconditions_runtime_init( NactWindow *dialog, NAActionProfile *profile )
{
- static const gchar *thisfn = "nact_iprofile_conditions_runtime_init";
+ static const gchar *thisfn = "nact_iconditions_runtime_init";
g_debug( "%s: dialog=%p, profile=%p", thisfn, dialog, profile );
GtkWidget *path_widget = get_path_widget( dialog );
@@ -306,14 +306,14 @@ nact_iprofile_conditions_runtime_init( NactWindow *dialog, NAActionProfile *prof
}
void
-nact_iprofile_conditions_all_widgets_showed( NactWindow *dialog )
+nact_iconditions_all_widgets_showed( NactWindow *dialog )
{
}
void
-nact_iprofile_conditions_dispose( NactWindow *dialog )
+nact_iconditions_dispose( NactWindow *dialog )
{
- static const gchar *thisfn = "nact_iprofile_conditions_dispose";
+ static const gchar *thisfn = "nact_iconditions_dispose";
g_debug( "%s: dialog=%p", thisfn, dialog );
hide_legend_dialog( dialog );
@@ -322,10 +322,10 @@ nact_iprofile_conditions_dispose( NactWindow *dialog )
static GObject *
v_get_edited_profile( NactWindow *window )
{
- g_assert( NACT_IS_IPROFILE_CONDITIONS( window ));
+ g_assert( NACT_IS_ICONDITIONS( window ));
- if( NACT_IPROFILE_CONDITIONS_GET_INTERFACE( window )->get_edited_profile ){
- return( NACT_IPROFILE_CONDITIONS_GET_INTERFACE( window )->get_edited_profile( window ));
+ if( NACT_ICONDITIONS_GET_INTERFACE( window )->get_edited_profile ){
+ return( NACT_ICONDITIONS_GET_INTERFACE( window )->get_edited_profile( window ));
}
return( NULL );
@@ -334,10 +334,10 @@ v_get_edited_profile( NactWindow *window )
static void
v_field_modified( NactWindow *window )
{
- g_assert( NACT_IS_IPROFILE_CONDITIONS( window ));
+ g_assert( NACT_IS_ICONDITIONS( window ));
- if( NACT_IPROFILE_CONDITIONS_GET_INTERFACE( window )->field_modified ){
- NACT_IPROFILE_CONDITIONS_GET_INTERFACE( window )->field_modified( window );
+ if( NACT_ICONDITIONS_GET_INTERFACE( window )->field_modified ){
+ NACT_ICONDITIONS_GET_INTERFACE( window )->field_modified( window );
}
}
@@ -357,7 +357,7 @@ on_path_changed( GtkEntry *entry, gpointer user_data )
static void
on_path_browse( GtkButton *button, gpointer user_data )
{
- g_assert( NACT_IS_IPROFILE_CONDITIONS( user_data ));
+ g_assert( NACT_IS_ICONDITIONS( user_data ));
gboolean set_current_location = FALSE;
gchar *uri = NULL;
@@ -379,7 +379,7 @@ on_path_browse( GtkButton *button, gpointer user_data )
set_current_location = gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( dialog ), path );
} else {
- uri = nact_iprefs_get_iprofile_conditions_folder_uri( NACT_WINDOW( user_data ));
+ uri = nact_iprefs_get_iconditions_folder_uri( NACT_WINDOW( user_data ));
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
g_free( uri );
}
@@ -391,7 +391,7 @@ on_path_browse( GtkButton *button, gpointer user_data )
}
uri = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( dialog ));
- nact_iprefs_save_iprofile_conditions_folder_uri( NACT_WINDOW( user_data ), uri );
+ nact_iprefs_save_iconditions_folder_uri( NACT_WINDOW( user_data ), uri );
g_free( uri );
nact_iprefs_save_named_window_position( NACT_WINDOW( user_data ), GTK_WINDOW( dialog ), IPREFS_COMMAND_CHOOSER );
@@ -427,7 +427,7 @@ get_parameters_widget( NactWindow *window )
static void
update_example_label( NactWindow *window )
{
- /*static const char *thisfn = "nact_iprofile_conditions_update_example_label";*/
+ /*static const char *thisfn = "nact_iconditions_update_example_label";*/
static const gchar *original_label = N_( "<i><b><span size=\"small\">e.g., %s</span></b></i>" );
@@ -606,7 +606,7 @@ parse_parameters( NactWindow *window )
static void
on_legend_clicked( GtkButton *button, gpointer user_data )
{
- g_assert( NACT_IS_IPROFILE_CONDITIONS( user_data ));
+ g_assert( NACT_IS_ICONDITIONS( user_data ));
if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ))){
show_legend_dialog( NACT_WINDOW( user_data ));
@@ -733,7 +733,7 @@ get_mimetypes_widget( NactWindow *window )
static void
on_isfiledir_toggled( GtkToggleButton *button, gpointer user_data )
{
- /*static const gchar *thisfn = "nact_iprofile_conditions_on_isfiledir_toggled";*/
+ /*static const gchar *thisfn = "nact_iconditions_on_isfiledir_toggled";*/
g_assert( NACT_IS_WINDOW( user_data ));
NactWindow *dialog = NACT_WINDOW( user_data );
@@ -816,7 +816,7 @@ get_multiple_button( NactWindow *window )
static void
on_scheme_selection_toggled( GtkCellRendererToggle *renderer, gchar *path, gpointer user_data )
{
- /*static const gchar *thisfn = "nact_iprofile_conditions_on_scheme_selection_toggled";*/
+ /*static const gchar *thisfn = "nact_iconditions_on_scheme_selection_toggled";*/
/*g_debug( "%s: renderer=%p, path=%s, user_data=%p", thisfn, renderer, path, user_data );*/
g_assert( NACT_IS_WINDOW( user_data ));
NactWindow *dialog = NACT_WINDOW( user_data );
@@ -848,7 +848,7 @@ on_scheme_selection_toggled( GtkCellRendererToggle *renderer, gchar *path, gpoin
static void
on_scheme_keyword_edited( GtkCellRendererText *renderer, const gchar *path, const gchar *text, gpointer user_data )
{
- /*static const gchar *thisfn = "nact_iprofile_conditions_on_scheme_keyword_edited";*/
+ /*static const gchar *thisfn = "nact_iconditions_on_scheme_keyword_edited";*/
/*g_debug( "%s: renderer=%p, path=%s, text=%s, user_data=%p", thisfn, renderer, path, text, user_data );*/
g_assert( NACT_IS_WINDOW( user_data ));
@@ -872,7 +872,7 @@ on_scheme_keyword_edited( GtkCellRendererText *renderer, const gchar *path, cons
static void
on_scheme_desc_edited( GtkCellRendererText *renderer, const gchar *path, const gchar *text, gpointer user_data )
{
- /*static const gchar *thisfn = "nact_iprofile_conditions_on_scheme_desc_edited";
+ /*static const gchar *thisfn = "nact_iconditions_on_scheme_desc_edited";
g_debug( "%s: renderer=%p, path=%s, text=%s, user_data=%p", thisfn, renderer, path, text, user_data );*/
g_assert( NACT_IS_WINDOW( user_data ));
@@ -884,7 +884,7 @@ on_scheme_desc_edited( GtkCellRendererText *renderer, const gchar *path, const g
static void
on_scheme_list_selection_changed( GtkTreeSelection *selection, gpointer user_data )
{
- /*static const gchar *thisfn = "nact_iprofile_conditions_on_scheme_list_selection_changed";
+ /*static const gchar *thisfn = "nact_iconditions_on_scheme_list_selection_changed";
g_debug( "%s: selection=%p, user_data=%p", thisfn, selection, user_data );*/
g_assert( NACT_IS_WINDOW( user_data ));
@@ -987,9 +987,9 @@ get_schemes_tree_model( NactWindow *window )
static void
create_schemes_selection_list( NactWindow *window )
{
- static const char *thisfn = "nact_iprofile_conditions_create_schemes_selection_list";
+ static const char *thisfn = "nact_iconditions_create_schemes_selection_list";
g_debug( "%s: window=%p", thisfn, window );
- g_assert( NACT_IS_IPROFILE_CONDITIONS( window ));
+ g_assert( NACT_IS_ICONDITIONS( window ));
GtkWidget *listview = GTK_WIDGET( get_schemes_tree_view( window ));
GSList* schemes_list = get_schemes_default_list( window );
@@ -1045,7 +1045,7 @@ create_schemes_selection_list( NactWindow *window )
static gboolean
get_action_schemes_list( GtkTreeModel* scheme_model, GtkTreePath *path, GtkTreeIter* iter, gpointer data )
{
- static const char *thisfn = "nact_iprofile_conditions_get_action_schemes_list";
+ static const char *thisfn = "nact_iconditions_get_action_schemes_list";
GSList** list = data;
gboolean toggle_state;
diff --git a/src/nact/nact-iprofile-conditions.h b/src/nact/nact-iconditions.h
similarity index 51%
rename from src/nact/nact-iprofile-conditions.h
rename to src/nact/nact-iconditions.h
index edd8845..13b8518 100644
--- a/src/nact/nact-iprofile-conditions.h
+++ b/src/nact/nact-iconditions.h
@@ -28,11 +28,11 @@
* ... and many others (see AUTHORS)
*/
-#ifndef __NACT_IPROFILE_CONDITIONS_H__
-#define __NACT_IPROFILE_CONDITIONS_H__
+#ifndef __NACT_ICONDITIONS_H__
+#define __NACT_ICONDITIONS_H__
/*
- * NactIProfileConditions interface definition.
+ * NactIConditions interface definition.
*
* This interface implements all the widgets which define the
* conditions for the action.
@@ -44,36 +44,36 @@
G_BEGIN_DECLS
-#define NACT_IPROFILE_CONDITIONS_TYPE ( nact_iprofile_conditions_get_type())
-#define NACT_IPROFILE_CONDITIONS( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IPROFILE_CONDITIONS_TYPE, NactIProfileConditions ))
-#define NACT_IS_IPROFILE_CONDITIONS( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IPROFILE_CONDITIONS_TYPE ))
-#define NACT_IPROFILE_CONDITIONS_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IPROFILE_CONDITIONS_TYPE, NactIProfileConditionsInterface ))
+#define NACT_ICONDITIONS_TYPE ( nact_iconditions_get_type())
+#define NACT_ICONDITIONS( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_ICONDITIONS_TYPE, NactIConditions ))
+#define NACT_IS_ICONDITIONS( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_ICONDITIONS_TYPE ))
+#define NACT_ICONDITIONS_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_ICONDITIONS_TYPE, NactIConditionsInterface ))
-typedef struct NactIProfileConditions NactIProfileConditions;
+typedef struct NactIConditions NactIConditions;
-typedef struct NactIProfileConditionsInterfacePrivate NactIProfileConditionsInterfacePrivate;
+typedef struct NactIConditionsInterfacePrivate NactIConditionsInterfacePrivate;
typedef struct {
GTypeInterface parent;
- NactIProfileConditionsInterfacePrivate *private;
+ NactIConditionsInterfacePrivate *private;
/* api */
GObject * ( *get_edited_profile )( NactWindow *window );
void ( *field_modified ) ( NactWindow *window );
}
- NactIProfileConditionsInterface;
+ NactIConditionsInterface;
-GType nact_iprofile_conditions_get_type( void );
+GType nact_iconditions_get_type( void );
-void nact_iprofile_conditions_initial_load( NactWindow *dialog, NAActionProfile *profile );
-void nact_iprofile_conditions_size_labels( NactWindow *window, GObject *size_group );
-void nact_iprofile_conditions_size_buttons( NactWindow *window, GObject *size_group );
+void nact_iconditions_initial_load( NactWindow *dialog, NAActionProfile *profile );
+void nact_iconditions_size_labels( NactWindow *window, GObject *size_group );
+void nact_iconditions_size_buttons( NactWindow *window, GObject *size_group );
-void nact_iprofile_conditions_runtime_init( NactWindow *dialog, NAActionProfile *profile );
-void nact_iprofile_conditions_all_widgets_showed( NactWindow *dialog );
+void nact_iconditions_runtime_init( NactWindow *dialog, NAActionProfile *profile );
+void nact_iconditions_all_widgets_showed( NactWindow *dialog );
-void nact_iprofile_conditions_dispose( NactWindow *dialog );
+void nact_iconditions_dispose( NactWindow *dialog );
G_END_DECLS
-#endif /* __NACT_IPROFILE_CONDITIONS_H__ */
+#endif /* __NACT_ICONDITIONS_H__ */
diff --git a/src/nact/nact-iprefs.c b/src/nact/nact-iprefs.c
index fbe690a..85d2656 100644
--- a/src/nact/nact-iprefs.c
+++ b/src/nact/nact-iprefs.c
@@ -50,7 +50,7 @@ struct NactIPrefsInterfacePrivate {
/* key to read/write the last visited folder when browsing for a file
*/
-#define IPREFS_IPROFILE_CONDITION_FOLDER_URI "iprofile-conditions-folder-uri"
+#define IPREFS_ICONDITION_FOLDER_URI "iconditions-folder-uri"
#define IPREFS_IMPORT_ACTIONS_FOLDER_URI "import-folder-uri"
#define IPREFS_EXPORT_ACTIONS_FOLDER_URI "export-folder-uri"
@@ -226,7 +226,7 @@ nact_iprefs_save_named_window_position( NactWindow *window, GtkWindow *toplevel,
/**
* Save the last visited folder when browsing for command in
- * IProfileConditions interface.
+ * IConditions interface.
*
* @window: this NactWindow-derived window.
*
@@ -234,15 +234,15 @@ nact_iprefs_save_named_window_position( NactWindow *window, GtkWindow *toplevel,
* The returned string must be g_free by the caller.
*/
gchar *
-nact_iprefs_get_iprofile_conditions_folder_uri( NactWindow *window )
+nact_iprefs_get_iconditions_folder_uri( NactWindow *window )
{
- return( read_key_str( window, IPREFS_IPROFILE_CONDITION_FOLDER_URI ));
+ return( read_key_str( window, IPREFS_ICONDITION_FOLDER_URI ));
}
void
-nact_iprefs_save_iprofile_conditions_folder_uri( NactWindow *window, const gchar *uri )
+nact_iprefs_save_iconditions_folder_uri( NactWindow *window, const gchar *uri )
{
- save_key_str( window, IPREFS_IPROFILE_CONDITION_FOLDER_URI, uri );
+ save_key_str( window, IPREFS_ICONDITION_FOLDER_URI, uri );
}
/**
diff --git a/src/nact/nact-iprefs.h b/src/nact/nact-iprefs.h
index 392cf28..6ba72ef 100644
--- a/src/nact/nact-iprefs.h
+++ b/src/nact/nact-iprefs.h
@@ -71,8 +71,8 @@ void nact_iprefs_position_named_window( NactWindow *window, GtkWindow *topleve
void nact_iprefs_save_window_position( NactWindow *window );
void nact_iprefs_save_named_window_position( NactWindow *window, GtkWindow *toplevel, const gchar *name );
-gchar *nact_iprefs_get_iprofile_conditions_folder_uri( NactWindow *window );
-void nact_iprefs_save_iprofile_conditions_folder_uri( NactWindow *window, const gchar *uri );
+gchar *nact_iprefs_get_iconditions_folder_uri( NactWindow *window );
+void nact_iprefs_save_iconditions_folder_uri( NactWindow *window, const gchar *uri );
gchar *nact_iprefs_get_import_folder_uri( NactWindow *window );
void nact_iprefs_save_import_folder_uri( NactWindow *window, const gchar *uri );
diff --git a/src/nact/nact-iprofile-item.c b/src/nact/nact-iprofile-item.c
new file mode 100644
index 0000000..bbdc4e1
--- /dev/null
+++ b/src/nact/nact-iprofile-item.c
@@ -0,0 +1,237 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+#include <string.h>
+
+#include <common/na-action.h>
+#include <common/na-action-profile.h>
+
+#include "nact-application.h"
+#include "nact-iprofile-item.h"
+
+/* private interface data
+ */
+struct NactIProfileItemInterfacePrivate {
+};
+
+static GType register_type( void );
+static void interface_base_init( NactIProfileItemInterface *klass );
+static void interface_base_finalize( NactIProfileItemInterface *klass );
+
+static GObject *v_get_edited_profile( NactWindow *window );
+static void v_field_modified( NactWindow *window );
+
+static void on_label_changed( GtkEntry *entry, gpointer user_data );
+
+GType
+nact_iprofile_item_get_type( void )
+{
+ static GType iface_type = 0;
+
+ if( !iface_type ){
+ iface_type = register_type();
+ }
+
+ return( iface_type );
+}
+
+static GType
+register_type( void )
+{
+ static const gchar *thisfn = "nact_iprofile_item_register_type";
+ g_debug( "%s", thisfn );
+
+ static const GTypeInfo info = {
+ sizeof( NactIProfileItemInterface ),
+ ( GBaseInitFunc ) interface_base_init,
+ ( GBaseFinalizeFunc ) interface_base_finalize,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIProfileItem", &info, 0 );
+
+ g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
+
+ return( type );
+}
+
+static void
+interface_base_init( NactIProfileItemInterface *klass )
+{
+ static const gchar *thisfn = "nact_iprofile_item_interface_base_init";
+ static gboolean initialized = FALSE;
+
+ if( !initialized ){
+ g_debug( "%s: klass=%p", thisfn, klass );
+
+ klass->private = g_new0( NactIProfileItemInterfacePrivate, 1 );
+
+ klass->get_edited_profile = NULL;
+ klass->field_modified = NULL;
+
+ initialized = TRUE;
+ }
+}
+
+static void
+interface_base_finalize( NactIProfileItemInterface *klass )
+{
+ static const gchar *thisfn = "nact_iprofile_item_interface_base_finalize";
+ static gboolean finalized = FALSE ;
+
+ if( !finalized ){
+ g_debug( "%s: klass=%p", thisfn, klass );
+
+ g_free( klass->private );
+
+ finalized = TRUE;
+ }
+}
+
+void
+nact_iprofile_item_initial_load( NactWindow *dialog, NAActionProfile *profile )
+{
+ static const gchar *thisfn = "nact_iprofile_item_initial_load";
+ g_debug( "%s: dialog=%p, profile=%p", thisfn, dialog, profile );
+
+ /*BaseApplication *appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( dialog )));
+ GtkWindow *toplevel = base_application_get_dialog( appli, "MenuItemWindow" );
+ GtkWidget *vbox = base_application_search_for_widget( appli, toplevel, "MenuItemVBox" );
+ GtkWidget *dest = base_application_get_widget( appli, BASE_WINDOW( dialog ), "MenuItemVBox" );
+ gtk_widget_reparent( vbox, dest );*/
+}
+
+void
+nact_iprofile_item_size_labels( NactWindow *window, GObject *size_group )
+{
+ g_assert( NACT_IS_WINDOW( window ));
+ g_assert( GTK_IS_SIZE_GROUP( size_group ));
+
+ GtkWidget *label = base_window_get_widget( BASE_WINDOW( window ), "ProfileLabelLabel" );
+ gtk_size_group_add_widget( GTK_SIZE_GROUP( size_group ), label );
+}
+
+void
+nact_iprofile_item_size_buttons( NactWindow *window, GObject *size_group )
+{
+ g_assert( NACT_IS_WINDOW( window ));
+ g_assert( GTK_IS_SIZE_GROUP( size_group ));
+}
+
+void
+nact_iprofile_item_runtime_init( NactWindow *dialog, NAActionProfile *profile )
+{
+ static const gchar *thisfn = "nact_iprofile_item_runtime_init";
+ g_debug( "%s: dialog=%p, profile=%p", thisfn, dialog, profile );
+
+ GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ProfileLabelEntry" );
+ nact_window_signal_connect( dialog, G_OBJECT( label_widget ), "changed", G_CALLBACK( on_label_changed ));
+ gchar *label = na_action_profile_get_label( profile );
+ gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
+ g_free( label );
+}
+
+/**
+ * A good place to set focus to the first visible field.
+ */
+void
+nact_iprofile_item_all_widgets_showed( NactWindow *dialog )
+{
+ GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ProfileLabelEntry" );
+ gtk_widget_grab_focus( label_widget );
+}
+
+/**
+ * A profile can only be saved if it has at least a label.
+ * Returns TRUE if the label of the profile is not empty.
+ */
+gboolean
+nact_iprofile_item_has_label( NactWindow *window )
+{
+ GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( window ), "ProfileLabelEntry" );
+ const gchar *label = gtk_entry_get_text( GTK_ENTRY( label_widget ));
+ return( g_utf8_strlen( label, -1 ) > 0 );
+}
+
+void
+nact_iprofile_item_dispose( NactWindow *dialog )
+{
+ static const gchar *thisfn = "nact_iprofile_item_dispose";
+ g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ /*BaseApplication *appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( dialog )));
+ GtkWindow *toplevel = base_application_get_dialog( appli, "MenuItemWindow" );
+ GtkWidget *vbox = base_application_get_widget( appli, BASE_WINDOW( dialog ), "MenuItemVBox" );
+ gtk_widget_reparent( vbox, GTK_WIDGET( toplevel ));*/
+}
+
+static GObject *
+v_get_edited_profile( NactWindow *window )
+{
+ g_assert( NACT_IS_IPROFILE_ITEM( window ));
+
+ if( NACT_IPROFILE_ITEM_GET_INTERFACE( window )->get_edited_profile ){
+ return( NACT_IPROFILE_ITEM_GET_INTERFACE( window )->get_edited_profile( window ));
+ }
+
+ return( NULL );
+}
+
+static void
+v_field_modified( NactWindow *window )
+{
+ g_assert( NACT_IS_IPROFILE_ITEM( window ));
+
+ if( NACT_IPROFILE_ITEM_GET_INTERFACE( window )->field_modified ){
+ NACT_IPROFILE_ITEM_GET_INTERFACE( window )->field_modified( window );
+ }
+}
+
+static void
+on_label_changed( GtkEntry *entry, gpointer user_data )
+{
+ g_assert( NACT_IS_WINDOW( user_data ));
+ NactWindow *dialog = NACT_WINDOW( user_data );
+
+ NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
+ na_action_profile_set_label( edited, gtk_entry_get_text( entry ));
+
+ v_field_modified( dialog );
+}
diff --git a/src/nact/nact-iprofile-item.h b/src/nact/nact-iprofile-item.h
new file mode 100644
index 0000000..c3e1b77
--- /dev/null
+++ b/src/nact/nact-iprofile-item.h
@@ -0,0 +1,80 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifndef __NACT_IPROFILE_ITEM_H__
+#define __NACT_IPROFILE_ITEM_H__
+
+/*
+ * NactIProfileItem interface definition.
+ *
+ * This interface implements the "Nautilus Menu Item" box.
+ */
+
+#include <common/na-action-profile.h>
+
+#include "nact-window.h"
+
+G_BEGIN_DECLS
+
+#define NACT_IPROFILE_ITEM_TYPE ( nact_iprofile_item_get_type())
+#define NACT_IPROFILE_ITEM( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IPROFILE_ITEM_TYPE, NactIProfileItem ))
+#define NACT_IS_IPROFILE_ITEM( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IPROFILE_ITEM_TYPE ))
+#define NACT_IPROFILE_ITEM_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IPROFILE_ITEM_TYPE, NactIProfileItemInterface ))
+
+typedef struct NactIProfileItem NactIProfileItem;
+
+typedef struct NactIProfileItemInterfacePrivate NactIProfileItemInterfacePrivate;
+
+typedef struct {
+ GTypeInterface parent;
+ NactIProfileItemInterfacePrivate *private;
+
+ /* api */
+ GObject * ( *get_edited_profile )( NactWindow *window );
+ void ( *field_modified ) ( NactWindow *window );
+}
+ NactIProfileItemInterface;
+
+GType nact_iprofile_item_get_type( void );
+
+void nact_iprofile_item_initial_load( NactWindow *dialog, NAActionProfile *profile );
+void nact_iprofile_item_size_labels( NactWindow *window, GObject *size_group );
+void nact_iprofile_item_size_buttons( NactWindow *window, GObject *size_group );
+
+void nact_iprofile_item_runtime_init( NactWindow *dialog, NAActionProfile *profile );
+void nact_iprofile_item_all_widgets_showed( NactWindow *dialog );
+
+gboolean nact_iprofile_item_has_label( NactWindow *window );
+
+void nact_iprofile_item_dispose( NactWindow *dialog );
+
+G_END_DECLS
+
+#endif /* __NACT_IPROFILE_ITEM_H__ */
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index d3cc00f..e9b9059 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -475,19 +475,13 @@ on_edit_button_clicked( GtkButton *button, gpointer user_data )
NactWindow *wndmain = NACT_WINDOW( user_data );
NAAction *action = NA_ACTION( nact_iactions_list_get_selected_action( wndmain ));
+ g_assert( action );
+ g_assert( NA_IS_ACTION( action ));
- if( action ){
- guint count = na_action_get_profiles_count( action );
-
- if( count > 1 ){
- nact_action_profiles_editor_run_editor( wndmain, action );
-
- } else {
- nact_action_conditions_editor_run_editor( wndmain, action );
- }
-
+ if( na_action_get_profiles_count( action ) > 1 ){
+ nact_action_profiles_editor_run_editor( wndmain, action );
} else {
- g_assert_not_reached();
+ nact_action_conditions_editor_run_editor( wndmain, action );
}
nact_iactions_list_set_focus( wndmain );
diff --git a/src/nact/nact-profile-conditions-editor.c b/src/nact/nact-profile-conditions-editor.c
index 6f51856..f581c70 100644
--- a/src/nact/nact-profile-conditions-editor.c
+++ b/src/nact/nact-profile-conditions-editor.c
@@ -35,11 +35,12 @@
#include <glib/gi18n.h>
#include <common/na-action.h>
+#include <common/na-action-profile.h>
#include "nact-application.h"
#include "nact-profile-conditions-editor.h"
-#include "nact-iprofile-conditions.h"
-#include "nact-main-window.h"
+#include "nact-iprofile-item.h"
+#include "nact-iconditions.h"
/* private class data
*/
@@ -49,27 +50,38 @@ struct NactProfileConditionsEditorClassPrivate {
/* private instance data
*/
struct NactProfileConditionsEditorPrivate {
- gboolean dispose_has_run;
- NAAction *action;
- gboolean is_new;
+ gboolean dispose_has_run;
+ NactWindow *parent;
+ NAAction *original_action;
+ NAActionProfile *original_profile;
+ gboolean saved;
+ gboolean is_new;
+ NAAction *edited_action;
+ NAActionProfile *edited_profile;
};
static GObjectClass *st_parent_class = NULL;
static GType register_type( void );
static void class_init( NactProfileConditionsEditorClass *klass );
-static void iprofile_conditions_iface_init( NactIProfileConditionsInterface *iface );
+static void iprofile_item_iface_init( NactIConditionsInterface *iface );
+static void iconditions_iface_init( NactIConditionsInterface *iface );
static void instance_init( GTypeInstance *instance, gpointer klass );
static void instance_dispose( GObject *dialog );
static void instance_finalize( GObject *dialog );
static NactProfileConditionsEditor *profile_conditions_editor_new( BaseApplication *application );
+static gchar *do_get_iprefs_window_id( NactWindow *window );
static gchar *do_get_dialog_name( BaseWindow *dialog );
static void on_initial_load_dialog( BaseWindow *dialog );
static void on_runtime_init_dialog( BaseWindow *dialog );
-static void init_dialog_title( NactProfileConditionsEditor *dialog );
+static void setup_dialog_title( NactProfileConditionsEditor *dialog, gboolean is_modified );
+static void setup_buttons( NactProfileConditionsEditor *dialog, gboolean can_save );
+static void on_modified_field( NactWindow *dialog );
static gboolean on_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
+static GObject *get_edited_profile( NactWindow *window );
+static gboolean is_edited_modified( NactProfileConditionsEditor *editor );
GType
nact_profile_conditions_editor_get_type( void )
@@ -103,15 +115,25 @@ register_type( void )
GType type = g_type_register_static( NACT_WINDOW_TYPE, "NactProfileConditionsEditor", &info, 0 );
- /* implement IProfileConditions interface
+ /* implement IProfileItem interface
*/
- static const GInterfaceInfo iprofile_conditions_iface_info = {
- ( GInterfaceInitFunc ) iprofile_conditions_iface_init,
+ static const GInterfaceInfo iprofile_item_iface_info = {
+ ( GInterfaceInitFunc ) iprofile_item_iface_init,
NULL,
NULL
};
- g_type_add_interface_static( type, NACT_IPROFILE_CONDITIONS_TYPE, &iprofile_conditions_iface_info );
+ g_type_add_interface_static( type, NACT_IPROFILE_ITEM_TYPE, &iprofile_item_iface_info );
+
+ /* implement IConditions interface
+ */
+ static const GInterfaceInfo iconditions_iface_info = {
+ ( GInterfaceInitFunc ) iconditions_iface_init,
+ NULL,
+ NULL
+ };
+
+ g_type_add_interface_static( type, NACT_ICONDITIONS_TYPE, &iconditions_iface_info );
return( type );
}
@@ -131,17 +153,33 @@ class_init( NactProfileConditionsEditorClass *klass )
klass->private = g_new0( NactProfileConditionsEditorClassPrivate, 1 );
BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
+ base_class->get_toplevel_name = do_get_dialog_name;
base_class->initial_load_toplevel = on_initial_load_dialog;
base_class->runtime_init_toplevel = on_runtime_init_dialog;
base_class->dialog_response = on_dialog_response;
- base_class->get_toplevel_name = do_get_dialog_name;
+
+ NactWindowClass *nact_class = NACT_WINDOW_CLASS( klass );
+ nact_class->get_iprefs_window_id = do_get_iprefs_window_id;
+}
+
+static void
+iprofile_item_iface_init( NactIConditionsInterface *iface )
+{
+ static const gchar *thisfn = "nact_profile_conditions_editor_iprofile_item_iface_init";
+ g_debug( "%s: iface=%p", thisfn, iface );
+
+ iface->get_edited_profile = get_edited_profile;
+ iface->field_modified = on_modified_field;
}
static void
-iprofile_conditions_iface_init( NactIProfileConditionsInterface *iface )
+iconditions_iface_init( NactIConditionsInterface *iface )
{
- static const gchar *thisfn = "nact_profile_conditions_editor_iprofile_conditions_iface_init";
+ static const gchar *thisfn = "nact_profile_conditions_editor_iconditions_iface_init";
g_debug( "%s: iface=%p", thisfn, iface );
+
+ iface->get_edited_profile = get_edited_profile;
+ iface->field_modified = on_modified_field;
}
static void
@@ -171,6 +209,9 @@ instance_dispose( GObject *dialog )
self->private->dispose_has_run = TRUE;
+ g_object_unref( self->private->original_action );
+ g_object_unref( self->private->edited_action );
+
/* chain up to the parent class */
G_OBJECT_CLASS( st_parent_class )->dispose( dialog );
}
@@ -183,7 +224,9 @@ instance_finalize( GObject *dialog )
g_debug( "%s: dialog=%p", thisfn, dialog );
g_assert( NACT_IS_PROFILE_CONDITIONS_EDITOR( dialog ));
- /*NactProfileConditionsEditor *self = ( NactProfileConditionsEditor * ) dialog;*/
+ NactProfileConditionsEditor *self = ( NactProfileConditionsEditor * ) dialog;
+
+ g_free( self->private );
/* chain call to parent class */
if( st_parent_class->finalize ){
@@ -191,7 +234,7 @@ instance_finalize( GObject *dialog )
}
}
-/**
+/*
* Returns a newly allocated NactProfileConditionsEditor object.
*
* @parent: is the BaseWindow parent of this dialog (usually, the main
@@ -209,45 +252,62 @@ profile_conditions_editor_new( BaseApplication *application )
* @parent: is the BaseWindow parent of this dialog (usually, the main
* toplevel window of the application).
*
- * @user_data: a pointer to the NAAction to edit, or NULL. If NULL, a
- * new NAAction is created.
+ * @action: the NAAction to which belongs the profile to edit.
*
- * Returns TRUE if the NAAction has been edited and saved, or FALSE if
- * there has been no modification at all.
+ * @profile: the NAActionProfile to be edited, or NULL to create a new one.
+ *
+ * Returns the modified action, or NULL if no modification has been
+ * validated.
*/
-gboolean
-nact_profile_conditions_editor_run_editor( NactWindow *parent, gpointer user_data )
+NAAction *
+nact_profile_conditions_editor_run_editor( NactWindow *parent, NAAction *action, NAActionProfile *profile )
{
- g_assert( NACT_IS_MAIN_WINDOW( parent ));
-
BaseApplication *application = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( parent )));
g_assert( NACT_IS_APPLICATION( application ));
- NactProfileConditionsEditor *dialog = profile_conditions_editor_new( application );
+ NactProfileConditionsEditor *editor = profile_conditions_editor_new( application );
+ editor->private->parent = parent;
- g_assert( NA_IS_ACTION( user_data ) || !user_data );
- NAAction *action = NA_ACTION( user_data );
+ g_assert( action );
+ g_assert( NA_IS_ACTION( action ));
+ g_assert( NA_IS_ACTION_PROFILE( profile ) || !profile );
- if( !action ){
- dialog->private->action = na_action_new( NULL );
- dialog->private->is_new = TRUE;
+ gchar *name;
+ editor->private->original_action = na_action_duplicate( action );
+
+ if( !profile ){
+ name = na_action_get_new_profile_name( action );
+ NAActionProfile *new_profile = na_action_profile_new( NA_OBJECT( editor->private->original_action ), name );
+ na_action_add_profile( editor->private->original_action, NA_OBJECT( new_profile ));
+ editor->private->original_profile = new_profile;
+ editor->private->is_new = TRUE;
} else {
- dialog->private->action = na_action_duplicate( action );
- dialog->private->is_new = FALSE;
+ name = na_action_profile_get_name( profile );
+ editor->private->original_profile = NA_ACTION_PROFILE( na_action_get_profile( editor->private->original_action, name ));
+ editor->private->is_new = FALSE;
}
- base_window_run( BASE_WINDOW( dialog ));
+ editor->private->edited_action = na_action_duplicate( editor->private->original_action );
+ editor->private->edited_profile = NA_ACTION_PROFILE( na_action_get_profile( editor->private->edited_action, name ));
+
+ g_free( name );
- g_object_unref( dialog->private->action );
- return( TRUE );
+ base_window_run( BASE_WINDOW( editor ));
+
+ return( editor->private->saved ? editor->private->original_action : NULL );
+}
+
+static gchar *
+do_get_iprefs_window_id( NactWindow *window )
+{
+ return( g_strdup( "profile-conditions-editor" ));
}
static gchar *
do_get_dialog_name( BaseWindow *dialog )
{
- /*g_debug( "nact_profile_conditions_editor_do_get_dialog_name" );*/
- return( g_strdup( "EditActionDialogExt"));
+ return( g_strdup( "ProfileConditionsDialog"));
}
static void
@@ -257,10 +317,10 @@ on_initial_load_dialog( BaseWindow *dialog )
g_debug( "%s: dialog=%p", thisfn, dialog );
g_assert( NACT_IS_PROFILE_CONDITIONS_EDITOR( dialog ));
- NactProfileConditionsEditor *window = NACT_PROFILE_CONDITIONS_EDITOR( dialog );
+ NactProfileConditionsEditor *editor = NACT_PROFILE_CONDITIONS_EDITOR( dialog );
- init_dialog_title( window );
- /*nact_iprofile_conditions_initial_load( NACT_WINDOW( window ), window->private->action );*/
+ nact_iprofile_item_initial_load( NACT_WINDOW( editor ), editor->private->edited_profile );
+ nact_iconditions_initial_load( NACT_WINDOW( editor ), editor->private->edited_profile );
}
static void
@@ -270,27 +330,87 @@ on_runtime_init_dialog( BaseWindow *dialog )
g_debug( "%s: dialog=%p", thisfn, dialog );
g_assert( NACT_IS_PROFILE_CONDITIONS_EDITOR( dialog ));
- NactProfileConditionsEditor *window = NACT_PROFILE_CONDITIONS_EDITOR( dialog );
+ NactProfileConditionsEditor *editor = NACT_PROFILE_CONDITIONS_EDITOR( dialog );
+
+ GtkWindow *toplevel = base_window_get_toplevel_dialog( dialog );
+ GtkWindow *parent_toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( editor->private->parent ));
+ gtk_window_set_transient_for( toplevel, parent_toplevel );
- init_dialog_title( window );
- /*nact_iprofile_conditions_runtime_init( NACT_WINDOW( window ), window->private->action );*/
+ setup_dialog_title( editor, FALSE );
+
+ nact_iprofile_item_runtime_init( NACT_WINDOW( editor ), editor->private->edited_profile );
+ nact_iconditions_runtime_init( NACT_WINDOW( editor ), editor->private->edited_profile );
}
static void
-init_dialog_title( NactProfileConditionsEditor *dialog )
+setup_dialog_title( NactProfileConditionsEditor *editor, gboolean is_modified )
{
- GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( dialog ));
+ gchar *title;
+ gchar *label;
- if( dialog->private->is_new ){
- gtk_window_set_title( toplevel, _( "Adding a new action" ));
+ if( editor->private->is_new ){
+ /* i18n: title of the window when adding a new profile to an existing action */
+ title = g_strdup( _( "Adding a new profile" ));
} else {
- gchar *label = na_action_get_label( dialog->private->action );
- gchar* title = g_strdup_printf( _( "Editing \"%s\" action" ), label );
- gtk_window_set_title( toplevel, title );
+ label = na_action_profile_get_label( editor->private->original_profile );
+ /* i18n: title of the window when editing a profile */
+ title = g_strdup_printf( _( "Editing \"%s\" profile" ), label );
g_free( label );
+ }
+
+ if( is_modified ){
+ gchar *tmp = g_strdup_printf( "*%s", title );
g_free( title );
+ title = tmp;
}
+
+ GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( editor ));
+ gtk_window_set_title( toplevel, title );
+ g_free( title );
+}
+
+/*
+ * rationale:
+ * - while the action or the profile are not modified, only the cancel
+ * button is activated (showed as close)
+ * - when the mono-profile action is modified, we have a save and a
+ * cancel buttons (a label is mandatory to enable the save button)
+ * - when editing a profile, we have a OK and an cancel buttons
+ * (profile label is mandatory) as the actual save will take place in
+ * the NactActionProfilesEditor parent window
+ */
+static void
+setup_buttons( NactProfileConditionsEditor *editor, gboolean can_save )
+{
+ GtkWidget *cancel_button = gtk_button_new_from_stock( GTK_STOCK_CANCEL );
+ GtkWidget *close_button = gtk_button_new_from_stock( GTK_STOCK_CLOSE );
+
+ GtkWidget *dlg_cancel = base_window_get_widget( BASE_WINDOW( editor ), "CancelButton" );
+ gtk_button_set_label( GTK_BUTTON( dlg_cancel ), can_save ? _( "_Cancel" ) : _( "_Close" ));
+ gtk_button_set_image( GTK_BUTTON( dlg_cancel ), can_save ? gtk_button_get_image( GTK_BUTTON( cancel_button )) : gtk_button_get_image( GTK_BUTTON( close_button )));
+
+ gtk_widget_destroy( close_button );
+ gtk_widget_destroy( cancel_button );
+
+ GtkWidget *dlg_ok = base_window_get_widget( BASE_WINDOW( editor ), "OKButton" );
+ gtk_widget_set_sensitive( dlg_ok, can_save );
+}
+
+static void
+on_modified_field( NactWindow *window )
+{
+ /*static const gchar *thisfn = "nact_profile_conditions_editor_on_modified_field";*/
+
+ g_assert( NACT_IS_PROFILE_CONDITIONS_EDITOR( window ));
+ NactProfileConditionsEditor *editor = ( NACT_PROFILE_CONDITIONS_EDITOR( window ));
+
+ gboolean is_modified = is_edited_modified( editor );
+ setup_dialog_title( editor, is_modified );
+
+ gboolean can_save = is_modified && nact_iprofile_item_has_label( window );
+
+ setup_buttons( editor, can_save );
}
static gboolean
@@ -300,14 +420,49 @@ on_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window )
g_debug( "%s: dialog=%p, code=%d, window=%p", thisfn, dialog, code, window );
g_assert( NACT_IS_PROFILE_CONDITIONS_EDITOR( window ));
+ NactProfileConditionsEditor *editor = NACT_PROFILE_CONDITIONS_EDITOR( window );
+
+ gboolean is_modified = is_edited_modified( editor );
switch( code ){
case GTK_RESPONSE_NONE:
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CLOSE:
- g_object_unref( window );
+ case GTK_RESPONSE_CANCEL:
+ if( !is_modified ||
+ nact_window_warn_profile_modified( NACT_WINDOW( dialog ), editor->private->original_profile )){
+
+ g_object_unref( window );
+ return( TRUE );
+ }
+ break;
+
+ case GTK_RESPONSE_OK:
+ if( is_modified ){
+ g_object_unref( editor->private->original_action );
+ editor->private->original_action = na_action_duplicate( editor->private->edited_action );
+ gchar *name = na_action_profile_get_name( editor->private->edited_profile );
+ editor->private->original_profile = NA_ACTION_PROFILE( na_action_get_profile( editor->private->original_action, name ));
+ g_free( name );
+ editor->private->is_new = FALSE;
+ editor->private->saved = TRUE;
+ on_modified_field( NACT_WINDOW( dialog ));
+ }
break;
}
- return( TRUE );
+ return( FALSE );
+}
+
+static GObject *
+get_edited_profile( NactWindow *window )
+{
+ g_assert( NACT_IS_PROFILE_CONDITIONS_EDITOR( window ));
+ return( G_OBJECT( NACT_PROFILE_CONDITIONS_EDITOR( window )->private->edited_profile ));
+}
+
+static gboolean
+is_edited_modified( NactProfileConditionsEditor *editor )
+{
+ return( !na_action_are_equal( editor->private->original_action, editor->private->edited_action ));
}
diff --git a/src/nact/nact-profile-conditions-editor.h b/src/nact/nact-profile-conditions-editor.h
index a10d32c..9be4752 100644
--- a/src/nact/nact-profile-conditions-editor.h
+++ b/src/nact/nact-profile-conditions-editor.h
@@ -65,9 +65,9 @@ typedef struct {
}
NactProfileConditionsEditorClass;
-GType nact_profile_conditions_editor_get_type( void );
+GType nact_profile_conditions_editor_get_type( void );
-gboolean nact_profile_conditions_editor_run_editor( NactWindow *parent, gpointer user_data );
+NAAction *nact_profile_conditions_editor_run_editor( NactWindow *parent, NAAction *action, NAActionProfile *profile );
G_END_DECLS
diff --git a/src/nact/nact-window.c b/src/nact/nact-window.c
index 9e54177..4bb6e58 100644
--- a/src/nact/nact-window.c
+++ b/src/nact/nact-window.c
@@ -309,6 +309,37 @@ nact_window_warn_action_modified( NactWindow *window, const NAAction *action )
}
/**
+ * Emits a warning if the profile has been modified.
+ *
+ * @window: this NactWindow object.
+ *
+ * @profile: the modified profile.
+ *
+ * Returns TRUE if the user confirms he wants to quit.
+ */
+gboolean
+nact_window_warn_profile_modified( NactWindow *window, const NAActionProfile *profile )
+{
+ gchar *label = na_action_profile_get_label( profile );
+
+ gchar *first;
+ if( label && strlen( label )){
+ first = g_strdup_printf( _( "The profile \"%s\" has been modified." ), label );
+ } else {
+ first = g_strdup( _( "The newly created profile has been modified." ));
+ }
+ gchar *second = g_strdup( _( "Are you sure you want to quit without saving it ?" ));
+
+ gboolean ok = base_window_yesno_dlg( BASE_WINDOW( window ), GTK_MESSAGE_QUESTION, first, second );
+
+ g_free( second );
+ g_free( first );
+ g_free( label );
+
+ return( ok );
+}
+
+/**
* Records a connected signal, to be disconnected at NactWindow dispose.
*/
void
diff --git a/src/nact/nact-window.h b/src/nact/nact-window.h
index e2cb8e8..d1b2498 100644
--- a/src/nact/nact-window.h
+++ b/src/nact/nact-window.h
@@ -39,6 +39,7 @@
*/
#include <common/na-action.h>
+#include <common/na-action-profile.h>
#include "base-window.h"
@@ -79,6 +80,7 @@ void nact_window_set_current_action( NactWindow *window, const NAAction *act
gboolean nact_window_save_action( NactWindow *window, const NAAction *action );
gboolean nact_window_warn_action_modified( NactWindow *window, const NAAction *action );
+gboolean nact_window_warn_profile_modified( NactWindow *window, const NAActionProfile *profile );
void nact_window_signal_connect( NactWindow *window, GObject *instance, const gchar *signal, GCallback fn );
void nact_window_signal_connect_by_name( NactWindow *window, const gchar *name, const gchar *signal, GCallback fn );
diff --git a/src/nact/nautilus-actions-config.ui b/src/nact/nautilus-actions-config.ui
index cba0e1b..2ed9214 100644
--- a/src/nact/nautilus-actions-config.ui
+++ b/src/nact/nautilus-actions-config.ui
@@ -78,7 +78,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="image">DuplicateButtonImage</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -196,16 +195,14 @@
<action-widget response="-7">CloseButton</action-widget>
</action-widgets>
</object>
- <object class="GtkDialog" id="EditActionDialogExt">
+ <object class="GtkDialog" id="ActionConditionsDialog">
<property name="modal">True</property>
- <property name="default_width">400</property>
- <property name="default_height">430</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
<child>
- <object class="GtkNotebook" id="notebook2">
+ <object class="GtkNotebook" id="Notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="border_width">6</property>
@@ -213,8 +210,9 @@
<object class="GtkVBox" id="vbox399">
<property name="visible">True</property>
<property name="border_width">10</property>
+ <property name="spacing">10</property>
<child>
- <object class="GtkVBox" id="vbox1">
+ <object class="GtkVBox" id="MenuItemVBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
@@ -373,11 +371,13 @@
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox396">
+ <object class="GtkVBox" id="ActionVBox">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
@@ -515,6 +515,8 @@
</child>
</object>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@@ -1099,8 +1101,8 @@ file(s)/folder(s)</property>
</object>
</child>
</object>
- <object class="GtkDialog" id="EditActionDialog">
- <property name="title" translatable="yes">Nautilus Action Editor</property>
+ <object class="GtkDialog" id="ActionProfilesDialog">
+ <property name="modal">True</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox9">
@@ -1322,8 +1324,8 @@ file(s)/folder(s)</property>
<property name="spacing">3</property>
<property name="layout_style">start</property>
<child>
- <object class="GtkButton" id="AddProfileButton">
- <property name="label">gtk-add</property>
+ <object class="GtkButton" id="NewProfileButton">
+ <property name="label">gtk-new</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@@ -1353,14 +1355,15 @@ file(s)/folder(s)</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="CopyProfileButton">
- <property name="label">gtk-copy</property>
+ <object class="GtkButton" id="DuplicateProfileButton">
+ <property name="label">D_uplicate</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
- <property name="use_stock">True</property>
+ <property name="image">DuplicateButtonImage</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1369,8 +1372,8 @@ file(s)/folder(s)</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="PasteProfileButton">
- <property name="label">gtk-paste</property>
+ <object class="GtkButton" id="DeleteProfileButton">
+ <property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
@@ -1384,27 +1387,595 @@ file(s)/folder(s)</property>
<property name="position">3</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area9">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="CancelButton">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="SaveButton">
+ <property name="label">gtk-save</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">CancelButton</action-widget>
+ <action-widget response="-5">SaveButton</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="ProfileConditionsDialog">
+ <property name="border_width">5</property>
+ <property name="modal">True</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox4">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkNotebook" id="notebook2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">6</property>
+ <child>
+ <object class="GtkVBox" id="vbox399">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Profile</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Label :</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
- <object class="GtkButton" id="DeleteProfileButton">
- <property name="label">gtk-delete</property>
+ <object class="GtkEntry" id="ProfileLabelEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox396">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="label40">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="ypad">4</property>
+ <property name="label" translatable="yes"><b>Action</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="ActionPathLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Path :</property>
+ </object>
+ <packing>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="CommandPathEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="width_chars">10</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="PathBrowseButton">
+ <property name="label" translatable="yes">_Browse...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="ActionParametersLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Parameters :</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="CommandParamsEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="width_chars">10</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="LegendButton">
+ <property name="label" translatable="yes">_Legend</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">LegendButtonImage1</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="LabelExample">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label134">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Action</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox394">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="aaaLabelAlign7">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Appears if file matches</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table2">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">4</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="CLabelAlign1">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Filenames :</property>
+ </object>
+ <packing>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="CLabelAlign2">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Mimetypes :</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="MatchCaseButton">
+ <property name="label" translatable="yes">Match case</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="PatternEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="text">*</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="MimeTypeEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="text">*/*</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label45">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Appears if selection contains</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkRadioButton" id="OnlyFilesButton">
+ <property name="label" translatable="yes">Only files</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="OnlyFoldersButton">
+ <property name="label" translatable="yes">Only folders</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">OnlyFilesButton</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="BothButton">
+ <property name="label" translatable="yes">Both</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">OnlyFilesButton</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="AcceptMultipleButton">
+ <property name="label" translatable="yes">Appears if selection has multiple files or folders</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label135">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Conditions</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox340">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label46">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Appears if scheme is in this list</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox38">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="SchemesTreeView">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox345">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkButton" id="AddSchemeButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <child>
+ <object class="GtkImage" id="image16">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ <property name="icon-size">4</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="RemoveSchemeButton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
- <property name="can_default">True</property>
<property name="receives_default">True</property>
- <property name="use_stock">True</property>
+ <child>
+ <object class="GtkImage" id="image17">
+ <property name="visible">True</property>
+ <property name="stock">gtk-remove</property>
+ <property name="icon-size">4</property>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">4</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
@@ -1415,16 +1986,27 @@ file(s)/folder(s)</property>
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label142">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Advanced Conditions</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
- <property name="position">2</property>
+ <property name="padding">6</property>
+ <property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area9">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
@@ -1433,7 +2015,7 @@ file(s)/folder(s)</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="receives_default">False</property>
+ <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -1443,12 +2025,12 @@ file(s)/folder(s)</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="SaveButton">
- <property name="label">gtk-save</property>
+ <object class="GtkButton" id="OKButton">
+ <property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="receives_default">False</property>
+ <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -1468,7 +2050,7 @@ file(s)/folder(s)</property>
</child>
<action-widgets>
<action-widget response="-6">CancelButton</action-widget>
- <action-widget response="-5">SaveButton</action-widget>
+ <action-widget response="-5">OKButton</action-widget>
</action-widgets>
</object>
<object class="GtkAssistant" id="ExportAssistant">
@@ -1534,9 +2116,9 @@ to extend a selection.</property>
<object class="GtkFileChooserWidget" id="ExportFolderChooser">
<property name="visible">True</property>
<property name="orientation">vertical</property>
+ <property name="use_preview_label">False</property>
<property name="action">select-folder</property>
<property name="local_only">False</property>
- <property name="use_preview_label">False</property>
<property name="preview_widget_active">False</property>
</object>
<packing>
@@ -1586,10 +2168,10 @@ to extend a selection.</property>
<object class="GtkFileChooserWidget" id="filechooserwidget1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
- <property name="local_only">False</property>
<property name="use_preview_label">False</property>
- <property name="preview_widget_active">False</property>
<property name="select_multiple">True</property>
+ <property name="local_only">False</property>
+ <property name="preview_widget_active">False</property>
</object>
</child>
<child>
@@ -1629,13 +2211,9 @@ to extend a selection.</property>
<property name="stock">gtk-save</property>
<property name="icon-size">4</property>
</object>
- <object class="GtkSizeGroup" id="IProfileConditionsLabelSizeGroup">
- <widgets>
- <widget name="MenuLabelLabel"/>
- <widget name="MenuTooltipLabel"/>
- <widget name="MenuIconLabel"/>
- <widget name="ActionPathLabel"/>
- <widget name="ActionParametersLabel"/>
- </widgets>
+ <object class="GtkImage" id="LegendButtonImage1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-help</property>
+ <property name="icon-size">4</property>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]