[nautilus-actions] Update dialog title if action has been modified



commit 17d165459e19251bfbfcbbca889ea9fe7ce5e207
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Jun 29 01:54:09 2009 +0200

    Update dialog title if action has been modified

 ChangeLog                                |   17 +++++
 src/common/na-action.c                   |   54 +++++++++++++++-
 src/common/na-action.h                   |    4 +
 src/common/na-iio-provider.c             |   34 +++++++---
 src/nact/nact-action-conditions-editor.c |  102 ++++++++++++++++++++----------
 src/nact/nact-action-conditions-editor.h |    4 +-
 src/nact/nact-imenu-item.c               |   76 ++++++++++++++++++----
 src/nact/nact-imenu-item.h               |   11 ++-
 src/nact/nact-iprofile-conditions.c      |   25 +++++--
 src/nact/nact-iprofile-conditions.h      |    9 ++-
 src/nact/nact-main-window.c              |   12 +++-
 11 files changed, 271 insertions(+), 77 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 40dd9e3..388732e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2009-06-29 Pierre Wieser <pwieser trychlos org>
+
+	* src/common/na-action.c:
+	* src/common/na-action.h:
+	na_action_set_tooltip, na_action_set_icon, na_action_are_equal:
+	new functions.
+
+	* src/common/na-iio-provider.c:
+	Fist try to write to initial provider.
+
+	* src/nact/nact-action-conditions-editor.c:
+	Update the dialog title if action has been modified.
+
+	* src/nact/nact-imenu-item.c:
+	* src/nact/nact-imenu-item.h:
+	get_edited_action, update_dialog_title: new functions.
+
 2009-06-28 Pierre Wieser <pwieser trychlos org>
 
 	* po/POTFILES.in:
diff --git a/src/common/na-action.c b/src/common/na-action.c
index 2564848..bc85687 100644
--- a/src/common/na-action.c
+++ b/src/common/na-action.c
@@ -652,7 +652,7 @@ na_action_set_new_uuid( NAAction *action )
 /**
  * Set a new label for the action.
  *
- * @action: action whose UUID is to be set.
+ * @action: action whose label is to be set.
  *
  * @label: new label.
  */
@@ -664,6 +664,58 @@ na_action_set_label( NAAction *action, const gchar *label )
 }
 
 /**
+ * Set a new tooltip for the action.
+ *
+ * @action: action whose tooltip is to be set.
+ *
+ * @tooltip: new tooltip.
+ */
+void
+na_action_set_tooltip( NAAction *action, const gchar *tooltip )
+{
+	g_assert( NA_IS_ACTION( action ));
+	g_object_set( G_OBJECT( action ), PROP_ACTION_TOOLTIP_STR, tooltip, NULL );
+}
+
+/**
+ * Set a new icon for the action.
+ *
+ * @action: action whose icon name is to be set.
+ *
+ * @icon: new icon name.
+ */
+void
+na_action_set_icon( NAAction *action, const gchar *icon )
+{
+	g_assert( NA_IS_ACTION( action ));
+	g_object_set( G_OBJECT( action ), PROP_ACTION_ICON_STR, icon, NULL );
+}
+
+/**
+ * Are the two actions the sames (excluding UUID) ?
+ *
+ * @first: first action to check.
+ *
+ * @second: second action to be compared to @first.
+ */
+gboolean
+na_action_are_equal( NAAction *first, NAAction *second )
+{
+	gboolean equal =
+		( g_utf8_collate( first->private->label, second->private->label ) == 0 ) &&
+		( g_utf8_collate( first->private->tooltip, second->private->tooltip ) == 0 ) &&
+		( g_utf8_collate( first->private->icon, second->private->icon ) == 0 );
+
+	if( equal ){
+		equal = ( g_slist_length( first->private->profiles ) == g_slist_length( second->private->profiles ));
+	}
+	if( equal ){
+		/* TODO: compare profiles */
+	}
+	return( equal );
+}
+
+/**
  * Returns the list of profiles of the actions as a GSList of
  * NAActionProfile GObjects.
  *
diff --git a/src/common/na-action.h b/src/common/na-action.h
index f630fa4..4bc1de2 100644
--- a/src/common/na-action.h
+++ b/src/common/na-action.h
@@ -96,6 +96,10 @@ gpointer  na_action_get_provider( const NAAction *action );
 
 void      na_action_set_new_uuid( NAAction *action );
 void      na_action_set_label( NAAction *action, const gchar *label );
+void      na_action_set_tooltip( NAAction *action, const gchar *tooltip );
+void      na_action_set_icon( NAAction *action, const gchar *icon_name );
+
+gboolean  na_action_are_equal( NAAction *first, NAAction *second );
 
 GSList   *na_action_get_profiles( const NAAction *action );
 void      na_action_set_profiles( NAAction *action, GSList *list );
diff --git a/src/common/na-iio-provider.c b/src/common/na-iio-provider.c
index ca9e89a..459bba5 100644
--- a/src/common/na-iio-provider.c
+++ b/src/common/na-iio-provider.c
@@ -203,19 +203,33 @@ na_iio_provider_write_action( const GObject *obj_pivot, const GObject *obj_actio
 	g_assert( NA_IS_ACTION( obj_action ));
 
 	guint ret = NA_IIO_PROVIDER_NOT_WRITABLE;
-	GSList *ip;
-	NAIIOProvider *instance;
+	NAIIOProvider *instance = NA_IIO_PROVIDER( na_action_get_provider( NA_ACTION( obj_action )));
 
-	GSList *providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
+	/* try to write to the original provider of the action
+	 */
+	if( instance ){
+		g_assert( NA_IS_IIO_PROVIDER( instance ));
+		if( NA_IIO_PROVIDER_GET_INTERFACE( instance )->write_action ){
+			ret = NA_IIO_PROVIDER_GET_INTERFACE( instance )->write_action( instance, obj_action, message );
+		} else {
+			instance = NULL;
+		}
+	}
 
-	for( ip = providers ; ip ; ip = ip->next ){
+	/* else, search for a provider which is willing to write the action
+	 */
+	if( !instance ){
+		GSList *providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
+		GSList *ip;
 
-		instance = NA_IIO_PROVIDER( ip->data );
-		if( NA_IIO_PROVIDER_GET_INTERFACE( instance )->write_action ){
+		for( ip = providers ; ip ; ip = ip->next ){
+			instance = NA_IIO_PROVIDER( ip->data );
+			if( NA_IIO_PROVIDER_GET_INTERFACE( instance )->write_action ){
 
-			ret = NA_IIO_PROVIDER_GET_INTERFACE( instance )->write_action( instance, obj_action, message );
-			if( ret == NA_IIO_PROVIDER_WRITE_OK || ret == NA_IIO_PROVIDER_WRITE_ERROR ){
-				break;
+				ret = NA_IIO_PROVIDER_GET_INTERFACE( instance )->write_action( instance, obj_action, message );
+				if( ret == NA_IIO_PROVIDER_WRITE_OK || ret == NA_IIO_PROVIDER_WRITE_ERROR ){
+					break;
+				}
 			}
 		}
 	}
@@ -252,6 +266,8 @@ na_iio_provider_delete_action( const GObject *obj_pivot, const GObject *obj_acti
 		if( NA_IIO_PROVIDER_GET_INTERFACE( instance )->delete_action ){
 			ret = NA_IIO_PROVIDER_GET_INTERFACE( instance )->delete_action( instance, obj_action, message );
 		}
+	} else {
+		g_assert_not_reached();
 	}
 
 	return( ret );
diff --git a/src/nact/nact-action-conditions-editor.c b/src/nact/nact-action-conditions-editor.c
index a8f05fb..048c9be 100644
--- a/src/nact/nact-action-conditions-editor.c
+++ b/src/nact/nact-action-conditions-editor.c
@@ -51,28 +51,32 @@ struct NactActionConditionsEditorClassPrivate {
  */
 struct NactActionConditionsEditorPrivate {
 	gboolean  dispose_has_run;
-	NAAction *action;
+	NAAction *original;
+	NAAction *edited;
 	gboolean  is_new;
 };
 
 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   instance_init( GTypeInstance *instance, gpointer klass );
-static void   instance_dispose( GObject *dialog );
-static void   instance_finalize( GObject *dialog );
+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     instance_init( GTypeInstance *instance, gpointer klass );
+static void     instance_dispose( GObject *dialog );
+static void     instance_finalize( GObject *dialog );
 
 static NactActionConditionsEditor *action_conditions_editor_new( BaseApplication *application );
 
-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   on_all_widgets_showed( BaseWindow *dialog );
-static void   init_dialog_title( NactActionConditionsEditor *dialog );
-static void   on_dialog_response( GtkDialog *dialog, gint code, BaseWindow *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     on_all_widgets_showed( BaseWindow *dialog );
+static void     setup_dialog_title( NactWindow *dialog );
+static void     on_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
+
+static GObject *get_edited_action( NactWindow *window );
+static gboolean is_edited_modified( NactActionConditionsEditor *dialog );
 
 GType
 nact_action_conditions_editor_get_type( void )
@@ -157,6 +161,8 @@ imenu_item_iface_init( NactIMenuItemInterface *iface )
 	static const gchar *thisfn = "nact_action_conditions_editor_imenu_item_iface_init";
 	g_debug( "%s: iface=%p", thisfn, iface );
 
+	iface->get_edited_action = get_edited_action;
+	iface->update_dialog_title = setup_dialog_title;
 	iface->signal_connected = nact_window_on_signal_connected;
 }
 
@@ -179,7 +185,8 @@ instance_init( GTypeInstance *instance, gpointer klass )
 	self->private = g_new0( NactActionConditionsEditorPrivate, 1 );
 
 	self->private->dispose_has_run = FALSE;
-	self->private->action = NULL;
+	self->private->original = NULL;
+	self->private->edited = NULL;
 }
 
 static void
@@ -195,7 +202,8 @@ instance_dispose( GObject *dialog )
 
 		self->private->dispose_has_run = TRUE;
 
-		g_object_unref( self->private->action );
+		g_object_unref( self->private->original );
+		g_object_unref( self->private->edited );
 
 		/* chain up to the parent class */
 		G_OBJECT_CLASS( st_parent_class )->dispose( dialog );
@@ -243,7 +251,7 @@ action_conditions_editor_new( BaseApplication *application )
  * Returns TRUE if the NAAction has been edited and saved, or FALSE if
  * there has been no modification at all.
  */
-gboolean
+void
 nact_action_conditions_editor_run_editor( NactWindow *parent, gpointer user_data )
 {
 	static const gchar *thisfn = "nact_action_conditions_editor_run_editor";
@@ -260,17 +268,16 @@ nact_action_conditions_editor_run_editor( NactWindow *parent, gpointer user_data
 	NAAction *action = NA_ACTION( user_data );
 
 	if( !action ){
-		dialog->private->action = na_action_new_with_profile();
+		dialog->private->original = na_action_new_with_profile();
 		dialog->private->is_new = TRUE;
 
 	} else {
-		dialog->private->action = na_action_duplicate( action );
+		dialog->private->original = na_action_duplicate( action );
 		dialog->private->is_new = FALSE;
 	}
 
+	dialog->private->edited = na_action_duplicate( dialog->private->original );
 	base_window_run( BASE_WINDOW( dialog ));
-
-	return( TRUE );
 }
 
 static gchar *
@@ -289,8 +296,8 @@ on_initial_load_dialog( BaseWindow *dialog )
 	g_assert( NACT_IS_ACTION_CONDITIONS_EDITOR( dialog ));
 	NactActionConditionsEditor *window = NACT_ACTION_CONDITIONS_EDITOR( dialog );
 
-	nact_imenu_item_initial_load( NACT_WINDOW( window ), window->private->action );
-	nact_iprofile_conditions_initial_load( NACT_WINDOW( window ), window->private->action );
+	nact_imenu_item_initial_load( NACT_WINDOW( window ), window->private->edited );
+	nact_iprofile_conditions_initial_load( NACT_WINDOW( window ), window->private->edited );
 }
 
 static void
@@ -302,26 +309,39 @@ on_runtime_init_dialog( BaseWindow *dialog )
 	g_assert( NACT_IS_ACTION_CONDITIONS_EDITOR( dialog ));
 	NactActionConditionsEditor *window = NACT_ACTION_CONDITIONS_EDITOR( dialog );
 
-	init_dialog_title( window );
-	nact_imenu_item_runtime_init( NACT_WINDOW( window ), window->private->action );
-	nact_iprofile_conditions_runtime_init( NACT_WINDOW( window ), window->private->action );
+	setup_dialog_title( NACT_WINDOW( window ));
+	nact_imenu_item_runtime_init( NACT_WINDOW( window ), window->private->edited );
+	nact_iprofile_conditions_runtime_init( NACT_WINDOW( window ), window->private->edited );
 }
 
 static void
-init_dialog_title( NactActionConditionsEditor *dialog )
+setup_dialog_title( NactWindow *window )
 {
+	g_assert( NACT_IS_ACTION_CONDITIONS_EDITOR( window ));
+	NactActionConditionsEditor *dialog = ( NACT_ACTION_CONDITIONS_EDITOR( window ));
+
+	gboolean is_modified = is_edited_modified( dialog );
+
 	GtkWindow *toplevel = base_window_get_toplevel_widget( BASE_WINDOW( dialog ));
 
+	gchar *title;
 	if( dialog->private->is_new ){
-		gtk_window_set_title( toplevel, _( "Adding a new action" ));
-
+		title = g_strdup( _( "Adding a new action" ));
 	} 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 );
+		gchar *label = na_action_get_label( dialog->private->original );
+		title = g_strdup_printf( _( "Editing \"%s\" action" ), label );
 		g_free( label );
+	}
+
+	if( is_modified ){
+		gchar *tmp = g_strdup_printf( "*%s", title );
 		g_free( title );
+		title = tmp;
 	}
+
+	gtk_window_set_title( toplevel, title );
+
+	g_free( title );
 }
 
 static void
@@ -330,7 +350,10 @@ on_all_widgets_showed( BaseWindow *dialog )
 	static const gchar *thisfn = "nact_action_conditions_editor_on_all_widgets_showed";
 	g_debug( "%s: dialog=%p", thisfn, dialog );
 
-	nact_iprofile_conditions_all_widgets_showed( NACT_WINDOW( dialog ));
+	GtkNotebook *notebook = GTK_NOTEBOOK( base_window_get_widget( dialog, "notebook2" ));
+	gtk_notebook_set_current_page( notebook, 0 );
+
+	nact_imenu_item_all_widgets_showed( NACT_WINDOW( dialog ));
 }
 
 static void
@@ -349,3 +372,16 @@ on_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window )
 			break;
 	}
 }
+
+static GObject *
+get_edited_action( NactWindow *window )
+{
+	g_assert( NACT_IS_ACTION_CONDITIONS_EDITOR( window ));
+	return( G_OBJECT( NACT_ACTION_CONDITIONS_EDITOR( window )->private->edited ));
+}
+
+static gboolean
+is_edited_modified( NactActionConditionsEditor *dialog )
+{
+	return( !na_action_are_equal( dialog->private->original, dialog->private->edited ));
+}
diff --git a/src/nact/nact-action-conditions-editor.h b/src/nact/nact-action-conditions-editor.h
index 76c99a3..26ce700 100644
--- a/src/nact/nact-action-conditions-editor.h
+++ b/src/nact/nact-action-conditions-editor.h
@@ -65,9 +65,9 @@ typedef struct {
 }
 	NactActionConditionsEditorClass;
 
-GType    nact_action_conditions_editor_get_type( void );
+GType nact_action_conditions_editor_get_type( void );
 
-gboolean nact_action_conditions_editor_run_editor( NactWindow *parent, gpointer user_data );
+void  nact_action_conditions_editor_run_editor( NactWindow *parent, gpointer user_data );
 
 G_END_DECLS
 
diff --git a/src/nact/nact-imenu-item.c b/src/nact/nact-imenu-item.c
index 6332c1e..9423727 100644
--- a/src/nact/nact-imenu-item.c
+++ b/src/nact/nact-imenu-item.c
@@ -57,16 +57,20 @@ static GType         register_type( void );
 static void          interface_base_init( NactIMenuItemInterface *klass );
 static void          interface_base_finalize( NactIMenuItemInterface *klass );
 
+static GObject      *v_get_edited_action( NactWindow *window );
+static void          v_update_dialog_title( NactWindow *window );
+static void          v_signal_connected( NactWindow *window, gpointer instance, gulong handler_id );
+
 static void          icon_combo_list_fill( GtkComboBoxEntry* combo );
 static GtkTreeModel *create_stock_icon_model( void );
 static gint          sort_stock_ids( gconstpointer a, gconstpointer b );
 static gchar        *strip_underscore( const gchar *text );
+
 static void          on_label_changed( GtkEntry *entry, gpointer user_data );
 static void          on_tooltip_changed( GtkEntry *entry, gpointer user_data );
 static void          on_icon_changed( GtkEntry *entry, gpointer user_data );
 
 static void          record_signal( NactWindow *window, GObject *instance, const gchar *signal, GCallback fn, gpointer user_data );
-static void          v_signal_connected( NactWindow *window, gpointer instance, gulong handler_id );
 
 GType
 nact_imenu_item_get_type( void )
@@ -116,6 +120,8 @@ interface_base_init( NactIMenuItemInterface *klass )
 
 		klass->private = g_new0( NactIMenuItemInterfacePrivate, 1 );
 
+		klass->get_edited_action = NULL;
+		klass->update_dialog_title = NULL;
 		klass->signal_connected = NULL;
 
 		initialized = TRUE;
@@ -175,6 +181,45 @@ nact_imenu_item_runtime_init( NactWindow *dialog, NAAction *action )
 	g_free( icon );
 }
 
+void
+nact_imenu_item_all_widgets_showed( NactWindow *dialog )
+{
+	GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "MenuLabelEntry" );
+	gtk_widget_grab_focus( label_widget );
+}
+
+static GObject *
+v_get_edited_action( NactWindow *window )
+{
+	g_assert( NACT_IS_IMENU_ITEM( window ));
+
+	if( NACT_IMENU_ITEM_GET_INTERFACE( window )->get_edited_action ){
+		return( NACT_IMENU_ITEM_GET_INTERFACE( window )->get_edited_action( window ));
+	}
+
+	return( NULL );
+}
+
+static void
+v_update_dialog_title( NactWindow *window )
+{
+	g_assert( NACT_IS_IMENU_ITEM( window ));
+
+	if( NACT_IMENU_ITEM_GET_INTERFACE( window )->update_dialog_title ){
+		NACT_IMENU_ITEM_GET_INTERFACE( window )->update_dialog_title( window );
+	}
+}
+
+static void
+v_signal_connected( NactWindow *window, gpointer instance, gulong handler_id )
+{
+	g_assert( NACT_IS_IMENU_ITEM( window ));
+
+	if( NACT_IMENU_ITEM_GET_INTERFACE( window )->signal_connected ){
+		NACT_IMENU_ITEM_GET_INTERFACE( window )->signal_connected( window, instance, handler_id );
+	}
+}
+
 static void
 icon_combo_list_fill( GtkComboBoxEntry* combo )
 {
@@ -291,14 +336,24 @@ static void
 on_label_changed( GtkEntry *entry, gpointer user_data )
 {
 	g_assert( NACT_IS_WINDOW( user_data ));
-	/*NactWindow *dialog = NACT_WINDOW( user_data );*/
+	NactWindow *dialog = NACT_WINDOW( user_data );
+
+	NAAction *edited = NA_ACTION( v_get_edited_action( dialog ));
+	na_action_set_label( edited, gtk_entry_get_text( entry ));
+
+	v_update_dialog_title( dialog );
 }
 
 static void
 on_tooltip_changed( GtkEntry *entry, gpointer user_data )
 {
 	g_assert( NACT_IS_WINDOW( user_data ));
-	/*NactWindow *dialog = NACT_WINDOW( user_data );*/
+	NactWindow *dialog = NACT_WINDOW( user_data );
+
+	NAAction *edited = NA_ACTION( v_get_edited_action( dialog ));
+	na_action_set_tooltip( edited, gtk_entry_get_text( entry ));
+
+	v_update_dialog_title( dialog );
 }
 
 static void
@@ -349,6 +404,11 @@ on_icon_changed( GtkEntry *icon_entry, gpointer user_data )
 	} else {
 		gtk_widget_hide( image );
 	}
+
+	NAAction *edited = NA_ACTION( v_get_edited_action( dialog ));
+	na_action_set_icon( edited, icon_name );
+
+	v_update_dialog_title( dialog );
 }
 
 static void
@@ -357,13 +417,3 @@ record_signal( NactWindow *window, GObject *instance, const gchar *signal, GCall
 	gulong handler_id = g_signal_connect( instance, signal, fn, user_data );
 	v_signal_connected( window, instance, handler_id );
 }
-
-static void
-v_signal_connected( NactWindow *window, gpointer instance, gulong handler_id )
-{
-	g_assert( NACT_IS_IMENU_ITEM( window ));
-
-	if( NACT_IMENU_ITEM_GET_INTERFACE( window )->signal_connected ){
-		NACT_IMENU_ITEM_GET_INTERFACE( window )->signal_connected( window, instance, handler_id );
-	}
-}
diff --git a/src/nact/nact-imenu-item.h b/src/nact/nact-imenu-item.h
index 7349b5f..0705a48 100644
--- a/src/nact/nact-imenu-item.h
+++ b/src/nact/nact-imenu-item.h
@@ -57,14 +57,17 @@ typedef struct {
 	NactIMenuItemInterfacePrivate *private;
 
 	/* api */
-	void ( *signal_connected )( NactWindow *window, gpointer instance, gulong handler_id );
+	GObject * ( *get_edited_action )  ( NactWindow *window );
+	void      ( *update_dialog_title )( NactWindow *window );
+	void      ( *signal_connected )   ( NactWindow *window, gpointer instance, gulong handler_id );
 }
 	NactIMenuItemInterface;
 
-GType nact_imenu_item_get_type( void );
+GType    nact_imenu_item_get_type( void );
 
-void  nact_imenu_item_initial_load( NactWindow *dialog, NAAction *action );
-void  nact_imenu_item_runtime_init( NactWindow *dialog, NAAction *action );
+void     nact_imenu_item_initial_load( NactWindow *dialog, NAAction *action );
+void     nact_imenu_item_runtime_init( NactWindow *dialog, NAAction *action );
+void     nact_imenu_item_all_widgets_showed( NactWindow *dialog );
 
 G_END_DECLS
 
diff --git a/src/nact/nact-iprofile-conditions.c b/src/nact/nact-iprofile-conditions.c
index c9c8bb1..7ec4b38 100644
--- a/src/nact/nact-iprofile-conditions.c
+++ b/src/nact/nact-iprofile-conditions.c
@@ -42,9 +42,11 @@
 struct NactIProfileConditionsInterfacePrivate {
 };
 
-static GType      register_type( void );
-static void       interface_base_init( NactIProfileConditionsInterface *klass );
-static void       interface_base_finalize( NactIProfileConditionsInterface *klass );
+static GType    register_type( void );
+static void     interface_base_init( NactIProfileConditionsInterface *klass );
+static void     interface_base_finalize( NactIProfileConditionsInterface *klass );
+
+/*static GObject *v_get_edited_action( NactWindow *window );*/
 
 GType
 nact_iprofile_conditions_get_type( void )
@@ -123,12 +125,21 @@ nact_iprofile_conditions_runtime_init( NactWindow *dialog, NAAction *action )
 {
 }
 
-void
+/*void
 nact_iprofile_conditions_all_widgets_showed( NactWindow *dialog )
 {
 	static const gchar *thisfn = "nact_iprofile_conditions_all_widgets_showed";
 	g_debug( "%s: dialog=%p", thisfn, dialog );
+}*/
 
-	GtkNotebook *notebook = GTK_NOTEBOOK( base_window_get_widget( BASE_WINDOW( dialog ), "notebook2" ));
-	gtk_notebook_set_current_page( notebook, 0 );
-}
+/*static GObject *
+v_get_edited_action( NactWindow *window )
+{
+	g_assert( NACT_IS_IPROFILE_CONDITIONS( window ));
+
+	if( NACT_IPROFILE_CONDITIONS_GET_INTERFACE( window )->get_edited_action ){
+		return( NACT_IPROFILE_CONDITIONS_GET_INTERFACE( window )->get_edited_action( window ));
+	}
+
+	return( NULL );
+}*/
diff --git a/src/nact/nact-iprofile-conditions.h b/src/nact/nact-iprofile-conditions.h
index f748272..57ffada 100644
--- a/src/nact/nact-iprofile-conditions.h
+++ b/src/nact/nact-iprofile-conditions.h
@@ -58,14 +58,15 @@ typedef struct {
 	NactIProfileConditionsInterfacePrivate *private;
 
 	/* api */
+	GObject * ( *get_edited_action )  ( NactWindow *window );
+	void      ( *signal_connected )   ( NactWindow *window, gpointer instance, gulong handler_id );
 }
 	NactIProfileConditionsInterface;
 
-GType nact_iprofile_conditions_get_type( void );
+GType    nact_iprofile_conditions_get_type( void );
 
-void  nact_iprofile_conditions_initial_load( NactWindow *dialog, NAAction *action );
-void  nact_iprofile_conditions_runtime_init( NactWindow *dialog, NAAction *action );
-void  nact_iprofile_conditions_all_widgets_showed( NactWindow *dialog );
+void     nact_iprofile_conditions_initial_load( NactWindow *dialog, NAAction *action );
+void     nact_iprofile_conditions_runtime_init( NactWindow *dialog, NAAction *action );
 
 G_END_DECLS
 
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 8669f58..c54adf6 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -378,6 +378,8 @@ on_about_button_clicked( GtkButton *button, gpointer user_data )
 
 	g_free( license_i18n );
 	g_free( icon_name );
+
+	/* TODO: reset focus to actions list */
 }
 
 /*
@@ -399,7 +401,7 @@ on_add_button_clicked( GtkButton *button, gpointer user_data )
 	nact_action_conditions_editor_run_editor( wndmain, NULL );
 
 	/* TODO: set the selection to the newly created action
-	 * or restore the previous selection */
+	 * or restore the previous selection - set focus to actions list */
 }
 
 /*
@@ -438,7 +440,8 @@ on_edit_button_clicked( GtkButton *button, gpointer user_data )
 		g_assert_not_reached();
 	}
 
-	/* TODO: reset the selection to the edited action */
+	/* TODO: reset the selection to the edited action
+	 * set focus to actions list */
 }
 
 static void
@@ -476,7 +479,8 @@ on_duplicate_button_clicked( GtkButton *button, gpointer user_data )
 		g_assert_not_reached();
 	}
 
-	/* TODO: set the selection to the newly created action */
+	/* TODO: set the selection to the newly created action
+	 * set focus to actions list */
 }
 
 static void
@@ -512,7 +516,7 @@ on_delete_button_clicked( GtkButton *button, gpointer user_data )
 		g_assert_not_reached();
 	}
 	/* TODO: set the selection to the previous action if any
-	 * or to the next one */
+	 * or to the next one - set focus to actions list */
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]