[nautilus-actions: 6/45] The new UI includes a menu and a status bar
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions: 6/45] The new UI includes a menu and a status bar
- Date: Wed, 29 Jul 2009 21:18:16 +0000 (UTC)
commit c724dea5befd8a8bb15a25f4ef3c1fe65a0c8ffd
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Jul 18 03:34:34 2009 +0200
The new UI includes a menu and a status bar
src/common/na-iio-provider.c | 21 -
src/nact/Makefile.am | 10 +-
src/nact/base-application.c | 45 +-
src/nact/base-application.h | 1 +
src/nact/base-window.c | 25 +-
src/nact/base-window.h | 1 +
src/nact/nact-action-conditions-editor.c | 2 +-
src/nact/nact-action-profiles-editor.c | 2 +-
src/nact/nact-application.c | 3 +-
src/nact/{nact-imenu-item.c => nact-iaction-tab.c} | 159 +++----
src/nact/nact-iaction-tab.h | 75 +++
src/nact/nact-iactions-list.c | 33 +-
src/nact/nact-iactions-list.h | 23 +-
src/nact/nact-imenu-item.h | 80 ---
src/nact/nact-iprefs.c | 54 ++
src/nact/nact-iprefs.h | 5 +-
src/nact/nact-main-window.c | 557 +++++++++++++++-----
src/nact/nact-main-window.h | 3 +-
src/nact/nautilus-actions-config.ui | 279 +++++-----
19 files changed, 866 insertions(+), 512 deletions(-)
---
diff --git a/src/common/na-iio-provider.c b/src/common/na-iio-provider.c
index 459bba5..f27b911 100644
--- a/src/common/na-iio-provider.c
+++ b/src/common/na-iio-provider.c
@@ -51,8 +51,6 @@ static void interface_base_finalize( NAIIOProviderInterface *klass );
static gboolean do_is_writable( NAIIOProvider *instance );
static gboolean do_is_willing_to_write( NAIIOProvider *instance, const GObject *action );
-static gint sort_actions_by_label( gconstpointer a1, gconstpointer a2 );
-
/**
* Registers the GType of this interface.
*/
@@ -167,8 +165,6 @@ na_iio_provider_read_actions( const GObject *object )
}
}
- actions = g_slist_sort( actions, ( GCompareFunc ) sort_actions_by_label );
-
#ifdef NACT_MAINTAINER_MODE
for( ip = actions ; ip ; ip = ip->next ){
na_object_dump( NA_OBJECT( ip->data ));
@@ -284,20 +280,3 @@ do_is_willing_to_write( NAIIOProvider *instance, const GObject *action )
{
return( FALSE );
}
-
-static gint
-sort_actions_by_label( gconstpointer a1, gconstpointer a2 )
-{
- NAAction *action1 = NA_ACTION( a1 );
- gchar *label1 = na_action_get_label( action1 );
-
- NAAction *action2 = NA_ACTION( a2 );
- gchar *label2 = na_action_get_label( action2 );
-
- gint ret = g_utf8_collate( label1, label2 );
-
- g_free( label1 );
- g_free( label2 );
-
- return( ret );
-}
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index d68191c..edbd6fe 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -44,10 +44,6 @@ nautilus_actions_config_SOURCES = \
base-application.h \
base-window.c \
base-window.h \
- nact-action-conditions-editor.c \
- nact-action-conditions-editor.h \
- nact-action-profiles-editor.c \
- nact-action-profiles-editor.h \
nact-application.c \
nact-application.h \
nact-assistant.c \
@@ -61,12 +57,12 @@ nautilus_actions_config_SOURCES = \
nact-gconf-reader.h \
nact-gconf-writer.c \
nact-gconf-writer.h \
+ nact-iaction-tab.c \
+ nact-iaction-tab.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-item.c \
@@ -76,8 +72,6 @@ nautilus_actions_config_SOURCES = \
nact-main.c \
nact-main-window.c \
nact-main-window.h \
- nact-profile-conditions-editor.c \
- nact-profile-conditions-editor.h \
nact-window.c \
nact-window.h \
$(NULL)
diff --git a/src/nact/base-application.c b/src/nact/base-application.c
index a8a9e80..f602b67 100644
--- a/src/nact/base-application.c
+++ b/src/nact/base-application.c
@@ -99,7 +99,6 @@ static void v_advertise_not_willing_to_run( BaseApplication *applicati
static void v_start( BaseApplication *application );
static void v_finish( BaseApplication *application );
static gchar *v_get_unique_name( BaseApplication *application );
-static gchar *v_get_application_name( BaseApplication *application );
static GObject *v_get_main_window( BaseApplication *application );
static gchar *v_get_ui_filename( BaseApplication *application );
@@ -465,6 +464,27 @@ base_application_run( BaseApplication *application )
}
gchar *
+base_application_get_name( BaseApplication *application )
+{
+ static const gchar *thisfn = "base_application_get_name";
+ g_debug( "%s: icon=%p", thisfn, application );
+
+ g_assert( BASE_IS_APPLICATION( application ));
+
+ gchar *name;
+ g_object_get( G_OBJECT( application ), PROP_APPLICATION_NAME_STR, &name, NULL );
+
+ if( !name || !strlen( name )){
+ name = BASE_APPLICATION_GET_CLASS( application )->get_application_name( application );
+ if( name && strlen( name )){
+ g_object_set( G_OBJECT( application ), PROP_APPLICATION_NAME_STR, name, NULL );
+ }
+ }
+
+ return( name );
+}
+
+gchar *
base_application_get_icon_name( BaseApplication *application )
{
static const gchar *thisfn = "base_application_get_icon_name";
@@ -769,27 +789,6 @@ v_get_unique_name( BaseApplication *application )
}
static gchar *
-v_get_application_name( BaseApplication *application )
-{
- static const gchar *thisfn = "base_application_v_get_application_name";
- g_debug( "%s: application=%p", thisfn, application );
-
- g_assert( BASE_IS_APPLICATION( application ));
-
- gchar *name;
- g_object_get( G_OBJECT( application ), PROP_APPLICATION_NAME_STR, &name, NULL );
-
- if( !name || !strlen( name )){
- name = BASE_APPLICATION_GET_CLASS( application )->get_application_name( application );
- if( name && strlen( name )){
- g_object_set( G_OBJECT( application ), PROP_APPLICATION_NAME_STR, name, NULL );
- }
- }
-
- return( name );
-}
-
-static gchar *
v_get_ui_filename( BaseApplication *application )
{
static const gchar *thisfn = "base_application_v_get_ui_filename";
@@ -890,7 +889,7 @@ do_initialize_gtk( BaseApplication *application )
static void
do_initialize_application_name( BaseApplication *application )
{
- gchar *name = v_get_application_name( application );
+ gchar *name = base_application_get_name( application );
if( name && strlen( name )){
g_set_application_name( name );
}
diff --git a/src/nact/base-application.h b/src/nact/base-application.h
index b4a1599..ef47ee7 100644
--- a/src/nact/base-application.h
+++ b/src/nact/base-application.h
@@ -104,6 +104,7 @@ GType base_application_get_type( void );
int base_application_run( BaseApplication *application );
+gchar *base_application_get_name( BaseApplication *application );
gchar *base_application_get_icon_name( BaseApplication *application );
GObject *base_application_get_main_window( BaseApplication *application );
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 0952594..75d8d32 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -81,6 +81,7 @@ static void v_initial_load_toplevel( BaseWindow *window );
static void v_runtime_init_toplevel( BaseWindow *window );
static void v_all_widgets_showed( BaseWindow *window );
static gboolean v_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
+static gboolean v_delete_event( GtkWidget *widget, GdkEvent *event, BaseWindow *window );
static void do_init_window( BaseWindow *window );
static void do_initial_load_toplevel( BaseWindow *window );
@@ -493,6 +494,22 @@ v_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window )
return( TRUE );
}
+/*
+ * return TRUE to quit the toplevel window loop
+ */
+static gboolean
+v_delete_event( GtkWidget *widget, GdkEvent *event, BaseWindow *window )
+{
+ g_assert( BASE_IS_WINDOW( window ));
+ g_assert( GTK_IS_WINDOW( widget ));
+
+ if( BASE_WINDOW_GET_CLASS( window )->delete_event ){
+ return( BASE_WINDOW_GET_CLASS( window )->delete_event( window, GTK_WINDOW( widget ), event ));
+ }
+
+ return( TRUE );
+}
+
static void
do_init_window( BaseWindow *window )
{
@@ -577,7 +594,13 @@ do_run_window( BaseWindow *window )
v_all_widgets_showed( window );
if( is_main_window( window )){
- g_signal_connect( G_OBJECT( this_dialog ), "response", G_CALLBACK( v_dialog_response ), window );
+
+ if( GTK_IS_DIALOG( this_dialog )){
+ g_signal_connect( G_OBJECT( this_dialog ), "response", G_CALLBACK( v_dialog_response ), window );
+ } else {
+ g_signal_connect( G_OBJECT( this_dialog ), "delete-event", G_CALLBACK( v_delete_event ), window );
+ }
+
g_debug( "%s: application=%p, starting gtk_main", thisfn, window->private->application );
gtk_main();
diff --git a/src/nact/base-window.h b/src/nact/base-window.h
index e94a996..eef7f8c 100644
--- a/src/nact/base-window.h
+++ b/src/nact/base-window.h
@@ -72,6 +72,7 @@ typedef struct {
void ( *runtime_init_toplevel )( BaseWindow *window );
void ( *all_widgets_showed ) ( BaseWindow *window );
gboolean ( *dialog_response ) ( GtkDialog *dialog, gint code, BaseWindow *window );
+ gboolean ( *delete_event ) ( BaseWindow *window, GtkWindow *toplevel, GdkEvent *event );
GObject * ( *get_application ) ( BaseWindow *window );
gchar * ( *get_toplevel_name ) ( BaseWindow *window );
GtkWindow * ( *get_toplevel_dialog ) ( BaseWindow *window );
diff --git a/src/nact/nact-action-conditions-editor.c b/src/nact/nact-action-conditions-editor.c
index 9c32223..f361fc3 100644
--- a/src/nact/nact-action-conditions-editor.c
+++ b/src/nact/nact-action-conditions-editor.c
@@ -316,7 +316,7 @@ on_initial_load_dialog( BaseWindow *dialog )
g_assert( NACT_IS_ACTION_CONDITIONS_EDITOR( dialog ));
NactActionConditionsEditor *editor = NACT_ACTION_CONDITIONS_EDITOR( dialog );
- nact_imenu_item_initial_load( NACT_WINDOW( editor ), editor->private->edited );
+ nact_imenu_item_initial_load( NACT_WINDOW( editor ));
NAActionProfile *profile = NA_ACTION_PROFILE( na_action_get_profiles( editor->private->edited )->data );
nact_iconditions_initial_load( NACT_WINDOW( editor ), profile );
diff --git a/src/nact/nact-action-profiles-editor.c b/src/nact/nact-action-profiles-editor.c
index 6e4b271..7a4c393 100644
--- a/src/nact/nact-action-profiles-editor.c
+++ b/src/nact/nact-action-profiles-editor.c
@@ -315,7 +315,7 @@ on_initial_load_dialog( BaseWindow *dialog )
g_assert( NACT_IS_ACTION_PROFILES_EDITOR( dialog ));
NactActionProfilesEditor *editor = NACT_ACTION_PROFILES_EDITOR( dialog );
- nact_imenu_item_initial_load( NACT_WINDOW( editor ), editor->private->edited );
+ nact_imenu_item_initial_load( NACT_WINDOW( editor ));
g_assert( NACT_IS_IPROFILES_LIST( editor ));
nact_iprofiles_list_initial_load( NACT_WINDOW( editor ));
diff --git a/src/nact/nact-application.c b/src/nact/nact-application.c
index 217e86e..b7e8dd7 100644
--- a/src/nact/nact-application.c
+++ b/src/nact/nact-application.c
@@ -270,8 +270,7 @@ get_application_name( BaseApplication *application )
static const gchar *thisfn = "nact_application_get_application_name";
g_debug( "%s: application=%p", thisfn, application );
- /* i18n: this is the application name, used in window title
- */
+ /* i18n: this is the application name, used in window title */
return( g_strdup( _( "Nautilus Actions Configuration Tool" )));
}
diff --git a/src/nact/nact-imenu-item.c b/src/nact/nact-iaction-tab.c
similarity index 72%
rename from src/nact/nact-imenu-item.c
rename to src/nact/nact-iaction-tab.c
index 1a4c97b..70590fb 100644
--- a/src/nact/nact-imenu-item.c
+++ b/src/nact/nact-iaction-tab.c
@@ -35,15 +35,12 @@
#include <glib/gi18n.h>
#include <string.h>
-#include <common/na-action.h>
-#include <common/na-action-profile.h>
-
#include "nact-application.h"
-#include "nact-imenu-item.h"
+#include "nact-iaction-tab.h"
/* private interface data
*/
-struct NactIMenuItemInterfacePrivate {
+struct NactIActionTabInterfacePrivate {
};
/* columns in the icon combobox
@@ -55,10 +52,10 @@ enum {
};
static GType register_type( void );
-static void interface_base_init( NactIMenuItemInterface *klass );
-static void interface_base_finalize( NactIMenuItemInterface *klass );
+static void interface_base_init( NactIActionTabInterface *klass );
+static void interface_base_finalize( NactIActionTabInterface *klass );
-static GObject *v_get_edited_action( NactWindow *window );
+static NAAction *v_get_edited_action( NactWindow *window );
static void v_field_modified( NactWindow *window );
static void on_label_changed( GtkEntry *entry, gpointer user_data );
@@ -72,7 +69,7 @@ static gchar *strip_underscore( const gchar *text );
static void display_icon( NactWindow *window, GtkWidget *image, gboolean display );
GType
-nact_imenu_item_get_type( void )
+nact_iaction_tab_get_type( void )
{
static GType iface_type = 0;
@@ -86,11 +83,11 @@ nact_imenu_item_get_type( void )
static GType
register_type( void )
{
- static const gchar *thisfn = "nact_imenu_item_register_type";
+ static const gchar *thisfn = "nact_iaction_tab_register_type";
g_debug( "%s", thisfn );
static const GTypeInfo info = {
- sizeof( NactIMenuItemInterface ),
+ sizeof( NactIActionTabInterface ),
( GBaseInitFunc ) interface_base_init,
( GBaseFinalizeFunc ) interface_base_finalize,
NULL,
@@ -101,23 +98,23 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIMenuItem", &info, 0 );
+ GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIActionTab", &info, 0 );
- g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
+ g_type_interface_add_prerequisite( type, NACT_WINDOW_TYPE );
return( type );
}
static void
-interface_base_init( NactIMenuItemInterface *klass )
+interface_base_init( NactIActionTabInterface *klass )
{
- static const gchar *thisfn = "nact_imenu_item_interface_base_init";
+ static const gchar *thisfn = "nact_iaction_tab_interface_base_init";
static gboolean initialized = FALSE;
if( !initialized ){
g_debug( "%s: klass=%p", thisfn, klass );
- klass->private = g_new0( NactIMenuItemInterfacePrivate, 1 );
+ klass->private = g_new0( NactIActionTabInterfacePrivate, 1 );
klass->get_edited_action = NULL;
klass->field_modified = NULL;
@@ -127,9 +124,9 @@ interface_base_init( NactIMenuItemInterface *klass )
}
static void
-interface_base_finalize( NactIMenuItemInterface *klass )
+interface_base_finalize( NactIActionTabInterface *klass )
{
- static const gchar *thisfn = "nact_imenu_item_interface_base_finalize";
+ static const gchar *thisfn = "nact_iaction_tab_interface_base_finalize";
static gboolean finalized = FALSE ;
if( !finalized ){
@@ -142,88 +139,72 @@ interface_base_finalize( NactIMenuItemInterface *klass )
}
void
-nact_imenu_item_initial_load( NactWindow *dialog, NAAction *action )
+nact_iaction_tab_initial_load( NactWindow *dialog )
{
- static const gchar *thisfn = "nact_imenu_item_initial_load";
- g_debug( "%s: dialog=%p, action=%p", thisfn, dialog, action );
-
- /*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 );*/
+ static const gchar *thisfn = "nact_iaction_tab_initial_load";
+ g_debug( "%s: dialog=%p", thisfn, dialog );
- GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "MenuIconComboBoxEntry" );
+ GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
gtk_combo_box_set_model( GTK_COMBO_BOX( icon_widget ), create_stock_icon_model());
icon_combo_list_fill( GTK_COMBO_BOX_ENTRY( icon_widget ));
}
void
-nact_imenu_item_size_labels( NactWindow *window, GObject *size_group )
+nact_iaction_tab_runtime_init( NactWindow *dialog )
{
- g_assert( NACT_IS_WINDOW( window ));
- g_assert( GTK_IS_SIZE_GROUP( size_group ));
+ static const gchar *thisfn = "nact_iaction_tab_runtime_init";
+ g_debug( "%s: dialog=%p", thisfn, dialog );
- GtkWidget *label = base_window_get_widget( BASE_WINDOW( window ), "MenuLabelLabel" );
- gtk_size_group_add_widget( GTK_SIZE_GROUP( size_group ), label );
+ GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionLabelEntry" );
+ nact_window_signal_connect( dialog, G_OBJECT( label_widget ), "changed", G_CALLBACK( on_label_changed ));
- label = base_window_get_widget( BASE_WINDOW( window ), "MenuTooltipLabel" );
- gtk_size_group_add_widget( GTK_SIZE_GROUP( size_group ), label );
+ GtkWidget *tooltip_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionTooltipEntry" );
+ nact_window_signal_connect( dialog, G_OBJECT( tooltip_widget ), "changed", G_CALLBACK( on_tooltip_changed ));
- label = base_window_get_widget( BASE_WINDOW( window ), "MenuIconLabel" );
- gtk_size_group_add_widget( GTK_SIZE_GROUP( size_group ), label );
+ GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
+ nact_window_signal_connect( dialog, G_OBJECT( GTK_BIN( icon_widget )->child ), "changed", G_CALLBACK( on_icon_changed ));
+
+ GtkWidget *button = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconBrowseButton" );
+ nact_window_signal_connect( dialog, G_OBJECT( button ), "clicked", G_CALLBACK( on_icon_browse ));
}
+/**
+ * A good place to set focus to the first visible field.
+ */
void
-nact_imenu_item_size_buttons( NactWindow *window, GObject *size_group )
+nact_iaction_tab_all_widgets_showed( NactWindow *dialog )
{
- g_assert( NACT_IS_WINDOW( window ));
- g_assert( GTK_IS_SIZE_GROUP( size_group ));
+ static const gchar *thisfn = "nact_iaction_tab_all_widgets_showed";
+ g_debug( "%s: dialog=%p", thisfn, dialog );
+}
- GtkWidget *button = base_window_get_widget( BASE_WINDOW( window ), "IconBrowseButton" );
- gtk_size_group_add_widget( GTK_SIZE_GROUP( size_group ), button );
+void
+nact_iaction_tab_dispose( NactWindow *dialog )
+{
+ static const gchar *thisfn = "nact_iaction_tab_dispose";
+ g_debug( "%s: dialog=%p", thisfn, dialog );
}
void
-nact_imenu_item_runtime_init( NactWindow *dialog, NAAction *action )
+nact_iaction_tab_set_action( NactWindow *dialog, const NAAction *action )
{
- static const gchar *thisfn = "nact_imenu_item_runtime_init";
+ static const gchar *thisfn = "nact_iaction_tab_set_action";
g_debug( "%s: dialog=%p, action=%p", thisfn, dialog, action );
- GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "MenuLabelEntry" );
- nact_window_signal_connect( dialog, G_OBJECT( label_widget ), "changed", G_CALLBACK( on_label_changed ));
+ GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionLabelEntry" );
gchar *label = na_action_get_label( action );
gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
g_free( label );
- GtkWidget *tooltip_widget = base_window_get_widget( BASE_WINDOW( dialog ), "MenuTooltipEntry" );
- nact_window_signal_connect( dialog, G_OBJECT( tooltip_widget ), "changed", G_CALLBACK( on_tooltip_changed ));
+ GtkWidget *tooltip_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionTooltipEntry" );
gchar *tooltip = na_action_get_tooltip( action );
gtk_entry_set_text( GTK_ENTRY( tooltip_widget ), tooltip );
g_free( tooltip );
- GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "MenuIconComboBoxEntry" );
- /*g_debug( "%s: icon_widget=%p, child=%p", thisfn, icon_widget, GTK_BIN( icon_widget )->child );*/
- nact_window_signal_connect( dialog, G_OBJECT( GTK_BIN( icon_widget )->child ), "changed", G_CALLBACK( on_icon_changed ));
+ GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
gchar *icon = na_action_get_icon( action );
gtk_entry_set_text( GTK_ENTRY( GTK_BIN( icon_widget )->child ), icon );
g_free( icon );
-
- GtkWidget *button = base_window_get_widget( BASE_WINDOW( dialog ), "IconBrowseButton" );
- nact_window_signal_connect( dialog, G_OBJECT( button ), "clicked", G_CALLBACK( on_icon_browse ));
-}
-
-/**
- * A good place to set focus to the first visible field.
- */
-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 );
-
- GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "MenuIconComboBoxEntry" );
- on_icon_changed( GTK_ENTRY( GTK_BIN( icon_widget )->child ), dialog );
}
/**
@@ -231,32 +212,20 @@ nact_imenu_item_all_widgets_showed( NactWindow *dialog )
* Returns TRUE if the label of the action is not empty.
*/
gboolean
-nact_imenu_item_has_label( NactWindow *window )
+nact_iaction_tab_has_label( NactWindow *window )
{
- GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( window ), "MenuLabelEntry" );
+ GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( window ), "ActionLabelEntry" );
const gchar *label = gtk_entry_get_text( GTK_ENTRY( label_widget ));
return( g_utf8_strlen( label, -1 ) > 0 );
}
-void
-nact_imenu_item_dispose( NactWindow *dialog )
-{
- static const gchar *thisfn = "nact_imenu_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 *
+static NAAction *
v_get_edited_action( NactWindow *window )
{
- g_assert( NACT_IS_IMENU_ITEM( window ));
+ g_assert( NACT_IS_IACTION_TAB( window ));
- if( NACT_IMENU_ITEM_GET_INTERFACE( window )->get_edited_action ){
- return( NACT_IMENU_ITEM_GET_INTERFACE( window )->get_edited_action( window ));
+ if( NACT_IACTION_TAB_GET_INTERFACE( window )->get_edited_action ){
+ return( NACT_IACTION_TAB_GET_INTERFACE( window )->get_edited_action( window ));
}
return( NULL );
@@ -265,10 +234,10 @@ v_get_edited_action( NactWindow *window )
static void
v_field_modified( NactWindow *window )
{
- g_assert( NACT_IS_IMENU_ITEM( window ));
+ g_assert( NACT_IS_IACTION_TAB( window ));
- if( NACT_IMENU_ITEM_GET_INTERFACE( window )->field_modified ){
- NACT_IMENU_ITEM_GET_INTERFACE( window )->field_modified( window );
+ if( NACT_IACTION_TAB_GET_INTERFACE( window )->field_modified ){
+ NACT_IACTION_TAB_GET_INTERFACE( window )->field_modified( window );
}
}
@@ -278,7 +247,7 @@ on_label_changed( GtkEntry *entry, gpointer user_data )
g_assert( NACT_IS_WINDOW( user_data ));
NactWindow *dialog = NACT_WINDOW( user_data );
- NAAction *edited = NA_ACTION( v_get_edited_action( dialog ));
+ NAAction *edited = v_get_edited_action( dialog );
na_action_set_label( edited, gtk_entry_get_text( entry ));
v_field_modified( dialog );
@@ -290,7 +259,7 @@ on_tooltip_changed( GtkEntry *entry, gpointer user_data )
g_assert( NACT_IS_WINDOW( user_data ));
NactWindow *dialog = NACT_WINDOW( user_data );
- NAAction *edited = NA_ACTION( v_get_edited_action( dialog ));
+ NAAction *edited = v_get_edited_action( dialog );
na_action_set_tooltip( edited, gtk_entry_get_text( entry ));
v_field_modified( dialog );
@@ -299,12 +268,12 @@ on_tooltip_changed( GtkEntry *entry, gpointer user_data )
static void
on_icon_changed( GtkEntry *icon_entry, gpointer user_data )
{
- static const gchar *thisfn = "nact_imenu_item_on_icon_changed";
+ static const gchar *thisfn = "nact_iaction_tab_on_icon_changed";
g_assert( NACT_IS_WINDOW( user_data ));
NactWindow *dialog = NACT_WINDOW( user_data );
- GtkWidget *image = base_window_get_widget( BASE_WINDOW( dialog ), "IconImage" );
+ GtkWidget *image = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconImage" );
g_assert( GTK_IS_WIDGET( image ));
display_icon( dialog, image, FALSE );
@@ -341,7 +310,7 @@ on_icon_changed( GtkEntry *icon_entry, gpointer user_data )
}
}
- NAAction *edited = NA_ACTION( v_get_edited_action( dialog ));
+ NAAction *edited = v_get_edited_action( dialog );
na_action_set_icon( edited, icon_name );
v_field_modified( dialog );
@@ -351,7 +320,7 @@ on_icon_changed( GtkEntry *icon_entry, gpointer user_data )
static void
on_icon_browse( GtkButton *button, gpointer user_data )
{
- g_assert( NACT_IS_IMENU_ITEM( user_data ));
+ g_assert( NACT_IS_IACTION_TAB( user_data ));
GtkWidget *dialog = gtk_file_chooser_dialog_new(
_( "Choosing an icon" ),
@@ -487,7 +456,7 @@ strip_underscore( const gchar *text )
static void
display_icon( NactWindow *window, GtkWidget *image, gboolean show )
{
- GtkFrame *frame = GTK_FRAME( base_window_get_widget( BASE_WINDOW( window ), "IconFrame" ));
+ GtkFrame *frame = GTK_FRAME( base_window_get_widget( BASE_WINDOW( window ), "ActionIconFrame" ));
if( show ){
gtk_widget_show( image );
diff --git a/src/nact/nact-iaction-tab.h b/src/nact/nact-iaction-tab.h
new file mode 100644
index 0000000..a304a31
--- /dev/null
+++ b/src/nact/nact-iaction-tab.h
@@ -0,0 +1,75 @@
+/*
+ * 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_IACTION_TAB_H__
+#define __NACT_IACTION_TAB_H__
+
+/*
+ * NactIActionTab interface definition.
+ *
+ * This interface implements the "Nautilus Menu Item" box.
+ */
+
+#include "nact-window.h"
+
+G_BEGIN_DECLS
+
+#define NACT_IACTION_TAB_TYPE ( nact_iaction_tab_get_type())
+#define NACT_IACTION_TAB( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_IACTION_TAB_TYPE, NactIActionTab ))
+#define NACT_IS_IACTION_TAB( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_IACTION_TAB_TYPE ))
+#define NACT_IACTION_TAB_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NACT_IACTION_TAB_TYPE, NactIActionTabInterface ))
+
+typedef struct NactIActionTab NactIActionTab;
+
+typedef struct NactIActionTabInterfacePrivate NactIActionTabInterfacePrivate;
+
+typedef struct {
+ GTypeInterface parent;
+ NactIActionTabInterfacePrivate *private;
+
+ /* api */
+ NAAction * ( *get_edited_action )( NactWindow *window );
+ void ( *field_modified ) ( NactWindow *window );
+}
+ NactIActionTabInterface;
+
+GType nact_iaction_tab_get_type( void );
+
+void nact_iaction_tab_initial_load( NactWindow *dialog );
+void nact_iaction_tab_runtime_init( NactWindow *dialog );
+void nact_iaction_tab_all_widgets_showed( NactWindow *dialog );
+void nact_iaction_tab_dispose( NactWindow *dialog );
+
+void nact_iaction_tab_set_action( NactWindow *dialog, const NAAction *action );
+gboolean nact_iaction_tab_has_label( NactWindow *window );
+
+G_END_DECLS
+
+#endif /* __NACT_IACTION_TAB_H__ */
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index 9325793..33b40a6 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -69,6 +69,7 @@ static gboolean v_on_button_press_event( GtkWidget *widget, GdkEventButton *ev
static gboolean v_on_key_pressed_event( GtkWidget *widget, GdkEventKey *event, gpointer data );
static GtkWidget *get_actions_list_widget( NactWindow *window );
+static gint sort_actions_by_label( gconstpointer a1, gconstpointer a2 );
GType
nact_iactions_list_get_type( void )
@@ -160,7 +161,6 @@ nact_iactions_list_initial_load( NactWindow *window )
model = gtk_list_store_new(
IACTIONS_LIST_N_COLUMN, GDK_TYPE_PIXBUF, G_TYPE_STRING, NA_ACTION_TYPE );
gtk_tree_view_set_model( GTK_TREE_VIEW( widget ), GTK_TREE_MODEL( model ));
- nact_iactions_list_fill( window );
g_object_unref( model );
/* create visible columns on the tree view */
@@ -188,6 +188,8 @@ nact_iactions_list_runtime_init( NactWindow *window )
GtkWidget *widget = get_actions_list_widget( window );
g_assert( GTK_IS_WIDGET( widget ));
+ nact_iactions_list_fill( window );
+
/* set up selection */
nact_window_signal_connect(
window,
@@ -232,6 +234,8 @@ nact_iactions_list_fill( NactWindow *window )
gtk_list_store_clear( model );
GSList *actions = v_get_actions( window );
+ actions = g_slist_sort( actions, ( GCompareFunc ) sort_actions_by_label );
+
GSList *ia;
/*g_debug( "%s: actions has %d elements", thisfn, g_slist_length( actions ));*/
@@ -348,12 +352,12 @@ nact_iactions_list_set_focus( NactWindow *window )
/**
* Returns the currently selected action.
*/
-GObject *
+NAAction *
nact_iactions_list_get_selected_action( NactWindow *window )
{
GSList *list = nact_iactions_list_get_selected_actions( window );
- GObject *action = G_OBJECT( list->data );
+ NAAction *action = NA_ACTION( list->data );
g_slist_free( list );
@@ -394,6 +398,12 @@ nact_iactions_list_get_selected_actions( NactWindow *window )
return( actions );
}
+
+void
+nact_iactions_list_set_modified( NactWindow *window, gboolean is_modified )
+{
+}
+
/**
* Does the IActionsList box support multiple selection ?
*/
@@ -519,3 +529,20 @@ get_actions_list_widget( NactWindow *window )
{
return( base_window_get_widget( BASE_WINDOW( window ), "ActionsList" ));
}
+
+static gint
+sort_actions_by_label( gconstpointer a1, gconstpointer a2 )
+{
+ NAAction *action1 = NA_ACTION( a1 );
+ gchar *label1 = na_action_get_label( action1 );
+
+ NAAction *action2 = NA_ACTION( a2 );
+ gchar *label2 = na_action_get_label( action2 );
+
+ gint ret = g_utf8_collate( label1, label2 );
+
+ g_free( label1 );
+ g_free( label2 );
+
+ return( ret );
+}
diff --git a/src/nact/nact-iactions-list.h b/src/nact/nact-iactions-list.h
index 3089033..06366a5 100644
--- a/src/nact/nact-iactions-list.h
+++ b/src/nact/nact-iactions-list.h
@@ -68,19 +68,20 @@ typedef struct {
}
NactIActionsListInterface;
-GType nact_iactions_list_get_type( void );
+GType nact_iactions_list_get_type( void );
-void nact_iactions_list_initial_load( NactWindow *window );
-void nact_iactions_list_runtime_init( NactWindow *window );
-void nact_iactions_list_fill( NactWindow *window );
-GObject *nact_iactions_list_get_selected_action( NactWindow *window );
-GSList *nact_iactions_list_get_selected_actions( NactWindow *window );
-void nact_iactions_list_set_selection( NactWindow *window, const gchar *uuid, const gchar *label );
-void nact_iactions_list_set_focus( NactWindow *window );
+void nact_iactions_list_initial_load( NactWindow *window );
+void nact_iactions_list_runtime_init( NactWindow *window );
+void nact_iactions_list_fill( NactWindow *window );
+NAAction *nact_iactions_list_get_selected_action( NactWindow *window );
+GSList * nact_iactions_list_get_selected_actions( NactWindow *window );
+void nact_iactions_list_set_selection( NactWindow *window, const gchar *uuid, const gchar *label );
+void nact_iactions_list_set_focus( NactWindow *window );
+void nact_iactions_list_set_modified( NactWindow *window, gboolean is_modified );
-void nact_iactions_list_set_multiple_selection( NactWindow *window, gboolean multiple );
-void nact_iactions_list_set_send_selection_changed_on_fill_list( NactWindow *window, gboolean send_message );
-void nact_iactions_list_set_is_filling_list( NactWindow *window, gboolean is_filling );
+void nact_iactions_list_set_multiple_selection( NactWindow *window, gboolean multiple );
+void nact_iactions_list_set_send_selection_changed_on_fill_list( NactWindow *window, gboolean send_message );
+void nact_iactions_list_set_is_filling_list( NactWindow *window, gboolean is_filling );
G_END_DECLS
diff --git a/src/nact/nact-iprefs.c b/src/nact/nact-iprefs.c
index 85d2656..ff62bbb 100644
--- a/src/nact/nact-iprefs.c
+++ b/src/nact/nact-iprefs.c
@@ -67,6 +67,8 @@ static GSList *position_to_listint( NactWindow *window, gint x, gint y, gint wid
static void free_listint( GSList *list );
static gchar *read_key_str( NactWindow *window, const gchar *key );
static void save_key_str( NactWindow *window, const gchar *key, const gchar *text );
+static gint read_key_int( NactWindow *window, const gchar *name );
+static void write_key_int( NactWindow *window, const gchar *name, gint value );
GType
nact_iprefs_get_type( void )
@@ -285,6 +287,23 @@ nact_iprefs_save_export_folder_uri( NactWindow *window, const gchar *uri )
save_key_str( window, IPREFS_EXPORT_ACTIONS_FOLDER_URI, uri );
}
+/**
+ * Get/set a named integer.
+ *
+ * @window: this NactWindow-derived window.
+ */
+gint
+nact_iprefs_get_int( NactWindow *window, const gchar *name )
+{
+ return( read_key_int( window, name ));
+}
+
+void
+nact_iprefs_set_int( NactWindow *window, const gchar *name, gint value )
+{
+ write_key_int( window, name, value );
+}
+
static gchar *
v_get_iprefs_window_id( NactWindow *window )
{
@@ -432,3 +451,38 @@ save_key_str( NactWindow *window, const gchar *key, const gchar *text )
g_free( path );
}
+
+static gint
+read_key_int( NactWindow *window, const gchar *name )
+{
+ static const gchar *thisfn = "nact_iprefs_read_key_int";
+ GError *error = NULL;
+ gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
+
+ gint value = gconf_client_get_int( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, &error );
+
+ if( error ){
+ g_warning( "%s: name=%s, %s", thisfn, name, error->message );
+ g_error_free( error );
+ }
+
+ g_free( path );
+ return( value );
+}
+
+static void
+write_key_int( NactWindow *window, const gchar *name, gint value )
+{
+ static const gchar *thisfn = "nact_iprefs_write_key_int";
+ GError *error = NULL;
+ gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
+
+ gconf_client_set_int( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, value, &error );
+
+ if( error ){
+ g_warning( "%s: name=%s, %s", thisfn, name, error->message );
+ g_error_free( error );
+ }
+
+ g_free( path );
+}
diff --git a/src/nact/nact-iprefs.h b/src/nact/nact-iprefs.h
index 6ba72ef..e2caa23 100644
--- a/src/nact/nact-iprefs.h
+++ b/src/nact/nact-iprefs.h
@@ -34,7 +34,7 @@
/*
* NactIPrefs interface definition.
*
- * This interface should be implemented by all dialogs which wish take
+ * This interface may be implemented by all dialogs which wish take
* benefit of preferences management.
*/
@@ -80,6 +80,9 @@ void nact_iprefs_save_import_folder_uri( NactWindow *window, const gchar *uri
gchar *nact_iprefs_get_export_folder_uri( NactWindow *window );
void nact_iprefs_save_export_folder_uri( NactWindow *window, const gchar *uri );
+gint nact_iprefs_get_int( NactWindow *window, const gchar *key );
+void nact_iprefs_set_int( NactWindow *window, const gchar *key, gint value );
+
G_END_DECLS
#endif /* __NACT_IPREFS_H__ */
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 7825205..0c3755d 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -37,8 +37,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <common/na-action.h>
-#include <common/na-action-profile.h>
#include <common/na-pivot.h>
#include <common/na-iio-provider.h>
#include <common/na-ipivot-container.h>
@@ -49,6 +47,7 @@
#include "nact-assist-export.h"
#include "nact-assist-import.h"
#include "nact-iactions-list.h"
+#include "nact-iaction-tab.h"
#include "nact-iprefs.h"
#include "nact-main-window.h"
@@ -60,9 +59,13 @@ struct NactMainWindowClassPrivate {
/* private instance data
*/
struct NactMainWindowPrivate {
- gboolean dispose_has_run;
- gchar *current_uuid;
- gchar *current_label;
+ gboolean dispose_has_run;
+ GtkStatusbar *status_bar;
+ guint status_context;
+ GtkWidget *save_item;
+ GSList *actions;
+ /*gchar *current_uuid;
+ gchar *current_label;*/
};
/* the GConf key used to read/write size and position of auxiliary dialogs
@@ -71,35 +74,51 @@ struct NactMainWindowPrivate {
static GObjectClass *st_parent_class = NULL;
-static GType register_type( void );
-static void class_init( NactMainWindowClass *klass );
-static void iactions_list_iface_init( NactIActionsListInterface *iface );
-static void ipivot_container_iface_init( NAIPivotContainerInterface *iface );
-static void instance_init( GTypeInstance *instance, gpointer klass );
-static void instance_dispose( GObject *application );
-static void instance_finalize( GObject *application );
-
-static gchar *get_iprefs_window_id( NactWindow *window );
-static gchar *get_toplevel_name( BaseWindow *window );
-static void on_initial_load_toplevel( BaseWindow *window );
-static void on_runtime_init_toplevel( BaseWindow *window );
-
-static void on_actions_list_selection_changed( GtkTreeSelection *selection, gpointer user_data );
-static gboolean on_actions_list_double_click( GtkWidget *widget, GdkEventButton *event, gpointer data );
-static gboolean on_actions_list_enter_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer data );
-
-static void on_about_button_clicked( GtkButton *button, gpointer user_data );
-static void on_new_button_clicked( GtkButton *button, gpointer user_data );
+static GType register_type( void );
+static void class_init( NactMainWindowClass *klass );
+static void iactions_list_iface_init( NactIActionsListInterface *iface );
+static void iaction_tab_iface_init( NactIActionTabInterface *iface );
+static void ipivot_container_iface_init( NAIPivotContainerInterface *iface );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *application );
+static void instance_finalize( GObject *application );
+
+static gchar *get_iprefs_window_id( NactWindow *window );
+static gchar *get_toplevel_name( BaseWindow *window );
+static GSList *get_actions( NactWindow *window );
+
+static void on_initial_load_toplevel( BaseWindow *window );
+static void create_file_menu( BaseWindow *window, GtkMenuBar *menubar );
+static void create_tools_menu( BaseWindow *window, GtkMenuBar *menubar );
+static void create_help_menu( BaseWindow *window, GtkMenuBar *menubar );
+static void on_runtime_init_toplevel( BaseWindow *window );
+static void setup_dialog_title( NactWindow *window, gboolean is_modified );
+static void setup_dialog_menu( NactWindow *window, gboolean can_save );
+
+static void on_actions_list_selection_changed( GtkTreeSelection *selection, gpointer user_data );
+static gboolean on_actions_list_double_click( GtkWidget *widget, GdkEventButton *event, gpointer data );
+static gboolean on_actions_list_enter_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer data );
+static void set_current_action( NactMainWindow *window, const NAAction *action );
+static NAAction *get_edited_action( NactWindow *window );
+static void on_modified_field( NactWindow *window );
+static gboolean is_edited_modified( NactMainWindow *window );
+
+static void on_import_activated( GtkMenuItem *item, gpointer user_data );
+static void on_import_selected( GtkItem *item, gpointer user_data );
+static void on_export_activated( GtkMenuItem *item, gpointer user_data );
+static void on_export_selected( GtkItem *item, gpointer user_data );
+static void on_about_activated( GtkMenuItem *item, gpointer user_data );
+static void on_about_selected( GtkItem *item, gpointer user_data );
+static void on_menu_item_deselected( GtkItem *item, gpointer user_data );
+/*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_import_button_clicked( GtkButton *button, gpointer user_data );
-static void on_export_button_clicked( GtkButton *button, gpointer user_data );
-static gboolean on_dialog_response( GtkDialog *dialog, gint response_id, BaseWindow *window );
+static gboolean on_dialog_response( GtkDialog *dialog, gint response_id, BaseWindow *window );*/
+static void on_close( GtkMenuItem *item, gpointer user_data );
+static gboolean on_delete_event( BaseWindow *window, GtkWindow *toplevel, GdkEvent *event );
-static GSList *do_get_actions( NactWindow *window );
-static void on_actions_changed( NAIPivotContainer *instance, gpointer user_data );
-static void do_set_current_action( NactWindow *window, const NAAction *action );
+static void on_actions_changed( NAIPivotContainer *instance, gpointer user_data );
GType
nact_main_window_get_type( void )
@@ -130,7 +149,6 @@ register_type( void )
0,
( GInstanceInitFunc ) instance_init
};
-
GType type = g_type_register_static( NACT_WINDOW_TYPE, "NactMainWindow", &info, 0 );
/* implement IActionsList interface
@@ -140,9 +158,17 @@ register_type( void )
NULL,
NULL
};
-
g_type_add_interface_static( type, NACT_IACTIONS_LIST_TYPE, &iactions_list_iface_info );
+ /* implement IActionTab interface
+ */
+ static const GInterfaceInfo iaction_tab_iface_info = {
+ ( GInterfaceInitFunc ) iaction_tab_iface_init,
+ NULL,
+ NULL
+ };
+ g_type_add_interface_static( type, NACT_IACTION_TAB_TYPE, &iaction_tab_iface_info );
+
/* implement IPivotContainer interface
*/
static const GInterfaceInfo pivot_container_iface_info = {
@@ -150,7 +176,6 @@ register_type( void )
NULL,
NULL
};
-
g_type_add_interface_static( type, NA_IPIVOT_CONTAINER_TYPE, &pivot_container_iface_info );
return( type );
@@ -174,11 +199,10 @@ class_init( NactMainWindowClass *klass )
base_class->get_toplevel_name = get_toplevel_name;
base_class->initial_load_toplevel = on_initial_load_toplevel;
base_class->runtime_init_toplevel = on_runtime_init_toplevel;
- base_class->dialog_response = on_dialog_response;
+ base_class->delete_event = on_delete_event;
NactWindowClass *nact_class = NACT_WINDOW_CLASS( klass );
nact_class->get_iprefs_window_id = get_iprefs_window_id;
- nact_class->set_current_action = do_set_current_action;
}
static void
@@ -187,13 +211,23 @@ iactions_list_iface_init( NactIActionsListInterface *iface )
static const gchar *thisfn = "nact_main_window_iactions_list_iface_init";
g_debug( "%s: iface=%p", thisfn, iface );
- iface->get_actions = do_get_actions;
+ iface->get_actions = get_actions;
iface->on_selection_changed = on_actions_list_selection_changed;
iface->on_double_click = on_actions_list_double_click;
iface->on_enter_key_pressed = on_actions_list_enter_key_pressed;
}
static void
+iaction_tab_iface_init( NactIActionTabInterface *iface )
+{
+ static const gchar *thisfn = "nact_main_window_iaction_tab_iface_init";
+ g_debug( "%s: iface=%p", thisfn, iface );
+
+ iface->get_edited_action = get_edited_action;
+ iface->field_modified = on_modified_field;
+}
+
+static void
ipivot_container_iface_init( NAIPivotContainerInterface *iface )
{
static const gchar *thisfn = "nact_main_window_ipivot_container_iface_init";
@@ -229,6 +263,16 @@ instance_dispose( GObject *window )
self->private->dispose_has_run = TRUE;
+ GtkWidget *pane = base_window_get_widget( BASE_WINDOW( window ), "MainPaned" );
+ gint pos = gtk_paned_get_position( GTK_PANED( pane ));
+ nact_iprefs_set_int( NACT_WINDOW( window ), "main-paned", pos );
+
+ GSList *ia;
+ for( ia = self->private->actions ; ia ; ia = ia->next ){
+ g_object_unref( NA_ACTION( ia->data ));
+ }
+ g_slist_free( self->private->actions );
+
/* chain up to the parent class */
G_OBJECT_CLASS( st_parent_class )->dispose( window );
}
@@ -243,8 +287,8 @@ instance_finalize( GObject *window )
g_assert( NACT_IS_MAIN_WINDOW( window ));
NactMainWindow *self = ( NactMainWindow * ) window;
- g_free( self->private->current_uuid );
- g_free( self->private->current_label );
+ /*g_free( self->private->current_uuid );
+ g_free( self->private->current_label );*/
g_free( self->private );
@@ -277,6 +321,19 @@ get_toplevel_name( BaseWindow *window )
return( g_strdup( "MainWindow" ));
}
+static GSList *
+get_actions( NactWindow *window )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( window ));
+ return( NACT_MAIN_WINDOW( window )->private->actions );
+}
+
+/*
+ * note that for this NactMainWindow, on_initial_load_toplevel and
+ * on_runtime_init_toplevel are equivalent, as there is only one
+ * occurrence on this window in the application : closing this window
+ * is the same than quitting the application
+ */
static void
on_initial_load_toplevel( BaseWindow *window )
{
@@ -289,12 +346,118 @@ on_initial_load_toplevel( BaseWindow *window )
g_debug( "%s: window=%p", thisfn, window );
g_assert( NACT_IS_MAIN_WINDOW( window ));
- /*NactMainWindow *wnd = NACT_MAIN_WINDOW( window );*/
+ NactMainWindow *wnd = NACT_MAIN_WINDOW( window );
+
+ NactApplication *application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( wnd )));
+ NAPivot *pivot = NA_PIVOT( nact_application_get_pivot( application ));
+ GSList *origin = na_pivot_get_actions( pivot );
+ GSList *ia;
+ for( ia = origin ; ia ; ia = ia->next ){
+ wnd->private->actions = g_slist_prepend( wnd->private->actions, na_action_duplicate( NA_ACTION( ia->data )));
+ }
+
+ GtkWidget *vbox = base_window_get_widget( window, "MenuBarVBox" );
+ GtkWidget *menubar = gtk_menu_bar_new();
+ gtk_container_add( GTK_CONTAINER( vbox ), menubar );
+
+ create_file_menu( window, GTK_MENU_BAR( menubar ));
+ create_tools_menu( window, GTK_MENU_BAR( menubar ));
+ create_help_menu( window, GTK_MENU_BAR( menubar ));
+
+ wnd->private->status_bar = GTK_STATUSBAR( base_window_get_widget( window, "StatusBar" ));
+ wnd->private->status_context = gtk_statusbar_get_context_id( wnd->private->status_bar, "NautilusActionsConfigurationTool" );
g_assert( NACT_IS_IACTIONS_LIST( window ));
nact_iactions_list_initial_load( NACT_WINDOW( window ));
nact_iactions_list_set_multiple_selection( NACT_WINDOW( window ), FALSE );
nact_iactions_list_set_send_selection_changed_on_fill_list( NACT_WINDOW( window ), FALSE );
+
+ g_assert( NACT_IS_IACTION_TAB( window ));
+ nact_iaction_tab_initial_load( NACT_WINDOW( window ));
+
+ /*g_assert( NACT_IS_COMMAND_TAB( window ));
+ nact_icommand_tab_initial_load( window );
+
+ g_assert( NACT_IS_CONDITIONS_TAB( window ));
+ nact_iconditions_tab_initial_load( window );
+
+ g_assert( NACT_IS_ADVANCED_TAB( window ));
+ nact_iadvanced_tab_initial_load( window );*/
+
+ gint pos = nact_iprefs_get_int( NACT_WINDOW( window ), "main-paned" );
+ if( pos ){
+ GtkWidget *pane = base_window_get_widget( window, "MainPaned" );
+ gtk_paned_set_position( GTK_PANED( pane ), pos );
+ }
+}
+
+static void
+create_file_menu( BaseWindow *window, GtkMenuBar *menubar )
+{
+ /* i18n: File menu */
+ GtkWidget *file = gtk_menu_item_new_with_label( _( "_File" ));
+ gtk_menu_item_set_use_underline( GTK_MENU_ITEM( file ), TRUE );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menubar ), file );
+ GtkWidget *menu = gtk_menu_new();
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( file ), menu );
+
+ GtkWidget *item = gtk_image_menu_item_new_from_stock( GTK_STOCK_NEW, NULL );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
+
+ item = gtk_image_menu_item_new_from_stock( GTK_STOCK_SAVE, NULL );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
+ NACT_MAIN_WINDOW( window )->private->save_item = item;
+
+ item = gtk_separator_menu_item_new();
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
+
+ item = gtk_image_menu_item_new_from_stock( GTK_STOCK_CLOSE, NULL );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "activate", G_CALLBACK( on_close ));
+}
+
+static void
+create_tools_menu( BaseWindow *window, GtkMenuBar *menubar )
+{
+ /* i18n: Tools menu */
+ GtkWidget *tools = gtk_menu_item_new_with_label( _( "_Tools" ));
+ gtk_menu_item_set_use_underline( GTK_MENU_ITEM( tools ), TRUE );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menubar ), tools );
+ GtkWidget *menu = gtk_menu_new();
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( tools ), menu );
+
+ /* i18n: Import item in Tools menu */
+ GtkWidget *item = gtk_image_menu_item_new_with_label( _( "_Import" ));
+ gtk_menu_item_set_use_underline( GTK_MENU_ITEM( item ), TRUE );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "activate", G_CALLBACK( on_import_activated ));
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "select", G_CALLBACK( on_import_selected ));
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "deselect", G_CALLBACK( on_menu_item_deselected ));
+
+ /* i18n: Export item in Tools menu */
+ item = gtk_image_menu_item_new_with_label( _( "_Export" ));
+ gtk_menu_item_set_use_underline( GTK_MENU_ITEM( item ), TRUE );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "activate", G_CALLBACK( on_export_activated ));
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "select", G_CALLBACK( on_export_selected ));
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "deselect", G_CALLBACK( on_menu_item_deselected ));
+}
+
+static void
+create_help_menu( BaseWindow *window, GtkMenuBar *menubar )
+{
+ /* i18n: Help menu */
+ GtkWidget *help = gtk_menu_item_new_with_label( _( "_Help" ));
+ gtk_menu_item_set_use_underline( GTK_MENU_ITEM( help ), TRUE );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menubar ), help );
+ GtkWidget *menu = gtk_menu_new();
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM( help ), menu );
+
+ GtkWidget *item = gtk_image_menu_item_new_from_stock( GTK_STOCK_ABOUT, NULL );
+ gtk_menu_shell_append( GTK_MENU_SHELL( menu ), item );
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "activate", G_CALLBACK( on_about_activated ));
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "select", G_CALLBACK( on_about_selected ));
+ nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( item ), "deselect", G_CALLBACK( on_menu_item_deselected ));
}
static void
@@ -311,38 +474,63 @@ on_runtime_init_toplevel( BaseWindow *window )
g_assert( NACT_IS_MAIN_WINDOW( window ));
/*NactMainWindow *wnd = NACT_MAIN_WINDOW( window );*/
+ g_assert( NACT_IS_IACTIONS_LIST( window ));
nact_iactions_list_runtime_init( NACT_WINDOW( window ));
- nact_window_signal_connect_by_name( NACT_WINDOW( window ), "AboutButton", "clicked", G_CALLBACK( on_about_button_clicked ));
- nact_window_signal_connect_by_name( NACT_WINDOW( window ), "NewActionButton", "clicked", G_CALLBACK( on_new_button_clicked ));
+ g_assert( NACT_IS_IACTION_TAB( window ));
+ nact_iaction_tab_runtime_init( NACT_WINDOW( window ));
+
+ /*nact_window_signal_connect_by_name( NACT_WINDOW( window ), "NewActionButton", "clicked", G_CALLBACK( on_new_button_clicked ));
nact_window_signal_connect_by_name( NACT_WINDOW( window ), "EditActionButton", "clicked", G_CALLBACK( on_edit_button_clicked ));
nact_window_signal_connect_by_name( NACT_WINDOW( window ), "DuplicateActionButton", "clicked", G_CALLBACK( on_duplicate_button_clicked ));
nact_window_signal_connect_by_name( NACT_WINDOW( window ), "DeleteActionButton", "clicked", G_CALLBACK( on_delete_button_clicked ));
nact_window_signal_connect_by_name( NACT_WINDOW( window ), "ImportButton", "clicked", G_CALLBACK( on_import_button_clicked ));
- nact_window_signal_connect_by_name( NACT_WINDOW( window ), "ExportButton", "clicked", G_CALLBACK( on_export_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "ExportButton", "clicked", G_CALLBACK( on_export_button_clicked ));*/
+}
+
+static void
+setup_dialog_title( NactWindow *window, gboolean is_modified )
+{
+ BaseApplication *appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
+ gchar *title = base_application_get_name( appli );
+ gchar *newtitle = g_strdup_printf( "%s%s", is_modified ? "*":"", title );
+
+ GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
+ gtk_window_set_title( toplevel, newtitle );
+
+ g_free( newtitle );
+ g_free( title );
+}
+
+static void
+setup_dialog_menu( NactWindow *window, gboolean can_save )
+{
+ gtk_widget_set_sensitive( NACT_MAIN_WINDOW( window )->private->save_item, can_save );
}
static void
on_actions_list_selection_changed( GtkTreeSelection *selection, gpointer user_data )
{
- /*static const gchar *thisfn = "nact_main_window_on_actions_list_selection_changed";
- g_debug( "%s: selection=%p, user_data=%p", thisfn, selection, user_data );*/
+ /*static const gchar *thisfn = "nact_main_window_on_actions_list_selection_changed";*/
+ /*g_debug( "%s: selection=%p, user_data=%p", thisfn, selection, user_data );*/
g_assert( NACT_IS_MAIN_WINDOW( user_data ));
- BaseWindow *window = BASE_WINDOW( user_data );
+ NactMainWindow *window = NACT_MAIN_WINDOW( user_data );
- GtkWidget *edit_button = base_window_get_widget( window, "EditActionButton" );
+ /*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 *duplicate_button = base_window_get_widget( window, "DuplicateActionButton" );*/
- gboolean enabled = ( gtk_tree_selection_count_selected_rows( selection ) > 0 );
+ /*gboolean enabled = ( gtk_tree_selection_count_selected_rows( selection ) > 0 );*/
- gtk_widget_set_sensitive( edit_button, enabled );
+ /*gtk_widget_set_sensitive( edit_button, enabled );
gtk_widget_set_sensitive( delete_button, enabled );
- gtk_widget_set_sensitive( duplicate_button, enabled );
+ gtk_widget_set_sensitive( duplicate_button, enabled );*/
NAAction *action = NA_ACTION( nact_iactions_list_get_selected_action( NACT_WINDOW( window )));
- do_set_current_action( NACT_WINDOW( window ), action );
+ if( action ){
+ set_current_action( window, action );
+ }
}
static gboolean
@@ -350,7 +538,7 @@ on_actions_list_double_click( GtkWidget *widget, GdkEventButton *event, gpointer
{
g_assert( event->type == GDK_2BUTTON_PRESS );
- on_edit_button_clicked( NULL, user_data );
+ /*on_edit_button_clicked( NULL, user_data );*/
return( TRUE );
}
@@ -358,24 +546,139 @@ on_actions_list_double_click( GtkWidget *widget, GdkEventButton *event, gpointer
static gboolean
on_actions_list_enter_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer user_data )
{
- on_edit_button_clicked( NULL, user_data );
+ /*on_edit_button_clicked( NULL, user_data );*/
return( TRUE );
}
+/*
+ * update the notebook when selection changes in IActionsList
+ */
+static void
+set_current_action( NactMainWindow *window, const NAAction *action )
+{
+ /*NactMainWindow *window = NACT_MAIN_WINDOW( wnd );*/
+
+ /*g_free( window->private->current_uuid );
+ window->private->current_uuid = NULL;
+
+ g_free( window->private->current_label );
+ window->private->current_label = NULL;
+
+ if( action ){
+ g_assert( NA_IS_ACTION( action ));
+ window->private->current_uuid = na_action_get_uuid( action );
+ window->private->current_label = na_action_get_label( action );
+ }*/
+
+ nact_iaction_tab_set_action( NACT_WINDOW( window ), action );
+}
+
+/*
+ * update the currently edited action when an field is modified
+ * (called as a virtual function by each interface tab)
+ */
+static NAAction *
+get_edited_action( NactWindow *window )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( window ));
+ return( nact_iactions_list_get_selected_action( window ));
+}
+
+/*
+ * called as a virtual function by each interface tab when a field
+ * has been modified : time to set the 'modified' flag in the
+ * IActionsList box
+ */
+static void
+on_modified_field( NactWindow *window )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( window ));
+
+ gboolean is_modified = is_edited_modified( NACT_MAIN_WINDOW( window ));
+ /*g_debug( "on_modified_field: is_modified=%s", is_modified ? "True":"False" );*/
+ setup_dialog_title( window, is_modified );
+ nact_iactions_list_set_modified( window, is_modified );
+
+ gboolean can_save = is_modified && nact_iaction_tab_has_label( window );
+ setup_dialog_menu( window, can_save );
+}
+
+static gboolean
+is_edited_modified( NactMainWindow *window )
+{
+ NAAction *edited = nact_iactions_list_get_selected_action( NACT_WINDOW( window ));
+ gchar *uuid = na_action_get_uuid( edited );
+ NactApplication *application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
+ NAPivot *pivot = NA_PIVOT( nact_application_get_pivot( application ));
+ NAAction *original = NA_ACTION( na_pivot_get_action( pivot, uuid ));
+ g_free( uuid );
+ return( !na_action_are_equal( edited, original ));
+}
+
+static void
+on_import_activated( GtkMenuItem *item, gpointer user_data )
+{
+ static const gchar *thisfn = "nact_main_window_on_import_activated";
+ g_debug( "%s: item=%p, user_data=%p", thisfn, item, user_data );
+
+ nact_assist_import_run( NACT_WINDOW( user_data ));
+
+ /*g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactWindow *wndmain = NACT_WINDOW( user_data );
+ nact_iactions_list_set_focus( wndmain );*/
+}
+
+static void
+on_import_selected( GtkItem *item, gpointer user_data )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactMainWindow *window = NACT_MAIN_WINDOW( user_data );
+ gtk_statusbar_push(
+ window->private->status_bar,
+ window->private->status_context,
+ /* i18n: tooltip displayed in the status bar when selecting the Import item */
+ _( "Import one or more actions from external (XML) files into your configuration" ));
+}
+
+static void
+on_export_activated( GtkMenuItem *item, gpointer user_data )
+{
+ static const gchar *thisfn = "nact_main_window_on_export_activated";
+ g_debug( "%s: item=%p, user_data=%p", thisfn, item, user_data );
+
+ nact_assist_export_run( NACT_WINDOW( user_data ));
+
+ /*g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactWindow *wndmain = NACT_WINDOW( user_data );
+ nact_iactions_list_set_focus( wndmain );*/
+}
+
+static void
+on_export_selected( GtkItem *item, gpointer user_data )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactMainWindow *window = NACT_MAIN_WINDOW( user_data );
+ gtk_statusbar_push(
+ window->private->status_bar,
+ window->private->status_context,
+ /* i18n: tooltip displayed in the status bar when selecting the Export item */
+ _( "Export one or more actions from your configuration to external XML files" ));
+}
+
/* TODO: make the website url and the mail addresses clickables
*/
static void
-on_about_button_clicked( GtkButton *button, gpointer user_data )
+on_about_activated( GtkMenuItem *item, gpointer user_data )
{
- static const gchar *thisfn = "nact_main_window_on_about_button_clicked";
- g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
+ static const gchar *thisfn = "nact_main_window_on_about_activated";
+ g_debug( "%s: item=%p, user_data=%p", thisfn, item, user_data );
- g_assert( BASE_IS_WINDOW( user_data ));
- BaseWindow *wndmain = BASE_WINDOW( user_data );
+ g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactMainWindow *window = NACT_MAIN_WINDOW( user_data );
BaseApplication *appli;
- g_object_get( G_OBJECT( wndmain ), PROP_WINDOW_APPLICATION_STR, &appli, NULL );
+ g_object_get( G_OBJECT( window ), PROP_WINDOW_APPLICATION_STR, &appli, NULL );
gchar *icon_name = base_application_get_icon_name( appli );
static const gchar *artists[] = {
@@ -411,7 +714,7 @@ on_about_button_clicked( GtkButton *button, gpointer user_data )
};
gchar *license_i18n = g_strjoinv( "\n\n", license );
- GtkWindow *toplevel = base_window_get_toplevel_dialog( wndmain );
+ GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
gtk_show_about_dialog( toplevel,
"artists", artists,
@@ -430,7 +733,27 @@ on_about_button_clicked( GtkButton *button, gpointer user_data )
g_free( license_i18n );
g_free( icon_name );
- nact_iactions_list_set_focus( NACT_WINDOW( wndmain ));
+ /*nact_iactions_list_set_focus( NACT_WINDOW( wndmain ));*/
+}
+
+static void
+on_about_selected( GtkItem *item, gpointer user_data )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactMainWindow *window = NACT_MAIN_WINDOW( user_data );
+ gtk_statusbar_push(
+ window->private->status_bar,
+ window->private->status_context,
+ /* i18n: tooltip displayed in the status bar when selecting the About item */
+ _( "Display informations about this program" ));
+}
+
+static void
+on_menu_item_deselected( GtkItem *item, gpointer user_data )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactMainWindow *window = NACT_MAIN_WINDOW( user_data );
+ gtk_statusbar_pop( window->private->status_bar, window->private->status_context );
}
/*
@@ -440,7 +763,7 @@ on_about_button_clicked( GtkButton *button, gpointer user_data )
* that it is useful and actually used.
* so the new action is silently created with a default profile name
*/
-static void
+/*static void
on_new_button_clicked( GtkButton *button, gpointer user_data )
{
static const gchar *thisfn = "nact_main_window_on_new_button_clicked";
@@ -452,7 +775,7 @@ on_new_button_clicked( GtkButton *button, gpointer user_data )
nact_action_conditions_editor_run_editor( wndmain, NULL );
nact_iactions_list_set_focus( wndmain );
-}
+}*/
/*
* editing an existing action
@@ -465,7 +788,7 @@ on_new_button_clicked( GtkButton *button, gpointer user_data )
* - if there are more than one profile, one can assume that the user has
* found a use to the profiles, and let him edit them
*/
-static void
+/*static void
on_edit_button_clicked( GtkButton *button, gpointer user_data )
{
static const gchar *thisfn = "nact_main_window_on_edit_button_clicked";
@@ -485,9 +808,9 @@ on_edit_button_clicked( GtkButton *button, gpointer user_data )
}
nact_iactions_list_set_focus( wndmain );
-}
+}*/
-static void
+/*static void
on_duplicate_button_clicked( GtkButton *button, gpointer user_data )
{
static const gchar *thisfn = "nact_main_window_on_duplicate_button_clicked";
@@ -527,9 +850,9 @@ on_duplicate_button_clicked( GtkButton *button, gpointer user_data )
}
nact_iactions_list_set_focus( wndmain );
-}
+}*/
-static void
+/*static void
on_delete_button_clicked( GtkButton *button, gpointer user_data )
{
static const gchar *thisfn = "nact_main_window_on_delete_button_clicked";
@@ -563,71 +886,63 @@ on_delete_button_clicked( GtkButton *button, gpointer user_data )
}
nact_iactions_list_set_focus( wndmain );
-}
-
-static void
-on_import_button_clicked( GtkButton *button, gpointer user_data )
-{
- static const gchar *thisfn = "nact_main_window_on_import_button_clicked";
- g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
-
- nact_assist_import_run( NACT_WINDOW( user_data ));
-
- g_assert( NACT_IS_MAIN_WINDOW( user_data ));
- NactWindow *wndmain = NACT_WINDOW( user_data );
- nact_iactions_list_set_focus( wndmain );
-}
-
-/*
- * ExportButton is a toggle button
- * When activated (selection-for-export mode), all other buttons are
- * disabled, but 'SaveAs' ; the ActionsList accept multiple selection
- */
-static void
-on_export_button_clicked( GtkButton *button, gpointer user_data )
-{
- static const gchar *thisfn = "nact_main_window_on_export_button_clicked";
- g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
-
- nact_assist_export_run( NACT_WINDOW( user_data ));
-
- g_assert( NACT_IS_MAIN_WINDOW( user_data ));
- NactWindow *wndmain = NACT_WINDOW( user_data );
- nact_iactions_list_set_focus( wndmain );
-}
+}*/
-static gboolean
+/*static gboolean
on_dialog_response( GtkDialog *dialog, gint response_id, BaseWindow *window )
{
static const gchar *thisfn = "nact_main_window_on_dialog_response";
g_debug( "%s: dialog=%p, response_id=%d, window=%p", thisfn, dialog, response_id, window );
g_assert( NACT_IS_MAIN_WINDOW( window ));
-
+*/
/*GtkWidget *paste_button = nact_get_glade_widget_from ("PasteProfileButton", GLADE_EDIT_DIALOG_WIDGET);*/
- switch( response_id ){
+ /*switch( response_id ){
case GTK_RESPONSE_NONE:
case GTK_RESPONSE_DELETE_EVENT:
- case GTK_RESPONSE_CLOSE:
+ case GTK_RESPONSE_CLOSE:*/
/* Free any profile in the clipboard */
/*nautilus_actions_config_action_profile_free (g_object_steal_data (G_OBJECT (paste_button), "profile"));*/
- g_object_unref( window );
+ /*g_object_unref( window );
return( TRUE );
break;
}
return( FALSE );
+}*/
+
+static void
+on_close( GtkMenuItem *item, gpointer user_data )
+{
+ static const gchar *thisfn = "nact_main_window_on_close";
+ g_debug( "%s: item=%p, user_data=%p", thisfn, item, user_data );
+
+ g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactMainWindow *window = NACT_MAIN_WINDOW( user_data );
+
+ g_object_unref( window );
}
-static GSList *
-do_get_actions( NactWindow *window )
+static gboolean
+on_delete_event( BaseWindow *window, GtkWindow *toplevel, GdkEvent *event )
{
- NactApplication *application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- NAPivot *pivot = NA_PIVOT( nact_application_get_pivot( application ));
- return( na_pivot_get_actions( pivot ));
+ static const gchar *thisfn = "nact_main_window_on_delete_event";
+ g_debug( "%s: window=%p, toplevel=%p, event=%p", thisfn, window, toplevel, event );
+
+ g_assert( NACT_IS_MAIN_WINDOW( window ));
+
+ on_close( NULL, window );
+
+ return( TRUE );
}
+/*
+ * called by NAPivot because this window implements the IIOContainer
+ * interface, i.e. it wish to be advertised when the list of actions
+ * changes in the underlying I/O storage subsystem (typically, when we
+ * save the modifications)
+ */
static void
on_actions_changed( NAIPivotContainer *instance, gpointer user_data )
{
@@ -641,24 +956,6 @@ on_actions_changed( NAIPivotContainer *instance, gpointer user_data )
nact_iactions_list_fill( NACT_WINDOW( instance ));
}
- nact_iactions_list_set_selection(
- NACT_WINDOW( self ), self->private->current_uuid, self->private->current_label );
-}
-
-static void
-do_set_current_action( NactWindow *wnd, const NAAction *action )
-{
- NactMainWindow *window = NACT_MAIN_WINDOW( wnd );
-
- g_free( window->private->current_uuid );
- window->private->current_uuid = NULL;
-
- g_free( window->private->current_label );
- window->private->current_label = NULL;
-
- if( action ){
- g_assert( NA_IS_ACTION( action ));
- window->private->current_uuid = na_action_get_uuid( action );
- window->private->current_label = na_action_get_label( action );
- }
+ /*nact_iactions_list_set_selection(
+ NACT_WINDOW( self ), self->private->current_uuid, self->private->current_label );*/
}
diff --git a/src/nact/nact-main-window.h b/src/nact/nact-main-window.h
index c78734e..1a8f8ae 100644
--- a/src/nact/nact-main-window.h
+++ b/src/nact/nact-main-window.h
@@ -34,8 +34,7 @@
/*
* NactMainWindow class definition.
*
- * This class is derived from NactWindow.
- * It encapsulates the "ActionsDialog" window.
+ * This class is derived from BaseWindow and manages the MainWindow.
*/
#include "nact-window.h"
diff --git a/src/nact/nautilus-actions-config.ui b/src/nact/nautilus-actions-config.ui
index f7c7728..0a0656a 100644
--- a/src/nact/nautilus-actions-config.ui
+++ b/src/nact/nautilus-actions-config.ui
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
+ <!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="MainWindow">
<child>
@@ -8,135 +8,11 @@
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkMenuBar" id="MenuBar">
+ <object class="GtkVBox" id="MenuBarVBox">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkMenuItem" id="menuitem1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_File</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu1">
- <property name="visible">True</property>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem1">
- <property name="label">gtk-new</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem2">
- <property name="label">gtk-open</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem3">
- <property name="label">gtk-save</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem4">
- <property name="label">gtk-save-as</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem5">
- <property name="label">gtk-quit</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="menuitem2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Edit</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu2">
- <property name="visible">True</property>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem6">
- <property name="label">gtk-cut</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem7">
- <property name="label">gtk-copy</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem8">
- <property name="label">gtk-paste</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem9">
- <property name="label">gtk-delete</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="menuitem3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_View</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="menuitem4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Help</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="menu3">
- <property name="visible">True</property>
- <child>
- <object class="GtkImageMenuItem" id="imagemenuitem10">
- <property name="label">gtk-about</property>
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- </object>
- </child>
- </object>
- </child>
- </object>
+ <placeholder/>
</child>
</object>
<packing>
@@ -159,14 +35,13 @@
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkHPaned" id="hpaned1">
+ <object class="GtkHPaned" id="MainPaned">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="border_width">3</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
@@ -175,11 +50,12 @@
<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="resize">False</property>
+ <property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
@@ -187,7 +63,6 @@
<object class="GtkNotebook" id="Notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="border_width">3</property>
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
@@ -940,7 +815,7 @@
</packing>
</child>
<child>
- <object class="GtkStatusbar" id="statusbar1">
+ <object class="GtkStatusbar" id="StatusBar">
<property name="visible">True</property>
<property name="spacing">2</property>
</object>
@@ -967,4 +842,142 @@
<property name="stock">gtk-help</property>
<property name="icon-size">4</property>
</object>
+ <object class="GtkAssistant" id="ImportAssistant">
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">Importing actions</property>
+ <property name="modal">True</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">This assistant will guide you through the process of importing actions.</property>
+ </object>
+ <packing>
+ <property name="page_type">intro</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFileChooserWidget" id="filechooserwidget1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="local_only">False</property>
+ <property name="preview_widget_active">False</property>
+ <property name="select_multiple">True</property>
+ <property name="use_preview_label">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="page_type">confirm</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="page_type">summary</property>
+ </packing>
+ </child>
+ </object>
+ <object class="GtkAssistant" id="ExportAssistant">
+ <property name="events">GDK_KEY_PRESS_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="border_width">12</property>
+ <property name="title" translatable="yes">Exporting actions</property>
+ <property name="modal">True</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">This assistant will guide you through the process of exporting actions.</property>
+ </object>
+ <packing>
+ <property name="page_type">intro</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow3">
+ <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="ActionsList">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS_MASK</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="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Please select one or more actions
+to be exported.
+
+You may use Ctrl and Shift keys
+to extend a selection.</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="title">Selection of the exported actions</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkFileChooserWidget" id="ExportFolderChooser">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="local_only">False</property>
+ <property name="preview_widget_active">False</property>
+ <property name="use_preview_label">False</property>
+ <property name="action">select-folder</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="title">Selection of the target folder</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="page_type">confirm</property>
+ <property name="title">Summary</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="page_type">summary</property>
+ <property name="title">Export is done</property>
+ </packing>
+ </child>
+ </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]