[nautilus-actions] Start with GtkBuilder migration
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus-actions] Start with GtkBuilder migration
- Date: Tue, 14 Jul 2009 18:47:09 +0000 (UTC)
commit a640af50fb9f514899e0106c00aceecb3e52913d
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Jun 26 16:53:07 2009 +0200
Start with GtkBuilder migration
ChangeLog | 43 +
configure.ac | 14 +-
src/common/na-action-profile.c | 2 +
src/common/na-action.c | 2 +
src/common/na-gconf.c | 4 +-
src/common/na-iio-provider.c | 21 +
src/common/na-object.c | 4 +-
src/common/na-pivot.c | 36 +-
src/common/na-pivot.h | 1 -
src/nact/Makefile.am | 8 +-
src/nact/base-application.c | 338 ++-
src/nact/base-application.h | 21 +-
src/nact/base-window.c | 317 ++--
src/nact/base-window.h | 31 +-
src/nact/nact-action-editor.c | 2 +-
src/nact/nact-action-profile.c | 327 +++
src/nact/nact-action-profile.h | 74 +
src/nact/nact-application.c | 69 +-
src/nact/nact-editor.c | 2 +-
src/nact/nact-iactions-list.c | 54 +-
src/nact/nact-iactions-list.h | 11 +-
src/nact/nact-import-export.c | 2 +-
.../{nact-wnd-actions.c => nact-main-window.c} | 366 ++--
.../{nact-wnd-actions.h => nact-main-window.h} | 36 +-
src/nact/nact-main.c | 2 +
src/nact/nact-profile-editor.c | 2 +-
src/nact/nact-window.c | 138 +-
src/nact/nact-window.h | 6 +-
src/nact/nact.c | 431 ---
src/nact/nact.h | 50 -
src/nact/nautilus-actions-config.glade | 2758 --------------------
src/nact/nautilus-actions-config.ui | 1038 ++++++++
src/plugin/nautilus-actions.c | 4 +-
33 files changed, 2234 insertions(+), 3980 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fa95337..1535f1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,46 @@
+2009-06-26 Pierre Wieser <pwieser trychlos org>
+
+ Migration to GtkBuilder.
+
+ * configure.ac:
+ Update Gtk+ dependancy to 2.12 to have gtk_builder functions.
+ Remove libglade dependancy.
+
+ * src/common/na-action-profile.c:
+ * src/common/na-action.c:
+ * src/common/na-gconf.c:
+ * src/common/na-object.c:
+ * src/common/na-pivot.c
+ (instance_dispose): g_free( self->private ).
+
+ * src/common/na-pivot.c
+ (na_pivot_get_label_sorted_actions): Removed function.
+
+ * src/common/na-iio-provider.c:
+ Actions list is now automatically sorted by label.
+
+ * src/nact/nact-wnd-actions.c:
+ * src/nact/nact-wnd-actions.h:
+ Renamed to nact-main-window.{c,h}.
+
+ * src/nact/nact-main-window.c:
+ * src/nact/nact-main-window.h:
+ * src/nact/nact-action-profile.c:
+ * src/nact/nact-action-profile.h: New files.
+
+ * src/nact/Makefile.am: Updated accordingly.
+
+ * src/nact/base-application.c:
+ * src/nact/base-application.h
+ (base_application_get_icon_name,
+ base_application_get_main_window, base_application_run):
+ New functions.
+
+ * src/nact/base-window.c:
+ * src/nact/base-window.h:
+ Remove libglade stuff.
+ Create the structure for derived windows/dialogs.
+
2009-06-20 Pierre Wieser <pwieser trychlos org>
* src/common/na-gconf.c:
diff --git a/configure.ac b/configure.ac
index f324b94..540ebc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,21 +96,16 @@ AM_GLIB_GNU_GETTEXT
AC_PATH_PROG([GCONFTOOL],[gconftool-2])
AM_GCONF_SOURCE_2
-# these are the version as distributed with CentOS 4.x
-# - Gnome 2.8
-# - glib 2.4.7
-# - autoconf 2.59
-# - automake 1.9
-# - intltool 0.31
-#
# note that requiring through pkg-config the version number of the
# nautilus-extension library actually returns the version number of
# nautilus itself (e.g. 2.24.2) instead of the library version info
# (1.1.0) ; for the usual final user, this is very analog to requiring
# a whole gnome version
+#
+# Gtk >= 2.12: GtkBuilder
+#
GLIB_REQUIRED=2.16.0
-GTK_REQUIRED=2.4.0
-GLADE_REQUIRED=2.4.0
+GTK_REQUIRED=2.12.0
GNOME_REQUIRED=2.7.0
NAUTILUS_EXTENSION=2.8.0
GCONF_REQUIRED=2.8.0
@@ -127,7 +122,6 @@ PKG_CHECK_MODULES([NAUTILUS_ACTIONS], \
gthread-2.0 >= ${GLIB_REQUIRED} \
gmodule-2.0 >= ${GLIB_REQUIRED} \
gtk+-2.0 >= ${GTK_REQUIRED} \
- libglade-2.0 >= ${GLADE_REQUIRED} \
libgnome-2.0 >= ${GNOME_REQUIRED} \
libgnomeui-2.0 >= ${GNOME_REQUIRED} \
gconf-2.0 >= ${GCONF_REQUIRED} \
diff --git a/src/common/na-action-profile.c b/src/common/na-action-profile.c
index e207744..7bf0992 100644
--- a/src/common/na-action-profile.c
+++ b/src/common/na-action-profile.c
@@ -442,6 +442,8 @@ instance_finalize( GObject *object )
na_utils_free_string_list( self->private->mimetypes );
na_utils_free_string_list( self->private->schemes );
+ g_free( self->private );
+
/* chain call to parent class */
if((( GObjectClass * ) st_parent_class )->finalize ){
G_OBJECT_CLASS( st_parent_class )->finalize( object );
diff --git a/src/common/na-action.c b/src/common/na-action.c
index df97fa4..d5502e6 100644
--- a/src/common/na-action.c
+++ b/src/common/na-action.c
@@ -341,6 +341,8 @@ instance_finalize( GObject *object )
g_free( self->private->tooltip );
g_free( self->private->icon );
+ g_free( self->private );
+
/* chain call to parent class */
if((( GObjectClass * ) st_parent_class )->finalize ){
G_OBJECT_CLASS( st_parent_class )->finalize( object );
diff --git a/src/common/na-gconf.c b/src/common/na-gconf.c
index 53c3011..8c41116 100644
--- a/src/common/na-gconf.c
+++ b/src/common/na-gconf.c
@@ -267,7 +267,9 @@ static void
instance_finalize( GObject *object )
{
g_assert( NA_IS_GCONF( object ));
- /*NAGConf *self = NA_GCONF( object );*/
+ NAGConf *self = NA_GCONF( object );
+
+ g_free( self->private );
/* chain call to parent class */
if( st_parent_class->finalize ){
diff --git a/src/common/na-iio-provider.c b/src/common/na-iio-provider.c
index 05664a0..3533a6f 100644
--- a/src/common/na-iio-provider.c
+++ b/src/common/na-iio-provider.c
@@ -51,6 +51,8 @@ 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.
*/
@@ -165,6 +167,8 @@ 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 ));
@@ -230,3 +234,20 @@ 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/common/na-object.c b/src/common/na-object.c
index b2f9fae..ac6b8be 100644
--- a/src/common/na-object.c
+++ b/src/common/na-object.c
@@ -139,7 +139,9 @@ static void
instance_finalize( GObject *object )
{
g_assert( NA_IS_OBJECT( object ));
- /*NAObject *self = ( NAObject * ) object;*/
+ NAObject *self = ( NAObject * ) object;
+
+ g_free( self->private );
/* chain call to parent class */
if( st_parent_class->finalize ){
diff --git a/src/common/na-pivot.c b/src/common/na-pivot.c
index bac8065..e042be3 100644
--- a/src/common/na-pivot.c
+++ b/src/common/na-pivot.c
@@ -99,7 +99,6 @@ static void instance_set_property( GObject *object, guint property_id, const
static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
-static gint sort_actions_by_label( gconstpointer a1, gconstpointer a2 );
static void action_changed_handler( NAPivot *pivot, gpointer user_data );
static gboolean on_action_changed_timeout( gpointer user_data );
static gulong time_val_diff( const GTimeVal *recent, const GTimeVal *old );
@@ -275,6 +274,8 @@ instance_finalize( GObject *object )
g_slist_free( self->private->providers );
self->private->providers = NULL;
+ g_free( self->private );
+
/* chain call to parent class */
if((( GObjectClass * ) st_parent_class )->finalize ){
G_OBJECT_CLASS( st_parent_class )->finalize( object );
@@ -327,22 +328,6 @@ na_pivot_get_providers( const NAPivot *pivot, GType type )
}
/**
- * Return the list of actions, sorted by label.
- *
- * @pivot: this NAPivot object.
- *
- * The returned list is owned by this NAPivot object, and should not
- * be freed, nor unref by the caller.
- */
-GSList *
-na_pivot_get_label_sorted_actions( const NAPivot *pivot )
-{
- g_assert( NA_IS_PIVOT( pivot ));
- GSList *sorted = g_slist_sort( pivot->private->actions, ( GCompareFunc ) sort_actions_by_label );
- return( sorted );
-}
-
-/**
* Return the list of actions.
*
* @pivot: this NAPivot object.
@@ -372,23 +357,6 @@ na_pivot_free_actions( GSList *actions )
g_slist_free( actions );
}
-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 );
-}
-
/**
* Return the specified action.
*
diff --git a/src/common/na-pivot.h b/src/common/na-pivot.h
index fc51e80..7a5a451 100644
--- a/src/common/na-pivot.h
+++ b/src/common/na-pivot.h
@@ -73,7 +73,6 @@ NAPivot *na_pivot_new( const GObject *notified );
GSList *na_pivot_get_providers( const NAPivot *pivot, GType type );
-GSList *na_pivot_get_label_sorted_actions( const NAPivot *pivot );
GSList *na_pivot_get_actions( const NAPivot *pivot );
void na_pivot_free_actions( GSList *actions );
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index 328402e..22e4b02 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -44,11 +44,15 @@ nautilus_actions_config_SOURCES = \
base-application.h \
base-window.c \
base-window.h \
+ nact-action-profile.c \
+ nact-action-profile.h \
nact-application.c \
nact-application.h \
nact-iactions-list.c \
nact-iactions-list.h \
nact-main.c \
+ nact-main-window.c \
+ nact-main-window.h \
nact-utils.c \
nact-utils.h \
nact-prefs.c \
@@ -63,8 +67,6 @@ nautilus_actions_config_SOURCES = \
nact-action-editor.h \
nact-window.c \
nact-window.h \
- nact-wnd-actions.c \
- nact-wnd-actions.h \
$(NULL)
nautilus_actions_config_LDADD = \
@@ -72,7 +74,7 @@ nautilus_actions_config_LDADD = \
$(NAUTILUS_ACTIONS_LIBS) \
$(NULL)
-glade_DATA = nautilus-actions-config.glade
+glade_DATA = nautilus-actions-config.ui
@INTLTOOL_DESKTOP_RULE@
diff --git a/src/nact/base-application.c b/src/nact/base-application.c
index 9efe110..9405ac6 100644
--- a/src/nact/base-application.c
+++ b/src/nact/base-application.c
@@ -54,7 +54,10 @@ struct BaseApplicationPrivate {
UniqueApp *unique_app;
gchar *application_name;
gchar *icon_name;
- BaseWindow *main_window;
+ int code;
+ GtkBuilder *ui_xml;
+ gchar *ui_fname;
+ GObject *main_window;
};
/* instance properties
@@ -64,9 +67,12 @@ enum {
PROP_APPLICATION_ARGV,
PROP_APPLICATION_UNIQUE_NAME,
PROP_APPLICATION_UNIQUE_APP,
- PROP_APPLICATION_MAIN_WINDOW,
PROP_APPLICATION_NAME,
- PROP_APPLICATION_ICON_NAME
+ PROP_APPLICATION_ICON_NAME,
+ PROP_APPLICATION_CODE,
+ PROP_APPLICATION_UI_XML,
+ PROP_APPLICATION_UI_FILENAME,
+ PROP_APPLICATION_MAIN_WINDOW
};
static GObjectClass *st_parent_class = NULL;
@@ -87,15 +93,16 @@ static void v_initialize_gtk( BaseApplication *application );
static void v_initialize_application_name( BaseApplication *application );
static void v_initialize_icon_name( BaseApplication *application );
static void v_initialize_unique( BaseApplication *application );
+static void v_initialize_ui( BaseApplication *application );
static gboolean v_is_willing_to_run( BaseApplication *application );
static void v_advertise_willing_to_run( BaseApplication *application );
static void v_advertise_not_willing_to_run( BaseApplication *application );
static void v_start( BaseApplication *application );
-static int v_finish( 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 gchar *v_get_icon_name( BaseApplication *application );
static GObject *v_get_main_window( BaseApplication *application );
+static gchar *v_get_ui_filename( BaseApplication *application );
static void do_initialize( BaseApplication *application );
static void do_initialize_i18n( BaseApplication *application );
@@ -103,16 +110,16 @@ static void do_initialize_gtk( BaseApplication *application );
static void do_initialize_application_name( BaseApplication *application );
static void do_initialize_icon_name( BaseApplication *application );
static void do_initialize_unique( BaseApplication *application );
+static void do_initialize_ui( BaseApplication *application );
static gboolean is_willing_to_run( BaseApplication *application );
static gboolean check_for_unique_app( BaseApplication *application );
static void do_advertise_willing_to_run( BaseApplication *application );
static void do_advertise_not_willing_to_run( BaseApplication *application );
static void do_start( BaseApplication *application );
-static int do_finish( BaseApplication *application );
+static void do_finish( BaseApplication *application );
static gchar *do_get_unique_name( BaseApplication *application );
static gchar *do_get_application_name( BaseApplication *application );
static gchar *do_get_icon_name( BaseApplication *application );
-static GObject *do_get_main_window( BaseApplication *application );
/*static UniqueResponse on_unique_message_received( UniqueApp *app, UniqueCommand command, UniqueMessageData *message, guint time, gpointer user_data );*/
@@ -194,13 +201,6 @@ class_init( BaseApplicationClass *klass )
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
g_object_class_install_property( object_class, PROP_APPLICATION_UNIQUE_APP, spec );
- spec = g_param_spec_pointer(
- PROP_APPLICATION_MAIN_WINDOW_STR,
- PROP_APPLICATION_MAIN_WINDOW_STR,
- "The BaseWindow object which encapsulates the main GtkWindow",
- G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
- g_object_class_install_property( object_class, PROP_APPLICATION_MAIN_WINDOW, spec );
-
spec = g_param_spec_string(
PROP_APPLICATION_NAME_STR,
PROP_APPLICATION_NAME_STR,
@@ -215,6 +215,34 @@ class_init( BaseApplicationClass *klass )
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
g_object_class_install_property( object_class, PROP_APPLICATION_ICON_NAME, spec );
+ spec = g_param_spec_int(
+ PROP_APPLICATION_CODE_STR,
+ PROP_APPLICATION_CODE_STR,
+ "Exit code of the application", 0, 65535, 0,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, PROP_APPLICATION_CODE, spec );
+
+ spec = g_param_spec_pointer(
+ PROP_APPLICATION_UI_XML_STR,
+ PROP_APPLICATION_UI_XML_STR,
+ "UI definition XML object pointer",
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, PROP_APPLICATION_UI_XML, spec );
+
+ spec = g_param_spec_string(
+ PROP_APPLICATION_UI_FILENAME_STR,
+ PROP_APPLICATION_UI_FILENAME_STR,
+ "UI definition XML filename", "",
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, PROP_APPLICATION_UI_FILENAME, spec );
+
+ spec = g_param_spec_pointer(
+ PROP_APPLICATION_MAIN_WINDOW_STR,
+ PROP_APPLICATION_MAIN_WINDOW_STR,
+ "Main BaseWindow object",
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
+ g_object_class_install_property( object_class, PROP_APPLICATION_MAIN_WINDOW, spec );
+
klass->private = g_new0( BaseApplicationClassPrivate, 1 );
klass->run = do_run;
@@ -224,6 +252,7 @@ class_init( BaseApplicationClass *klass )
klass->initialize_application_name = do_initialize_application_name;
klass->initialize_icon_name = do_initialize_icon_name;
klass->initialize_unique = do_initialize_unique;
+ klass->initialize_ui = do_initialize_ui;
klass->is_willing_to_run = is_willing_to_run;
klass->advertise_willing_to_run = do_advertise_willing_to_run;
klass->advertise_not_willing_to_run = do_advertise_not_willing_to_run;
@@ -232,7 +261,8 @@ class_init( BaseApplicationClass *klass )
klass->get_unique_name = do_get_unique_name;
klass->get_application_name = do_get_application_name;
klass->get_icon_name = do_get_icon_name;
- klass->get_main_window = do_get_main_window;
+ klass->get_ui_filename = NULL;
+ klass->get_main_window = NULL;
}
static void
@@ -247,6 +277,7 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private = g_new0( BaseApplicationPrivate, 1 );
self->private->dispose_has_run = FALSE;
+ self->private->code = 0;
}
static void
@@ -272,10 +303,6 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
g_value_set_pointer( value, self->private->unique_app );
break;
- case PROP_APPLICATION_MAIN_WINDOW:
- g_value_set_pointer( value, self->private->main_window );
- break;
-
case PROP_APPLICATION_NAME:
g_value_set_string( value, self->private->application_name );
break;
@@ -284,6 +311,22 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
g_value_set_string( value, self->private->icon_name );
break;
+ case PROP_APPLICATION_CODE:
+ g_value_set_int( value, self->private->code );
+ break;
+
+ case PROP_APPLICATION_UI_XML:
+ g_value_set_pointer( value, self->private->ui_xml );
+ break;
+
+ case PROP_APPLICATION_UI_FILENAME:
+ g_value_set_string( value, self->private->ui_fname );
+ break;
+
+ case PROP_APPLICATION_MAIN_WINDOW:
+ g_value_set_pointer( value, self->private->main_window );
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
break;
@@ -314,10 +357,6 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
self->private->unique_app = g_value_get_pointer( value );
break;
- case PROP_APPLICATION_MAIN_WINDOW:
- self->private->main_window = g_value_get_pointer( value );
- break;
-
case PROP_APPLICATION_NAME:
g_free( self->private->application_name );
self->private->application_name = g_value_dup_string( value );
@@ -328,6 +367,23 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
self->private->icon_name = g_value_dup_string( value );
break;
+ case PROP_APPLICATION_CODE:
+ self->private->code = g_value_get_int( value );
+ break;
+
+ case PROP_APPLICATION_UI_XML:
+ self->private->ui_xml = g_value_get_pointer( value );
+ break;
+
+ case PROP_APPLICATION_UI_FILENAME:
+ g_free( self->private->ui_fname );
+ self->private->ui_fname = g_value_dup_string( value );
+ break;
+
+ case PROP_APPLICATION_MAIN_WINDOW:
+ self->private->main_window = g_value_get_pointer( value );
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
break;
@@ -350,9 +406,8 @@ instance_dispose( GObject *application )
if( UNIQUE_IS_APP( self->private->unique_app )){
g_object_unref( self->private->unique_app );
}
- if( GTK_IS_WINDOW( self->private->main_window )){
- g_object_unref( self->private->main_window );
- }
+
+ g_object_unref( self->private->ui_xml );
/* chain up to the parent class */
G_OBJECT_CLASS( st_parent_class )->dispose( application );
@@ -371,6 +426,9 @@ instance_finalize( GObject *application )
g_free( self->private->unique_name );
g_free( self->private->application_name );
g_free( self->private->icon_name );
+ g_free( self->private->ui_fname );
+
+ g_free( self->private );
/* chain call to parent class */
if( st_parent_class->finalize ){
@@ -379,34 +437,6 @@ instance_finalize( GObject *application )
}
/**
- * Returns a newly allocated BaseApplication object.
- */
-BaseApplication *
-base_application_new( void )
-{
- return( g_object_new( BASE_APPLICATION_TYPE, NULL ));
-}
-
-/**
- * Returns a newly allocated BaseApplication object.
- *
- * @argc: count of command-line arguments.
- *
- * @argv: command-line arguments.
- */
-BaseApplication *
-base_application_new_with_args( int argc, char **argv )
-{
- return(
- g_object_new(
- BASE_APPLICATION_TYPE,
- PROP_APPLICATION_ARGC_STR, argc,
- PROP_APPLICATION_ARGV_STR, argv,
- NULL )
- );
-}
-
-/**
* Executes the application.
*
* @application: the considered BaseApplication object.
@@ -431,6 +461,59 @@ base_application_run( BaseApplication *application )
return( BASE_APPLICATION_GET_CLASS( application )->run( application ));
}
+gchar *
+base_application_get_icon_name( BaseApplication *application )
+{
+ static const gchar *thisfn = "base_application_get_icon_name";
+ g_debug( "%s: icon=%p", thisfn, application );
+
+ g_assert( BASE_IS_APPLICATION( application ));
+
+ gchar *name;
+ g_object_get( G_OBJECT( application ), PROP_APPLICATION_ICON_NAME_STR, &name, NULL );
+
+ if( !name || !strlen( name )){
+ name = BASE_APPLICATION_GET_CLASS( application )->get_icon_name( application );
+ if( name && strlen( name )){
+ g_object_set( G_OBJECT( application ), PROP_APPLICATION_ICON_NAME_STR, name, NULL );
+ }
+ }
+
+ return( name );
+}
+
+GObject *
+base_application_get_main_window( BaseApplication *application )
+{
+ static const gchar *thisfn = "base_application_get_main_window";
+ g_debug( "%s: icon=%p", thisfn, application );
+
+ g_assert( BASE_IS_APPLICATION( application ));
+
+ return( v_get_main_window( application ));
+}
+
+GtkWidget *
+base_application_get_widget( BaseApplication *application, const gchar *name )
+{
+ /*static const gchar *thisfn = "base_application_get_widget";
+ g_debug( "%s: application=%p, name=%s", thisfn, application, name );*/
+
+ GtkWidget *widget = GTK_WIDGET( gtk_builder_get_object( application->private->ui_xml, name ));
+
+ if( !widget ){
+ gchar *msg = g_strdup_printf(
+ _( "Unable to load %s widget from %s glade file." ), name, application->private->ui_fname );
+ base_application_error_dlg( application, GTK_MESSAGE_ERROR, msg, NULL );
+ g_free( msg );
+ g_object_set( G_OBJECT( application ), PROP_APPLICATION_CODE_STR, 1, NULL );
+
+ } else {
+ g_assert( GTK_IS_WIDGET( widget ));
+ }
+ return( widget );
+}
+
static int
do_run( BaseApplication *application )
{
@@ -439,22 +522,22 @@ do_run( BaseApplication *application )
g_assert( BASE_IS_APPLICATION( application ));
- int code = 0;
-
v_initialize( application );
+ if( application->private->code == 0 ){
- if( v_is_willing_to_run( application )){
+ if( v_is_willing_to_run( application )){
- v_advertise_willing_to_run( application );
- v_start( application );
- code = v_finish( application );
+ v_advertise_willing_to_run( application );
+ v_start( application );
+ v_finish( application );
- } else {
+ } else {
- v_advertise_not_willing_to_run( application );
+ v_advertise_not_willing_to_run( application );
+ }
}
- return( code );
+ return( application->private->code );
}
static void
@@ -523,6 +606,17 @@ v_initialize_unique( BaseApplication *application )
BASE_APPLICATION_GET_CLASS( application )->initialize_unique( application );
}
+static void
+v_initialize_ui( BaseApplication *application )
+{
+ static const gchar *thisfn = "base_application_v_initialize_ui";
+ g_debug( "%s: application=%p", thisfn, application );
+
+ g_assert( BASE_IS_APPLICATION( application ));
+
+ BASE_APPLICATION_GET_CLASS( application )->initialize_ui( application );
+}
+
static gboolean
v_is_willing_to_run( BaseApplication *application )
{
@@ -564,10 +658,12 @@ v_start( BaseApplication *application )
g_assert( BASE_IS_APPLICATION( application ));
- BASE_APPLICATION_GET_CLASS( application )->start( application );
+ if( BASE_APPLICATION_GET_CLASS( application )->start ){
+ BASE_APPLICATION_GET_CLASS( application )->start( application );
+ }
}
-static int
+static void
v_finish( BaseApplication *application )
{
static const gchar *thisfn = "base_application_v_finish";
@@ -575,7 +671,9 @@ v_finish( BaseApplication *application )
g_assert( BASE_IS_APPLICATION( application ));
- return( BASE_APPLICATION_GET_CLASS( application )->finish( application ));
+ if( BASE_APPLICATION_GET_CLASS( application )->finish ){
+ BASE_APPLICATION_GET_CLASS( application )->finish( application );
+ }
}
static gchar *
@@ -621,20 +719,20 @@ v_get_application_name( BaseApplication *application )
}
static gchar *
-v_get_icon_name( BaseApplication *application )
+v_get_ui_filename( BaseApplication *application )
{
- static const gchar *thisfn = "base_application_v_get_icon_name";
+ static const gchar *thisfn = "base_application_v_get_ui_filename";
g_debug( "%s: icon=%p", thisfn, application );
g_assert( BASE_IS_APPLICATION( application ));
gchar *name;
- g_object_get( G_OBJECT( application ), PROP_APPLICATION_ICON_NAME_STR, &name, NULL );
+ g_object_get( G_OBJECT( application ), PROP_APPLICATION_UI_FILENAME_STR, &name, NULL );
if( !name || !strlen( name )){
- name = BASE_APPLICATION_GET_CLASS( application )->get_icon_name( application );
+ name = BASE_APPLICATION_GET_CLASS( application )->get_ui_filename( application );
if( name && strlen( name )){
- g_object_set( G_OBJECT( application ), PROP_APPLICATION_ICON_NAME_STR, name, NULL );
+ g_object_set( G_OBJECT( application ), PROP_APPLICATION_UI_FILENAME_STR, name, NULL );
}
}
@@ -649,17 +747,49 @@ v_get_main_window( BaseApplication *application )
g_assert( BASE_IS_APPLICATION( application ));
- return( BASE_APPLICATION_GET_CLASS( application )->get_main_window( application ));
+ if( !application->private->main_window ){
+
+ g_assert( BASE_APPLICATION_GET_CLASS( application )->get_main_window );
+
+ GObject *main_window = BASE_APPLICATION_GET_CLASS( application )->get_main_window( application );
+ application->private->main_window = main_window;
+ }
+
+ return( application->private->main_window );
}
static void
do_initialize( BaseApplication *application )
{
v_initialize_i18n( application );
+ if( application->private->code ){
+ return;
+ }
+
v_initialize_gtk( application );
+ if( application->private->code ){
+ return;
+ }
+
v_initialize_application_name( application );
+ if( application->private->code ){
+ return;
+ }
+
v_initialize_icon_name( application );
+ if( application->private->code ){
+ return;
+ }
+
v_initialize_unique( application );
+ if( application->private->code ){
+ return;
+ }
+
+ v_initialize_ui( application );
+ if( application->private->code ){
+ return;
+ }
}
static void
@@ -680,7 +810,9 @@ do_initialize_gtk( BaseApplication *application )
int argc;
gpointer argv;
g_object_get( G_OBJECT( application ), PROP_APPLICATION_ARGC_STR, &argc, PROP_APPLICATION_ARGV_STR, &argv, NULL );
+
gtk_init( &argc, ( char *** ) &argv );
+
g_object_set( G_OBJECT( application ), PROP_APPLICATION_ARGC_STR, argc, PROP_APPLICATION_ARGV_STR, argv, NULL );
}
@@ -697,7 +829,7 @@ do_initialize_application_name( BaseApplication *application )
static void
do_initialize_icon_name( BaseApplication *application )
{
- gchar *name = v_get_icon_name( application );
+ gchar *name = base_application_get_icon_name( application );
if( name && strlen( name )){
gtk_window_set_default_icon_name( name );
}
@@ -716,6 +848,25 @@ do_initialize_unique( BaseApplication *application )
g_free( unique_name );
}
+static void
+do_initialize_ui( BaseApplication *application )
+{
+ GError *error = NULL;
+ gchar *ui_name = v_get_ui_filename( application );
+
+ application->private->ui_xml = gtk_builder_new();
+
+ gtk_builder_add_from_file( application->private->ui_xml, ui_name, &error );
+
+ if( error ){
+ base_application_error_dlg( application, GTK_MESSAGE_ERROR, error->message, NULL );
+ g_error_free( error );
+ g_object_set( G_OBJECT( application ), PROP_APPLICATION_CODE_STR, 1, NULL );
+ }
+
+ g_free( ui_name );
+}
+
static gboolean
is_willing_to_run( BaseApplication *application )
{
@@ -762,45 +913,48 @@ check_for_unique_app( BaseApplication *application )
static void
do_advertise_willing_to_run( BaseApplication *application )
{
-
+ static const gchar *thisfn = "base_application_do_advertise_willing_to_run";
+ g_debug( "%s: application=%p", thisfn, application );
}
static void
do_advertise_not_willing_to_run( BaseApplication *application )
{
-
+ static const gchar *thisfn = "base_application_do_advertise_not_willing_to_run";
+ g_debug( "%s: application=%p", thisfn, application );
}
-/*
- * this should be typically called by the derived class after it has
- * created the main window
- */
static void
do_start( BaseApplication *application )
{
+ static const gchar *thisfn = "base_application_do_start";
+ g_debug( "%s: application=%p", thisfn, application );
+
BaseWindow *window = BASE_WINDOW( v_get_main_window( application ));
+ g_assert( window );
+ g_assert( BASE_IS_WINDOW( window ));
- if( window ){
- g_assert( BASE_IS_WINDOW( window ));
+ base_window_init( window );
- application->private->main_window = window;
+ if( !application->private->code ){
- base_window_init_window( window );
+ GtkWindow *wnd = base_window_get_toplevel_widget( window );
+ g_assert( wnd );
+ g_assert( GTK_IS_WINDOW( wnd ));
- GtkWindow *wnd = base_window_get_toplevel_window( window );
if( application->private->unique_app ){
unique_app_watch_window( application->private->unique_app, wnd );
}
- gtk_main();
+ base_window_run( window );
}
}
-static int
+static void
do_finish( BaseApplication *application )
{
- int code = 0;
- return( code );
+ static const gchar *thisfn = "base_application_do_finish";
+ g_debug( "%s: application=%p", thisfn, application );
}
static gchar *
@@ -812,7 +966,7 @@ do_get_unique_name( BaseApplication *application )
static gchar *
do_get_application_name( BaseApplication *application )
{
- return( NULL );
+ return( _( "Default application name" ));
}
static gchar *
@@ -821,12 +975,6 @@ do_get_icon_name( BaseApplication *application )
return( NULL );
}
-static GObject *
-do_get_main_window( BaseApplication *application )
-{
- return( NULL );
-}
-
/*static UniqueResponse
on_unique_message_received(
UniqueApp *app, UniqueCommand command, UniqueMessageData *message, guint time, gpointer user_data )
diff --git a/src/nact/base-application.h b/src/nact/base-application.h
index 53df70b..b7cf0d0 100644
--- a/src/nact/base-application.h
+++ b/src/nact/base-application.h
@@ -71,14 +71,16 @@ typedef struct {
void ( *initialize_application_name ) ( BaseApplication *appli );
void ( *initialize_icon_name ) ( BaseApplication *appli );
void ( *initialize_unique ) ( BaseApplication *appli );
+ void ( *initialize_ui ) ( BaseApplication *appli );
gboolean ( *is_willing_to_run ) ( BaseApplication *appli );
void ( *advertise_willing_to_run ) ( BaseApplication *appli );
void ( *advertise_not_willing_to_run )( BaseApplication *appli );
void ( *start ) ( BaseApplication *appli );
- int ( *finish ) ( BaseApplication *appli );
+ void ( *finish ) ( BaseApplication *appli );
gchar * ( *get_unique_name ) ( BaseApplication *appli );
gchar * ( *get_application_name ) ( BaseApplication *appli );
gchar * ( *get_icon_name ) ( BaseApplication *appli );
+ gchar * ( *get_ui_filename ) ( BaseApplication *appli );
GObject * ( *get_main_window ) ( BaseApplication *appli );
}
BaseApplicationClass;
@@ -89,18 +91,23 @@ typedef struct {
#define PROP_APPLICATION_ARGV_STR "argv"
#define PROP_APPLICATION_UNIQUE_NAME_STR "unique-name"
#define PROP_APPLICATION_UNIQUE_APP_STR "unique-app"
-#define PROP_APPLICATION_MAIN_WINDOW_STR "main-window"
#define PROP_APPLICATION_NAME_STR "application-name"
#define PROP_APPLICATION_ICON_NAME_STR "icon-name"
+#define PROP_APPLICATION_CODE_STR "code"
+#define PROP_APPLICATION_UI_XML_STR "ui-xml"
+#define PROP_APPLICATION_UI_FILENAME_STR "ui-filename"
+#define PROP_APPLICATION_MAIN_WINDOW_STR "main-window"
+
+GType base_application_get_type( void );
-GType base_application_get_type( void );
+int base_application_run( BaseApplication *application );
-BaseApplication *base_application_new( void );
-BaseApplication *base_application_new_with_args( int argc, char **argv );
+gchar *base_application_get_icon_name( BaseApplication *application );
+GObject *base_application_get_main_window( BaseApplication *application );
-int base_application_run( BaseApplication *application );
+GtkWidget *base_application_get_widget( BaseApplication *application, const gchar *name );
-void base_application_error_dlg( BaseApplication *application, GtkMessageType type, const gchar *primary, const gchar *secondary );
+void base_application_error_dlg( BaseApplication *application, GtkMessageType type, const gchar *primary, const gchar *secondary );
G_END_DECLS
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 0a1b7a4..3c59d9d 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -34,7 +34,6 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <glade/glade-xml.h>
#include <stdlib.h>
#include <string.h>
@@ -52,8 +51,8 @@ struct BaseWindowPrivate {
gboolean dispose_has_run;
BaseApplication *application;
gchar *toplevel_name;
- GtkWindow *toplevel_window;
- gchar *glade_fname;
+ GtkWindow *toplevel_widget;
+ gboolean initialized;
};
/* instance properties
@@ -61,8 +60,8 @@ struct BaseWindowPrivate {
enum {
PROP_WINDOW_APPLICATION = 1,
PROP_WINDOW_TOPLEVEL_NAME,
- PROP_WINDOW_TOPLEVEL_WINDOW,
- PROP_WINDOW_GLADE_FILENAME
+ PROP_WINDOW_TOPLEVEL_WIDGET,
+ PROP_WINDOW_INITIALIZED
};
static GObjectClass *st_parent_class = NULL;
@@ -75,17 +74,20 @@ static void instance_set_property( GObject *object, guint property_id, co
static void instance_dispose( GObject *application );
static void instance_finalize( GObject *application );
-static gchar *v_get_glade_file( BaseWindow *window );
static void do_init_window( BaseWindow *window );
-static GtkWidget *do_load_widget( BaseWindow *window, const gchar *name );
-static gchar *do_get_toplevel_name( BaseWindow *window );
-static GtkWindow *do_get_toplevel_window( BaseWindow *window );
-static gchar *do_get_glade_file( BaseWindow *window );
+static void do_run_window( BaseWindow *window );
+
+static gchar *v_get_toplevel_name( BaseWindow *window );
+static void v_init_widget( BaseWindow *window );
+static void v_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
+
+static void do_init_widget( BaseWindow *window );
+static void do_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
+static GObject *do_get_application( BaseWindow *window );
+static GtkWindow *do_get_toplevel_widget( BaseWindow *window );
static GtkWidget *do_get_widget( BaseWindow *window, const gchar *name );
-static GHashTable *get_glade_hashtable( void );
-static GladeXML *get_glade_xml_object( const gchar *glade_fname, const gchar *widget_name );
-static void destroy_glade_objects( void );
+static gboolean is_main_window( BaseWindow *window );
GType
base_window_get_type( void )
@@ -105,8 +107,6 @@ register_type( void )
static const gchar *thisfn = "base_window_register_type";
g_debug( "%s", thisfn );
- g_type_init();
-
static GTypeInfo info = {
sizeof( BaseWindowClass ),
( GBaseInitFunc ) NULL,
@@ -152,26 +152,28 @@ class_init( BaseWindowClass *klass )
g_object_class_install_property( object_class, PROP_WINDOW_TOPLEVEL_NAME, spec );
spec = g_param_spec_pointer(
- PROP_WINDOW_TOPLEVEL_WINDOW_STR,
- PROP_WINDOW_TOPLEVEL_WINDOW_STR,
+ PROP_WINDOW_TOPLEVEL_WIDGET_STR,
+ PROP_WINDOW_TOPLEVEL_WIDGET_STR,
"The main GtkWindow attached to this object",
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
- g_object_class_install_property( object_class, PROP_WINDOW_TOPLEVEL_WINDOW, spec );
+ g_object_class_install_property( object_class, PROP_WINDOW_TOPLEVEL_WIDGET, spec );
- spec = g_param_spec_string(
- PROP_WINDOW_GLADE_FILENAME_STR,
- PROP_WINDOW_GLADE_FILENAME_STR,
- "Glade full pathname", "",
+ spec = g_param_spec_boolean(
+ PROP_WINDOW_INITIALIZED_STR,
+ PROP_WINDOW_INITIALIZED_STR,
+ "Has base_window_init be ran", FALSE,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE );
- g_object_class_install_property( object_class, PROP_WINDOW_GLADE_FILENAME, spec );
+ g_object_class_install_property( object_class, PROP_WINDOW_INITIALIZED, spec );
klass->private = g_new0( BaseWindowClassPrivate, 1 );
- klass->init_window = do_init_window;
- klass->load_widget = do_load_widget;
- klass->get_toplevel_name = do_get_toplevel_name;
- klass->get_toplevel_window = do_get_toplevel_window;
- klass->get_glade_file = do_get_glade_file;
+ klass->init = do_init_window;
+ klass->run = do_run_window;
+ klass->on_init_widget = do_init_widget;
+ klass->on_dialog_response = do_dialog_response;
+ klass->get_application = do_get_application;
+ klass->get_toplevel_name = NULL;
+ klass->get_toplevel_widget = do_get_toplevel_widget;
klass->get_widget = do_get_widget;
}
@@ -204,12 +206,12 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
g_value_set_string( value, self->private->toplevel_name );
break;
- case PROP_WINDOW_TOPLEVEL_WINDOW:
- g_value_set_pointer( value, self->private->toplevel_window );
+ case PROP_WINDOW_TOPLEVEL_WIDGET:
+ g_value_set_pointer( value, self->private->toplevel_widget );
break;
- case PROP_WINDOW_GLADE_FILENAME:
- g_value_set_string( value, self->private->glade_fname );
+ case PROP_WINDOW_INITIALIZED:
+ g_value_set_boolean( value, self->private->initialized );
break;
default:
@@ -234,13 +236,12 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
self->private->toplevel_name = g_value_dup_string( value );
break;
- case PROP_WINDOW_TOPLEVEL_WINDOW:
- self->private->toplevel_window = g_value_get_pointer( value );
+ case PROP_WINDOW_TOPLEVEL_WIDGET:
+ self->private->toplevel_widget = g_value_get_pointer( value );
break;
- case PROP_WINDOW_GLADE_FILENAME:
- g_free( self->private->glade_fname );
- self->private->glade_fname = g_value_dup_string( value );
+ case PROP_WINDOW_INITIALIZED:
+ self->private->initialized = g_value_get_boolean( value );
break;
default:
@@ -262,9 +263,15 @@ instance_dispose( GObject *window )
self->private->dispose_has_run = TRUE;
- gtk_widget_destroy( GTK_WIDGET( self->private->toplevel_window ));
- destroy_glade_objects();
- gtk_main_quit ();
+ g_debug( "%s: gtk_main_level=%d", thisfn, gtk_main_level());
+ if( is_main_window( BASE_WINDOW( window ))){
+ gtk_main_quit ();
+ gtk_widget_destroy( GTK_WIDGET( self->private->toplevel_widget ));
+
+ } else {
+ gtk_widget_hide_all( GTK_WIDGET( self->private->toplevel_widget ));
+ }
+
/* chain up to the parent class */
G_OBJECT_CLASS( st_parent_class )->dispose( window );
@@ -281,7 +288,8 @@ instance_finalize( GObject *window )
BaseWindow *self = ( BaseWindow * ) window;
g_free( self->private->toplevel_name );
- g_free( self->private->glade_fname );
+
+ g_free( self->private );
/* chain call to parent class */
if( st_parent_class->finalize ){
@@ -290,64 +298,59 @@ instance_finalize( GObject *window )
}
/**
- * Returns a newly allocated BaseWindow object.
- */
-BaseWindow *
-base_window_new( void )
-{
- return( g_object_new( BASE_WINDOW_TYPE, NULL ));
-}
-
-/**
* Initializes the window.
*
* @window: this BaseWindow object.
+ *
+ * This is a one-time initialization just after the BaseWindow has been
+ * allocated. For an every-time initialization, see base_window_run.
*/
void
-base_window_init_window( BaseWindow *window )
+base_window_init( BaseWindow *window )
{
g_assert( BASE_IS_WINDOW( window ));
- BASE_WINDOW_GET_CLASS( window )->init_window( window );
+
+ if( BASE_WINDOW_GET_CLASS( window )->init ){
+ BASE_WINDOW_GET_CLASS( window )->init( window );
+ }
}
/**
- * Loads the required widget from a glade file.
- * Uses preferences for sizing and positionning the window.
+ * Run the window.
*
* @window: this BaseWindow object.
- *
- * @name: name of the widget
*/
-GtkWidget *
-base_window_load_widget( BaseWindow *window, const gchar *name )
+void
+base_window_run( BaseWindow *window )
{
g_assert( BASE_IS_WINDOW( window ));
- return( BASE_WINDOW_GET_CLASS( window )->load_widget( window, name ));
+ if( BASE_WINDOW_GET_CLASS( window )->run ){
+ BASE_WINDOW_GET_CLASS( window )->run( window );
+ }
}
/**
- * Returns the internal name of the GtkWindow attached to this
- * BaseWindow object.
+ * Returns a pointer on the BaseApplication object.
*
* @window: this BaseWindow object.
*/
-gchar *
-base_window_get_toplevel_name( BaseWindow *window )
+GObject *
+base_window_get_application( BaseWindow *window )
{
g_assert( BASE_IS_WINDOW( window ));
- return( BASE_WINDOW_GET_CLASS( window )->get_toplevel_name( window ));
+ return( BASE_WINDOW_GET_CLASS( window )->get_application( window ));
}
/**
- * Returns the GtkWindow attached to this BaseWindow object.
+ * Returns the top-level GtkWindow attached to this BaseWindow object.
*
* @window: this BaseWindow object.
*/
GtkWindow *
-base_window_get_toplevel_window( BaseWindow *window )
+base_window_get_toplevel_widget( BaseWindow *window )
{
g_assert( BASE_IS_WINDOW( window ));
- return( BASE_WINDOW_GET_CLASS( window )->get_toplevel_window( window ));
+ return( BASE_WINDOW_GET_CLASS( window )->get_toplevel_widget( window ));
}
/**
@@ -364,29 +367,18 @@ base_window_get_widget( BaseWindow *window, const gchar *name )
return( BASE_WINDOW_GET_CLASS( window )->get_widget( window, name ));
}
-/**
- * Connects a signal to a handler, assuring that the BaseWindow pointer
- * is passed as user data.
- */
-void
-base_window_connect( BaseWindow *window, const gchar *widget, const gchar *signal, GCallback handler )
-{
- GtkWidget *target = base_window_get_widget( window, widget );
- g_signal_connect( G_OBJECT( target ), signal, handler, window );
-}
-
static gchar *
-v_get_glade_file( BaseWindow *window )
+v_get_toplevel_name( BaseWindow *window )
{
g_assert( BASE_IS_WINDOW( window ));
gchar *name;
- g_object_get( G_OBJECT( window ), PROP_WINDOW_GLADE_FILENAME_STR, &name, NULL );
+ g_object_get( G_OBJECT( window ), PROP_WINDOW_TOPLEVEL_NAME_STR, &name, NULL );
if( !name || !strlen( name )){
- name = BASE_WINDOW_GET_CLASS( window )->get_glade_file( window );
+ name = BASE_WINDOW_GET_CLASS( window )->get_toplevel_name( window );
if( name && strlen( name )){
- g_object_set( G_OBJECT( window ), PROP_WINDOW_GLADE_FILENAME_STR, name, NULL );
+ g_object_set( G_OBJECT( window ), PROP_WINDOW_TOPLEVEL_NAME_STR, name, NULL );
}
}
@@ -394,106 +386,131 @@ v_get_glade_file( BaseWindow *window )
}
static void
-do_init_window( BaseWindow *window )
+v_init_widget( BaseWindow *window )
{
- /* do nothing */
+ g_assert( BASE_IS_WINDOW( window ));
+
+ if( window->private->toplevel_widget ){
+ if( BASE_WINDOW_GET_CLASS( window )->on_init_widget ){
+ BASE_WINDOW_GET_CLASS( window )->on_init_widget( window );
+ }
+ }
}
-static GtkWidget *
-do_load_widget( BaseWindow *window, const gchar *name )
+static void
+v_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window )
{
- GtkWidget *widget = NULL;
-
- gchar *glade_file = v_get_glade_file( window );
+ g_assert( BASE_IS_WINDOW( window ));
- if( glade_file && strlen( glade_file )){
- GladeXML *xml = get_glade_xml_object( glade_file, name );
- if( xml ){
- glade_xml_signal_autoconnect( xml );
- widget = glade_xml_get_widget( xml, name );
- g_object_unref( xml );
- }
+ if( BASE_WINDOW_GET_CLASS( window )->on_dialog_response ){
+ BASE_WINDOW_GET_CLASS( window )->on_dialog_response( dialog, code, window );
}
+}
- if( widget ){
- g_object_set( G_OBJECT( window ),
- PROP_WINDOW_TOPLEVEL_NAME_STR, name,
- PROP_WINDOW_TOPLEVEL_WINDOW_STR, widget,
- NULL );
+static void
+do_init_window( BaseWindow *window )
+{
+ static const gchar *thisfn = "base_window_do_init_window";
+ g_debug( "%s: window=%p", thisfn, window );
- g_object_set_data( G_OBJECT( widget ), "base-window", window );
+ g_assert( BASE_IS_WINDOW( window ));
- } else {
- gchar *msg = g_strdup_printf( _( "Unable to load %s widget from %s glade file." ), name, glade_file );
- base_application_error_dlg( window->private->application, GTK_MESSAGE_ERROR, msg, NULL );
- g_free( msg );
- exit( 1 );
+ gchar *widget_name = v_get_toplevel_name( window );
+ g_assert( widget_name && strlen( widget_name ));
+
+ GtkWidget *toplevel = base_window_get_widget( window, widget_name );
+ window->private->toplevel_widget = GTK_WINDOW( toplevel );
+
+ if( toplevel ){
+ g_assert( GTK_IS_WINDOW( toplevel ));
+ v_init_widget( window );
+ gtk_widget_show_all( toplevel );
}
- g_free( glade_file );
- return( widget );
-}
+ g_free( widget_name );
-static gchar *
-do_get_toplevel_name( BaseWindow *window )
-{
- return( g_strdup( window->private->toplevel_name ));
+ window->private->initialized = TRUE;
}
-static GtkWindow *
-do_get_toplevel_window( BaseWindow *window )
+static void
+do_init_widget( BaseWindow *window )
{
- return( window->private->toplevel_window );
+ static const gchar *thisfn = "base_window_do_init_widget";
+ g_debug( "%s: window=%p", thisfn, window );
}
-static gchar *
-do_get_glade_file( BaseWindow *window )
+
+static void
+do_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window )
{
- return( NULL );
+ static const gchar *thisfn = "base_window_do_dialog_response";
+ g_debug( "%s: dialog=%p, code=%d, window=%p", thisfn, dialog, code, window );
}
-static GtkWidget *
-do_get_widget( BaseWindow *window, const gchar *name )
+/**
+ * Connects a signal to a handler, assuring that the BaseWindow pointer
+ * is passed as user data.
+ */
+void
+base_window_connect( BaseWindow *window, const gchar *widget, const gchar *signal, GCallback handler )
{
- gchar *glade_file = v_get_glade_file( window );
- gchar *parent_name = base_window_get_toplevel_name( window );
- GladeXML *xml = get_glade_xml_object( glade_file, parent_name );
- GtkWidget *widget = glade_xml_get_widget( xml, name );
- g_free( parent_name );
- g_object_unref( xml );
- return( widget );
+ GtkWidget *target = base_window_get_widget( window, widget );
+ g_signal_connect( G_OBJECT( target ), signal, handler, window );
}
-static GHashTable *
-get_glade_hashtable( void )
+static void
+do_run_window( BaseWindow *window )
{
- static GHashTable* glade_hash = NULL;
-
- if( !glade_hash ){
- glade_hash = g_hash_table_new_full( g_str_hash, g_str_equal, g_free, g_object_unref );
+ if( !window->private->initialized ){
+ base_window_init( window );
}
- return( glade_hash );
+ static const gchar *thisfn = "base_window_do_run_window";
+ g_debug( "%s: window=%p", thisfn, window );
+
+ GtkWidget *this_widget = GTK_WIDGET( window->private->toplevel_widget );
+
+ if( is_main_window( window )){
+ g_signal_connect( G_OBJECT( this_widget ), "response", G_CALLBACK( v_dialog_response ), window );
+ g_debug( "%s: starting gtk_main", thisfn );
+ gtk_main();
+
+ } else {
+ g_debug( "%s: starting gtk_dialog_run", thisfn );
+ gint code = gtk_dialog_run( GTK_DIALOG( this_widget ));
+ v_dialog_response( GTK_DIALOG( this_widget ), code, window );
+ }
}
-static GladeXML *
-get_glade_xml_object( const gchar *glade_fname, const gchar *widget_name )
+static GObject *
+do_get_application( BaseWindow *window )
{
- GHashTable *glade_hash = get_glade_hashtable();
- GladeXML *xml = NULL;
+ return( G_OBJECT( window->private->application ));
+}
- xml = ( GladeXML * ) g_hash_table_lookup( glade_hash, widget_name );
- if( !xml ){
- xml = glade_xml_new( glade_fname, widget_name, NULL );
- g_hash_table_insert( glade_hash, g_strdup( widget_name ), xml );
- }
+static GtkWindow *
+do_get_toplevel_widget( BaseWindow *window )
+{
+ return( window->private->toplevel_widget );
+}
- return( GLADE_XML( g_object_ref( xml )));
+static GtkWidget *
+do_get_widget( BaseWindow *window, const gchar *name )
+{
+ g_assert( BASE_IS_WINDOW( window ));
+ return( base_application_get_widget( window->private->application, name ));
}
-static void
-destroy_glade_objects( void )
+static gboolean
+is_main_window( BaseWindow *window )
{
- GHashTable *glade_hash = get_glade_hashtable();
- g_hash_table_destroy( glade_hash );
+ BaseApplication *appli = window->private->application;
+
+ BaseWindow *main_window = BASE_WINDOW( base_application_get_main_window( appli ));
+
+ GtkWidget *main_widget = GTK_WIDGET( base_window_get_toplevel_widget( main_window ));
+
+ GtkWidget *this_widget = GTK_WIDGET( window->private->toplevel_widget );
+
+ return( main_widget == this_widget );
}
diff --git a/src/nact/base-window.h b/src/nact/base-window.h
index 8ab18a6..6be8e26 100644
--- a/src/nact/base-window.h
+++ b/src/nact/base-window.h
@@ -64,11 +64,13 @@ typedef struct {
BaseWindowClassPrivate *private;
/* virtual functions */
- void ( *init_window ) ( BaseWindow *window );
- GtkWidget * ( *load_widget ) ( BaseWindow *window, const gchar *name );
+ void ( *init ) ( BaseWindow *window );
+ void ( *run ) ( BaseWindow *window );
+ void ( *on_init_widget ) ( BaseWindow *window );
+ void ( *on_dialog_response ) ( GtkDialog *dialog, gint code, BaseWindow *window );
+ GObject * ( *get_application ) ( BaseWindow *window );
gchar * ( *get_toplevel_name ) ( BaseWindow *window );
- GtkWindow * ( *get_toplevel_window )( BaseWindow *window );
- gchar * ( *get_glade_file ) ( BaseWindow *window );
+ GtkWindow * ( *get_toplevel_widget )( BaseWindow *window );
GtkWidget * ( *get_widget ) ( BaseWindow *window, const gchar *name );
}
BaseWindowClass;
@@ -77,22 +79,19 @@ typedef struct {
*/
#define PROP_WINDOW_APPLICATION_STR "application"
#define PROP_WINDOW_TOPLEVEL_NAME_STR "toplevel-name"
-#define PROP_WINDOW_TOPLEVEL_WINDOW_STR "toplevel-window"
-#define PROP_WINDOW_GLADE_FILENAME_STR "glade-filename"
+#define PROP_WINDOW_TOPLEVEL_WIDGET_STR "toplevel-widget"
+#define PROP_WINDOW_INITIALIZED_STR "is-initialized"
-GType base_window_get_type( void );
+GType base_window_get_type( void );
-BaseWindow *base_window_new( void );
+void base_window_init( BaseWindow *window );
+void base_window_run( BaseWindow *window );
-void base_window_init_window( BaseWindow *window );
+GtkWindow *base_window_get_toplevel_widget( BaseWindow *window );
+GObject *base_window_get_application( BaseWindow *window );
+GtkWidget *base_window_get_widget( BaseWindow *window, const gchar *name );
-GtkWidget *base_window_load_widget( BaseWindow *window, const gchar *name );
-
-gchar *base_window_get_toplevel_name( BaseWindow *window );
-GtkWindow *base_window_get_toplevel_window( BaseWindow *window );
-GtkWidget *base_window_get_widget( BaseWindow *window, const gchar *name );
-
-void base_window_connect( BaseWindow *window, const gchar *widget, const gchar *signal, GCallback handler );
+void base_window_connect( BaseWindow *window, const gchar *widget, const gchar *signal, GCallback handler );
G_END_DECLS
diff --git a/src/nact/nact-action-editor.c b/src/nact/nact-action-editor.c
index 97cd204..193daaa 100644
--- a/src/nact/nact-action-editor.c
+++ b/src/nact/nact-action-editor.c
@@ -43,7 +43,7 @@
#include "nact-profile-editor.h"
#include "nact-utils.h"
#include "nact-prefs.h"
-#include "nact.h"
+#include "old-nact.h"
enum {
ICON_STOCK_COLUMN = 0,
diff --git a/src/nact/nact-action-profile.c b/src/nact/nact-action-profile.c
new file mode 100644
index 0000000..f8701fc
--- /dev/null
+++ b/src/nact/nact-action-profile.c
@@ -0,0 +1,327 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <common/na-action.h>
+
+#include "nact-application.h"
+#include "nact-action-profile.h"
+#include "nact-main-window.h"
+
+/* private class data
+ */
+struct NactActionProfileClassPrivate {
+};
+
+/* private instance data
+ */
+struct NactActionProfilePrivate {
+ gboolean dispose_has_run;
+ NAAction *action;
+};
+
+static GObjectClass *st_parent_class = NULL;
+
+static GType register_type( void );
+static void class_init( NactActionProfileClass *klass );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *dialog );
+static void instance_finalize( GObject *dialog );
+
+static NactActionProfile *action_profile_new( BaseApplication *application );
+
+static gchar *do_get_dialog_name( BaseWindow *dialog );
+static void on_init_dialog( BaseWindow *dialog );
+static void on_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window );
+
+GType
+nact_action_profile_get_type( void )
+{
+ static GType dialog_type = 0;
+
+ if( !dialog_type ){
+ dialog_type = register_type();
+ }
+
+ return( dialog_type );
+}
+
+static GType
+register_type( void )
+{
+ static const gchar *thisfn = "nact_action_profile_register_type";
+ g_debug( "%s", thisfn );
+
+ static GTypeInfo info = {
+ sizeof( NactActionProfileClass ),
+ ( GBaseInitFunc ) NULL,
+ ( GBaseFinalizeFunc ) NULL,
+ ( GClassInitFunc ) class_init,
+ NULL,
+ NULL,
+ sizeof( NactActionProfile ),
+ 0,
+ ( GInstanceInitFunc ) instance_init
+ };
+
+ GType type = g_type_register_static( NACT_WINDOW_TYPE, "NactActionProfile", &info, 0 );
+
+ return( type );
+}
+
+static void
+class_init( NactActionProfileClass *klass )
+{
+ static const gchar *thisfn = "nact_action_profile_class_init";
+ g_debug( "%s: klass=%p", thisfn, klass );
+
+ st_parent_class = g_type_class_peek_parent( klass );
+
+ GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class->dispose = instance_dispose;
+ object_class->finalize = instance_finalize;
+ /*object_class->get_property = instance_get_property;
+ object_class->set_property = instance_set_property;*/
+
+ klass->private = g_new0( NactActionProfileClassPrivate, 1 );
+
+ BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
+ base_class->on_init_widget = on_init_dialog;
+ base_class->on_dialog_response = on_dialog_response;
+ base_class->get_toplevel_name = do_get_dialog_name;
+}
+
+static void
+instance_init( GTypeInstance *instance, gpointer klass )
+{
+ static const gchar *thisfn = "nact_action_profile_instance_init";
+ g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+
+ g_assert( NACT_IS_ACTION_PROFILE( instance ));
+ NactActionProfile *self = NACT_ACTION_PROFILE( instance );
+
+ self->private = g_new0( NactActionProfilePrivate, 1 );
+
+ self->private->dispose_has_run = FALSE;
+}
+
+/*static void
+instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
+{
+ g_assert( NACT_IS_ACTION_PROFILE( object ));
+ NactActionProfile *self = NACT_ACTION_PROFILE( object );
+
+ switch( property_id ){
+ case PROP_ARGC:
+ g_value_set_int( value, self->private->argc );
+ break;
+
+ case PROP_ARGV:
+ g_value_set_pointer( value, self->private->argv );
+ break;
+
+ case PROP_UNIQUE_NAME:
+ g_value_set_string( value, self->private->unique_name );
+ break;
+
+ case PROP_UNIQUE_APP:
+ g_value_set_pointer( value, self->private->unique_app );
+ break;
+
+ case PROP_MAIN_WINDOW:
+ g_value_set_pointer( value, self->private->main_window );
+ break;
+
+ case PROP_DLG_NAME:
+ g_value_set_string( value, self->private->application_name );
+ break;
+
+ case PROP_ICON_NAME:
+ g_value_set_string( value, self->private->icon_name );
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
+ break;
+ }
+}
+
+static void
+instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
+{
+ g_assert( NACT_IS_ACTION_PROFILE( object ));
+ NactActionProfile *self = NACT_ACTION_PROFILE( object );
+
+ switch( property_id ){
+ case PROP_ARGC:
+ self->private->argc = g_value_get_int( value );
+ break;
+
+ case PROP_ARGV:
+ self->private->argv = g_value_get_pointer( value );
+ break;
+
+ case PROP_UNIQUE_NAME:
+ g_free( self->private->unique_name );
+ self->private->unique_name = g_value_dup_string( value );
+ break;
+
+ case PROP_UNIQUE_APP:
+ self->private->unique_app = g_value_get_pointer( value );
+ break;
+
+ case PROP_MAIN_WINDOW:
+ self->private->main_window = g_value_get_pointer( value );
+ break;
+
+ case PROP_DLG_NAME:
+ g_free( self->private->application_name );
+ self->private->application_name = g_value_dup_string( value );
+ break;
+
+ case PROP_ICON_NAME:
+ g_free( self->private->icon_name );
+ self->private->icon_name = g_value_dup_string( value );
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
+ break;
+ }
+}*/
+
+static void
+instance_dispose( GObject *dialog )
+{
+ static const gchar *thisfn = "nact_action_profile_instance_dispose";
+ g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_assert( NACT_IS_ACTION_PROFILE( dialog ));
+ NactActionProfile *self = NACT_ACTION_PROFILE( dialog );
+
+ if( !self->private->dispose_has_run ){
+
+ self->private->dispose_has_run = TRUE;
+
+ /* chain up to the parent class */
+ G_OBJECT_CLASS( st_parent_class )->dispose( dialog );
+ }
+}
+
+static void
+instance_finalize( GObject *dialog )
+{
+ static const gchar *thisfn = "nact_action_profile_instance_finalize";
+ g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_assert( NACT_IS_ACTION_PROFILE( dialog ));
+ /*NactActionProfile *self = ( NactActionProfile * ) dialog;*/
+
+ /* chain call to parent class */
+ if( st_parent_class->finalize ){
+ G_OBJECT_CLASS( st_parent_class )->finalize( dialog );
+ }
+}
+
+/**
+ * Returns a newly allocated NactActionProfile object.
+ *
+ * @parent: is the BaseWindow parent of this dialog (usually, the main
+ * toplevel window of the application).
+ */
+static NactActionProfile *
+action_profile_new( BaseApplication *application )
+{
+ return( g_object_new( NACT_ACTION_PROFILE_TYPE, PROP_WINDOW_APPLICATION_STR, application, NULL ));
+}
+
+/**
+ * Initializes and runs the dialog.
+ *
+ * @parent: is the BaseWindow parent of this dialog (usually, the main
+ * toplevel window of the application).
+ *
+ * @user_data: a pointer to the NAAction to edit, or NULL. If NULL, a
+ * new NAAction is created.
+ *
+ * Returns TRUE if the NAAction has been edited and saved, or FALSE if
+ * there has been no modification at all.
+ */
+gboolean
+nact_action_profile_run_editor( NactWindow *parent, gpointer user_data )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( parent ));
+
+ BaseApplication *application = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( parent )));
+ g_assert( NACT_IS_APPLICATION( application ));
+
+ NactActionProfile *dialog = action_profile_new( application );
+
+ g_assert( NA_IS_ACTION( user_data ) || !user_data );
+ dialog->private->action = NA_ACTION( user_data );
+
+ base_window_run( BASE_WINDOW( dialog ));
+
+ return( TRUE );
+}
+
+static gchar *
+do_get_dialog_name( BaseWindow *dialog )
+{
+ /*g_debug( "nact_action_profile_do_get_dialog_name" );*/
+ return( g_strdup( "EditActionDialogExt"));
+}
+
+static void
+on_init_dialog( BaseWindow *dialog )
+{
+ static const gchar *thisfn = "nact_action_profile_on_init_dialog";
+ g_debug( "%s: dialog=%p", thisfn, dialog );
+}
+
+static void
+on_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window )
+{
+ static const gchar *thisfn = "nact_action_profile_on_dialog_response";
+ g_debug( "%s: dialog=%p, code=%d, window=%p", thisfn, dialog, code, window );
+
+ g_assert( NACT_IS_ACTION_PROFILE( window ));
+
+ switch( code ){
+ case GTK_RESPONSE_NONE:
+ case GTK_RESPONSE_DELETE_EVENT:
+ case GTK_RESPONSE_CLOSE:
+ g_object_unref( window );
+ break;
+ }
+}
diff --git a/src/nact/nact-action-profile.h b/src/nact/nact-action-profile.h
new file mode 100644
index 0000000..d87c952
--- /dev/null
+++ b/src/nact/nact-action-profile.h
@@ -0,0 +1,74 @@
+/*
+ * 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_ACTION_PROFILE_H__
+#define __NACT_ACTION_PROFILE_H__
+
+/*
+ * NactActionProfile class definition.
+ *
+ * This class is derived from NactWindow.
+ * It encapsulates the "EditActionDialogExt" widget dialog.
+ */
+
+#include "nact-window.h"
+
+G_BEGIN_DECLS
+
+#define NACT_ACTION_PROFILE_TYPE ( nact_action_profile_get_type())
+#define NACT_ACTION_PROFILE( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_ACTION_PROFILE_TYPE, NactActionProfile ))
+#define NACT_ACTION_PROFILE_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_ACTION_PROFILE_TYPE, NactActionProfileClass ))
+#define NACT_IS_ACTION_PROFILE( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_ACTION_PROFILE_TYPE ))
+#define NACT_IS_ACTION_PROFILE_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_ACTION_PROFILE_TYPE ))
+#define NACT_ACTION_PROFILE_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_ACTION_PROFILE_TYPE, NactActionProfileClass ))
+
+typedef struct NactActionProfilePrivate NactActionProfilePrivate;
+
+typedef struct {
+ NactWindow parent;
+ NactActionProfilePrivate *private;
+}
+ NactActionProfile;
+
+typedef struct NactActionProfileClassPrivate NactActionProfileClassPrivate;
+
+typedef struct {
+ NactWindowClass parent;
+ NactActionProfileClassPrivate *private;
+}
+ NactActionProfileClass;
+
+GType nact_action_profile_get_type( void );
+
+gboolean nact_action_profile_run_editor( NactWindow *parent, gpointer user_data );
+
+G_END_DECLS
+
+#endif /* __NACT_ACTION_PROFILE_H__ */
diff --git a/src/nact/nact-application.c b/src/nact/nact-application.c
index 687d81f..702f1c5 100644
--- a/src/nact/nact-application.c
+++ b/src/nact/nact-application.c
@@ -38,7 +38,9 @@
#include <common/na-pivot.h>
#include "nact-application.h"
-#include "nact-wnd-actions.h"
+#include "nact-main-window.h"
+
+#define GLADE_FILENAME GLADEDIR "/nautilus-actions-config.ui"
/* private class data
*/
@@ -62,20 +64,20 @@ enum {
static GObjectClass *st_parent_class = NULL;
-static GType register_type( void );
-static void class_init( NactApplicationClass *klass );
-static void instance_init( GTypeInstance *instance, gpointer klass );
-static void instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
-static void instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );
-static void instance_dispose( GObject *application );
-static void instance_finalize( GObject *application );
-
-static void warn_other_instance( BaseApplication *application );
-static void start( BaseApplication *application );
-static gchar *get_application_name( BaseApplication *application );
-static gchar *get_icon_name( BaseApplication *application );
-static gchar *get_unique_name( BaseApplication *application );
-static GObject *get_main_window( BaseApplication *application );
+static GType register_type( void );
+static void class_init( NactApplicationClass *klass );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
+static void instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );
+static void instance_dispose( GObject *application );
+static void instance_finalize( GObject *application );
+
+static void warn_other_instance( BaseApplication *application );
+static gchar *get_application_name( BaseApplication *application );
+static gchar *get_icon_name( BaseApplication *application );
+static gchar *get_unique_name( BaseApplication *application );
+static gchar *get_glade_file( BaseApplication *application );
+static GObject *get_main_window( BaseApplication *application );
GType
nact_application_get_type( void )
@@ -137,10 +139,10 @@ class_init( NactApplicationClass *klass )
BaseApplicationClass *appli_class = BASE_APPLICATION_CLASS( klass );
appli_class->advertise_not_willing_to_run = warn_other_instance;
- appli_class->start = start;
appli_class->get_application_name = get_application_name;
appli_class->get_icon_name = get_icon_name;
appli_class->get_unique_name = get_unique_name;
+ appli_class->get_ui_filename = get_glade_file;
appli_class->get_main_window = get_main_window;
}
@@ -156,6 +158,9 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private = g_new0( NactApplicationPrivate, 1 );
self->private->dispose_has_run = FALSE;
+
+ /* TODO: be notified when the list of actions is changed elsewhere */
+ self->private->pivot = na_pivot_new( NULL );
}
static void
@@ -219,7 +224,9 @@ instance_finalize( GObject *application )
g_debug( "%s: application=%p", thisfn, application );
g_assert( NACT_IS_APPLICATION( application ));
- /*NactApplication *self = ( NactApplication * ) application;*/
+ NactApplication *self = ( NactApplication * ) application;
+
+ g_free( self->private );
/* chain call to parent class */
if( st_parent_class->finalize ){
@@ -254,28 +261,10 @@ warn_other_instance( BaseApplication *application )
base_application_error_dlg(
application,
GTK_MESSAGE_INFO,
- _( "Another instance of Nautilus Actions Configurator is already running." ),
+ _( "Another instance of Nautilus Actions Configuration Tool is already running." ),
_( "Please switch back to it." ));
}
-static void
-start( BaseApplication *application )
-{
- static const gchar *thisfn = "nact_application_start";
- g_debug( "%s: application=%p", thisfn, application );
-
- g_assert( NACT_IS_APPLICATION( application ));
- NactApplication *appli = NACT_APPLICATION( application );
-
- /* TODO: be notified when the list of actions is changed elsewhere */
- appli->private->pivot = na_pivot_new( NULL );
-
- /* chain up to the parent class which takes care of registering
- * UniqueApp, and initializing and running the newly created window
- */
- BASE_APPLICATION_CLASS( st_parent_class )->start( application );
-}
-
static gchar *
get_application_name( BaseApplication *application )
{
@@ -305,13 +294,19 @@ get_unique_name( BaseApplication *application )
return( g_strdup( "org.nautilus-actions.ConfigurationTool" ));
}
+static gchar *
+get_glade_file( BaseApplication *application )
+{
+ return( g_strdup( GLADE_FILENAME ));
+}
+
static GObject *
get_main_window( BaseApplication *application )
{
static const gchar *thisfn = "nact_application_get_main_window";
g_debug( "%s: application=%p", thisfn, application );
- return( G_OBJECT( nact_wnd_actions_new( G_OBJECT( application ))));
+ return( G_OBJECT( nact_main_window_new( G_OBJECT( application ))));
}
/**
diff --git a/src/nact/nact-editor.c b/src/nact/nact-editor.c
index e67a967..94808d4 100644
--- a/src/nact/nact-editor.c
+++ b/src/nact/nact-editor.c
@@ -38,7 +38,7 @@
#include "nact-profile-editor.h"
#include "nact-utils.h"
#include "nact-prefs.h"
-#include "nact.h"
+#include "old-nact.h"
/* gui callback functions */
void icon_browse_button_clicked_cb (GtkButton *button, gpointer user_data);
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index eaebb6b..188c632 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -56,10 +56,9 @@ static GType register_type( void );
static void interface_base_init( NactIActionsListInterface *klass );
static void interface_base_finalize( NactIActionsListInterface *klass );
-static void do_init_widget( BaseWindow *window );
-static void do_fill_actions_list( BaseWindow *window );
-static NAPivot *get_pivot( BaseWindow *window );
-static GtkWidget *get_actions_list( BaseWindow *window );
+static void do_init_widget( NactWindow *window );
+static void do_fill_actions_list( NactWindow *window );
+static GtkWidget *get_actions_list( NactWindow *window );
static void v_on_selection_changed( GtkTreeSelection *selection, gpointer user_data );
static gboolean v_on_button_press_event( GtkWidget *widget, GdkEventButton *event, gpointer data );
@@ -138,7 +137,7 @@ interface_base_finalize( NactIActionsListInterface *klass )
* Allocates and initializes the ActionsList widget.
*/
void
-nact_iactions_list_init( BaseWindow *window )
+nact_iactions_list_init( NactWindow *window )
{
g_assert( NACT_IS_IACTIONS_LIST( window ));
@@ -150,7 +149,7 @@ nact_iactions_list_init( BaseWindow *window )
}
void
-do_init_widget( BaseWindow *window )
+do_init_widget( NactWindow *window )
{
GtkListStore *model;
GtkTreeViewColumn *column;
@@ -165,7 +164,7 @@ do_init_widget( BaseWindow *window )
nact_iactions_list_fill( window );
g_object_unref( model );
- /* create columns on the tree view */
+ /* create visible columns on the tree view */
column = gtk_tree_view_column_new_with_attributes(
"icon", gtk_cell_renderer_pixbuf_new(), "pixbuf", IACTIONS_LIST_ICON_COLUMN, NULL );
gtk_tree_view_append_column( GTK_TREE_VIEW( widget ), column );
@@ -193,7 +192,7 @@ do_init_widget( BaseWindow *window )
* Fill the listbox with current actions.
*/
void
-nact_iactions_list_fill( BaseWindow *window )
+nact_iactions_list_fill( NactWindow *window )
{
g_assert( NACT_IS_IACTIONS_LIST( window ));
@@ -205,23 +204,25 @@ nact_iactions_list_fill( BaseWindow *window )
}
static void
-do_fill_actions_list( BaseWindow *window )
+do_fill_actions_list( NactWindow *window )
{
- GSList *actions, *l;
+ static const gchar *thisfn = "nact_iactions_list_do_fill_actions_list";
+ g_debug( "%s: window=%p", thisfn, window );
GtkWidget *widget = get_actions_list( window );
GtkListStore *model = GTK_LIST_STORE( gtk_tree_view_get_model( GTK_TREE_VIEW( widget )));
gtk_list_store_clear( model );
- NAPivot *pivot = get_pivot( window );
- actions = na_pivot_get_label_sorted_actions( pivot );
+ GSList *actions = nact_window_get_actions( window );
+ GSList *ia;
+ /*g_debug( "%s: actions has %d elements", thisfn, g_slist_length( actions ));*/
- for( l = actions ; l != NULL ; l = l->next ){
+ for( ia = actions ; ia != NULL ; ia = ia->next ){
GtkTreeIter iter;
GtkStockItem item;
GdkPixbuf* icon = NULL;
- NAAction *action = NA_ACTION( l->data );
+ NAAction *action = NA_ACTION( ia->data );
gchar *uuid = na_action_get_uuid( action );
gchar *label = na_action_get_label( action );
gchar *iconname = na_action_get_icon( action );
@@ -230,7 +231,7 @@ do_fill_actions_list( BaseWindow *window )
* display an icon + move the code to NAAction class +
* remove na_action_get_verified_icon_name
*/
- if( icon ){
+ if( iconname ){
if( gtk_stock_lookup( iconname, &item )){
icon = gtk_widget_render_icon( widget, iconname, GTK_ICON_SIZE_MENU, NULL );
@@ -242,11 +243,11 @@ do_fill_actions_list( BaseWindow *window )
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
icon = gdk_pixbuf_new_from_file_at_size( iconname, width, height, &error );
- if (error)
- {
- /* TODO: at least log an error */
+ if( error ){
+ g_warning( "%s: iconname=%s, error=%s", thisfn, iconname, error->message );
+ g_error_free( error );
+ error = NULL;
icon = NULL;
- g_error_free (error);
}
}
}
@@ -261,22 +262,13 @@ do_fill_actions_list( BaseWindow *window )
g_free( label );
g_free( uuid );
}
-}
-
-static NAPivot *
-get_pivot( BaseWindow *window )
-{
- NactApplication *application;
- g_object_get( G_OBJECT( window ), PROP_WINDOW_APPLICATION_STR, &application, NULL );
- g_return_val_if_fail( NACT_IS_APPLICATION( application ), NULL );
-
- return( NA_PIVOT( nact_application_get_pivot( application )));
+ /*g_debug( "%s: at end, actions has %d elements", thisfn, g_slist_length( actions ));*/
}
static GtkWidget *
-get_actions_list( BaseWindow *window )
+get_actions_list( NactWindow *window )
{
- return( base_window_get_widget( window, "ActionsList" ));
+ return( base_window_get_widget( BASE_WINDOW( window ), "ActionsList" ));
}
static void
diff --git a/src/nact/nact-iactions-list.h b/src/nact/nact-iactions-list.h
index 76d0043..33a72f9 100644
--- a/src/nact/nact-iactions-list.h
+++ b/src/nact/nact-iactions-list.h
@@ -39,10 +39,9 @@
* behaviour of the listbox.
*/
-#include <glib-object.h>
#include <gtk/gtk.h>
-#include "base-window.h"
+#include "nact-window.h"
G_BEGIN_DECLS
@@ -60,8 +59,8 @@ typedef struct {
NactIActionsListInterfacePrivate *private;
/* api */
- void ( *init_widget ) ( BaseWindow *window );
- void ( *fill_actions_list ) ( BaseWindow *window );
+ void ( *init_widget ) ( NactWindow *window );
+ void ( *fill_actions_list ) ( NactWindow *window );
void ( *on_selection_changed ) ( GtkTreeSelection *selection, gpointer user_data );
gboolean ( *on_button_press_event )( GtkWidget *widget, GdkEventButton *event, gpointer data );
gboolean ( *on_double_click ) ( GtkWidget *widget, GdkEventButton *event, gpointer data );
@@ -70,8 +69,8 @@ typedef struct {
GType nact_iactions_list_get_type( void );
-void nact_iactions_list_init( BaseWindow *window );
-void nact_iactions_list_fill( BaseWindow *window );
+void nact_iactions_list_init( NactWindow *window );
+void nact_iactions_list_fill( NactWindow *window );
G_END_DECLS
diff --git a/src/nact/nact-import-export.c b/src/nact/nact-import-export.c
index 2ff4685..2ff5deb 100644
--- a/src/nact/nact-import-export.c
+++ b/src/nact/nact-import-export.c
@@ -41,7 +41,7 @@
#include "nact-utils.h"
#include "nact-import-export.h"
#include "nact-prefs.h"
-#include "nact.h"
+#include "old-nact.h"
/* gui callback functions */
void import_browse_button_clicked_cb (GtkWidget* widget, gpointer data);
diff --git a/src/nact/nact-wnd-actions.c b/src/nact/nact-main-window.c
similarity index 60%
rename from src/nact/nact-wnd-actions.c
rename to src/nact/nact-main-window.c
index c24061d..49ba1cc 100644
--- a/src/nact/nact-wnd-actions.c
+++ b/src/nact/nact-main-window.c
@@ -35,72 +35,55 @@
#include <stdlib.h>
#include <glib/gi18n.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtktreeview.h>
-#include <glade/glade-xml.h>
+#include <gtk/gtk.h>
#include <common/na-action.h>
#include <common/na-action-profile.h>
#include <common/na-pivot.h>
#include "nact-application.h"
-#include "nact-wnd-actions.h"
+#include "nact-action-profile.h"
+#include "nact-main-window.h"
#include "nact-iactions-list.h"
-#include "nact-editor.h"
-#include "nact-import-export.h"
-#include "nact-prefs.h"
-#include "nact-action-editor.h"
-#include "nact-utils.h"
-
/* private class data
*/
-struct NactWndActionsClassPrivate {
+struct NactMainWindowClassPrivate {
};
/* private instance data
*/
-struct NactWndActionsPrivate {
- gboolean dispose_has_run;
+struct NactMainWindowPrivate {
+ gboolean dispose_has_run;
};
-static GObjectClass *st_parent_class = NULL;
-
-/*static NactApplication *st_application = NULL;
-static NAPivot *st_pivot = NULL;*/
+static GObjectClass *st_parent_class = NULL;
static GType register_type( void );
-static void class_init( NactWndActionsClass *klass );
+static void class_init( NactMainWindowClass *klass );
static void iactions_list_iface_init( NactIActionsListInterface *iface );
static void instance_init( GTypeInstance *instance, gpointer klass );
-/*static void instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
-static void instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );*/
static void instance_dispose( GObject *application );
static void instance_finalize( GObject *application );
-static void init_window( BaseWindow *window );
+static gchar *get_toplevel_name( BaseWindow *window );
+static void on_init_widget( 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 );
-#if(( GTK_MAJOR_VERSION == 2 ) && ( GTK_MINOR_VERSION == 4 ))
- static void init_edit_button_widget( BaseWindow *window );
-#endif
-#if((( GTK_MAJOR_VERSION == 2 ) && ( GTK_MINOR_VERSION >= 6 )) || ( GTK_MAJOR_VERSION > 2 ))
- static void init_about_button_widget( BaseWindow *window );
-#endif
-
+static void on_about_button_clicked( GtkButton *button, gpointer user_data );
static void on_add_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_export_button_clicked( GtkButton *button, gpointer user_data );
-static void on_dialog_response( GtkDialog *dialog, gint response_id, gpointer user_data );
+static void on_dialog_response( GtkDialog *dialog, gint response_id, BaseWindow *window );
+
+/*static gint count_actions( BaseWindow *window );*/
GType
-nact_wnd_actions_get_type( void )
+nact_main_window_get_type( void )
{
static GType window_type = 0;
@@ -114,24 +97,22 @@ nact_wnd_actions_get_type( void )
static GType
register_type( void )
{
- static const gchar *thisfn = "nact_wnd_actions_register_type";
+ static const gchar *thisfn = "nact_main_window_register_type";
g_debug( "%s", thisfn );
- g_type_init();
-
static GTypeInfo info = {
- sizeof( NactWndActionsClass ),
+ sizeof( NactMainWindowClass ),
( GBaseInitFunc ) NULL,
( GBaseFinalizeFunc ) NULL,
( GClassInitFunc ) class_init,
NULL,
NULL,
- sizeof( NactWndActions ),
+ sizeof( NactMainWindow ),
0,
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( NACT_WINDOW_TYPE, "NactWndActions", &info, 0 );
+ GType type = g_type_register_static( NACT_WINDOW_TYPE, "NactMainWindow", &info, 0 );
static const GInterfaceInfo iactions_list_iface_info = {
( GInterfaceInitFunc ) iactions_list_iface_init,
@@ -145,9 +126,9 @@ register_type( void )
}
static void
-class_init( NactWndActionsClass *klass )
+class_init( NactMainWindowClass *klass )
{
- static const gchar *thisfn = "nact_wnd_actions_class_init";
+ static const gchar *thisfn = "nact_main_window_class_init";
g_debug( "%s: klass=%p", thisfn, klass );
st_parent_class = g_type_class_peek_parent( klass );
@@ -155,19 +136,19 @@ class_init( NactWndActionsClass *klass )
GObjectClass *object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
- /*object_class->get_property = instance_get_property;
- object_class->set_property = instance_set_property;*/
- klass->private = g_new0( NactWndActionsClassPrivate, 1 );
+ klass->private = g_new0( NactMainWindowClassPrivate, 1 );
BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
- base_class->init_window = init_window;
+ base_class->on_init_widget = on_init_widget;
+ base_class->on_dialog_response = on_dialog_response;
+ base_class->get_toplevel_name = get_toplevel_name;
}
static void
iactions_list_iface_init( NactIActionsListInterface *iface )
{
- static const gchar *thisfn = "nact_wnd_actions_iactions_list_iface_init";
+ static const gchar *thisfn = "nact_main_window_iactions_list_iface_init";
g_debug( "%s: iface=%p", thisfn, iface );
iface->init_widget = NULL;
@@ -178,110 +159,25 @@ iactions_list_iface_init( NactIActionsListInterface *iface )
static void
instance_init( GTypeInstance *instance, gpointer klass )
{
- static const gchar *thisfn = "nact_wnd_actions_instance_init";
+ static const gchar *thisfn = "nact_main_window_instance_init";
g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
- g_assert( NACT_IS_WND_ACTIONS( instance ));
- NactWndActions *self = NACT_WND_ACTIONS( instance );
+ g_assert( NACT_IS_MAIN_WINDOW( instance ));
+ NactMainWindow *self = NACT_MAIN_WINDOW( instance );
- self->private = g_new0( NactWndActionsPrivate, 1 );
+ self->private = g_new0( NactMainWindowPrivate, 1 );
self->private->dispose_has_run = FALSE;
}
-/*static void
-instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
-{
- g_assert( NACT_IS_WND_ACTIONS( object ));
- NactWndActions *self = NACT_WND_ACTIONS( object );
-
- switch( property_id ){
- case PROP_ARGC:
- g_value_set_int( value, self->private->argc );
- break;
-
- case PROP_ARGV:
- g_value_set_pointer( value, self->private->argv );
- break;
-
- case PROP_UNIQUE_NAME:
- g_value_set_string( value, self->private->unique_name );
- break;
-
- case PROP_UNIQUE_APP:
- g_value_set_pointer( value, self->private->unique_app );
- break;
-
- case PROP_MAIN_WINDOW:
- g_value_set_pointer( value, self->private->main_window );
- break;
-
- case PROP_DLG_NAME:
- g_value_set_string( value, self->private->application_name );
- break;
-
- case PROP_ICON_NAME:
- g_value_set_string( value, self->private->icon_name );
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
- break;
- }
-}
-
-static void
-instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
-{
- g_assert( NACT_IS_WND_ACTIONS( object ));
- NactWndActions *self = NACT_WND_ACTIONS( object );
-
- switch( property_id ){
- case PROP_ARGC:
- self->private->argc = g_value_get_int( value );
- break;
-
- case PROP_ARGV:
- self->private->argv = g_value_get_pointer( value );
- break;
-
- case PROP_UNIQUE_NAME:
- g_free( self->private->unique_name );
- self->private->unique_name = g_value_dup_string( value );
- break;
-
- case PROP_UNIQUE_APP:
- self->private->unique_app = g_value_get_pointer( value );
- break;
-
- case PROP_MAIN_WINDOW:
- self->private->main_window = g_value_get_pointer( value );
- break;
-
- case PROP_DLG_NAME:
- g_free( self->private->application_name );
- self->private->application_name = g_value_dup_string( value );
- break;
-
- case PROP_ICON_NAME:
- g_free( self->private->icon_name );
- self->private->icon_name = g_value_dup_string( value );
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
- break;
- }
-}*/
-
static void
instance_dispose( GObject *window )
{
- static const gchar *thisfn = "nact_wnd_actions_instance_dispose";
+ static const gchar *thisfn = "nact_main_window_instance_dispose";
g_debug( "%s: window=%p", thisfn, window );
- g_assert( NACT_IS_WND_ACTIONS( window ));
- NactWndActions *self = NACT_WND_ACTIONS( window );
+ g_assert( NACT_IS_MAIN_WINDOW( window ));
+ NactMainWindow *self = NACT_MAIN_WINDOW( window );
if( !self->private->dispose_has_run ){
@@ -295,11 +191,13 @@ instance_dispose( GObject *window )
static void
instance_finalize( GObject *window )
{
- static const gchar *thisfn = "nact_wnd_actions_instance_finalize";
+ static const gchar *thisfn = "nact_main_window_instance_finalize";
g_debug( "%s: window=%p", thisfn, window );
- g_assert( NACT_IS_WND_ACTIONS( window ));
- /*NactWndActions *self = ( NactWndActions * ) window;*/
+ g_assert( NACT_IS_MAIN_WINDOW( window ));
+ NactMainWindow *self = ( NactMainWindow * ) window;
+
+ g_free( self->private );
/* chain call to parent class */
if( st_parent_class->finalize ){
@@ -308,76 +206,48 @@ instance_finalize( GObject *window )
}
/**
- * Returns a newly allocated NactWndActions object.
+ * Returns a newly allocated NactMainWindow object.
*/
-NactWndActions *
-nact_wnd_actions_new( GObject *application )
+NactMainWindow *
+nact_main_window_new( GObject *application )
{
g_assert( NACT_IS_APPLICATION( application ));
- return( g_object_new( NACT_WND_ACTIONS_TYPE, PROP_WINDOW_APPLICATION_STR, application, NULL ));
+ return( g_object_new( NACT_MAIN_WINDOW_TYPE, PROP_WINDOW_APPLICATION_STR, application, NULL ));
+}
+
+static gchar *
+get_toplevel_name( BaseWindow *window )
+{
+ return( g_strdup( "ActionsDialog" ));
}
static void
-init_window( BaseWindow *window )
+on_init_widget( BaseWindow *window )
{
- static const gchar *thisfn = "nact_wnd_actions_init_window";
+ static const gchar *thisfn = "nact_main_window_init_widget";
g_debug( "%s: window=%p", thisfn, window );
- g_assert( NACT_IS_WND_ACTIONS( window ));
- /*NactWndActions *wnd = NACT_WND_ACTIONS( window );*/
+ g_assert( NACT_IS_MAIN_WINDOW( window ));
+ /*NactMainWindow *wnd = NACT_MAIN_WINDOW( window );*/
- GtkWidget *dialog = base_window_load_widget( window, "ActionsDialog" );
-
- nact_iactions_list_init( window );
-
-#if(( GTK_MAJOR_VERSION == 2 ) && ( GTK_MINOR_VERSION == 4 ))
- /* Fix a stock icon bug with GTK+ 2.4 */
- init_edit_button_widget( window );
-#endif
-
-#if((( GTK_MAJOR_VERSION == 2 ) && ( GTK_MINOR_VERSION >= 6 )) || ( GTK_MAJOR_VERSION > 2 ))
- /* Add about dialog for GTK+ >= 2.6 */
- init_about_button_widget( window );
-#endif
+ nact_iactions_list_init( NACT_WINDOW( window ));
+ base_window_connect( window, "AboutButton", "clicked", G_CALLBACK( on_about_button_clicked ));
base_window_connect( window, "AddActionButton", "clicked", G_CALLBACK( on_add_button_clicked ));
base_window_connect( window, "EditActionButton", "clicked", G_CALLBACK( on_edit_button_clicked ));
base_window_connect( window, "DuplicateActionButton", "clicked", G_CALLBACK( on_duplicate_button_clicked ));
base_window_connect( window, "DeleteActionButton", "clicked", G_CALLBACK( on_delete_button_clicked ));
base_window_connect( window, "ImExportButton", "clicked", G_CALLBACK( on_import_export_button_clicked ));
-
- /* display the dialog */
- g_signal_connect( G_OBJECT( dialog ), "response", G_CALLBACK( on_dialog_response ), window );
- gtk_widget_show( dialog );
}
-#if(( GTK_MAJOR_VERSION == 2 ) && ( GTK_MINOR_VERSION == 4 ))
-static void
-init_edit_button_widget( BaseWindow *window )
-{
- /* Fix a stock icon bug with GTK+ 2.4 */
- GtkWidget *button = base_window_get_widget( window, "EditActionButton" );
- gtk_button_set_use_stock( GTK_BUTTON( button ), FALSE );
- gtk_button_set_use_underline( GTK_BUTTON( button ), TRUE );
- /* i18n: "Edit" action button label forced for Gtk 2.4 */
- gtk_button_set_label( GTK_BUTTON( button ), _( "_Edit" ));
-}
-#endif
-
-#if((( GTK_MAJOR_VERSION == 2 ) && ( GTK_MINOR_VERSION >= 6 )) || ( GTK_MAJOR_VERSION > 2 ))
-static void
-init_about_button_widget( BaseWindow *window )
-{
- /* Add about dialog for GTK+ >= 2.6 */
- GtkWidget *button = base_window_get_widget( window, "AboutButton" );
- gtk_widget_show( button );
-}
-#endif
-
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 );
+
+ g_assert( BASE_IS_WINDOW( user_data ));
BaseWindow *window = BASE_WINDOW( user_data );
GtkWidget *edit_button = base_window_get_widget( window, "EditActionButton" );
@@ -399,6 +269,75 @@ on_actions_list_double_click( GtkWidget *widget, GdkEventButton *event, gpointer
return( TRUE );
}
+/* TODO: make the website url and the mail addresses clickables
+ */
+static void
+on_about_button_clicked( GtkButton *button, 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 );
+
+ g_assert( BASE_IS_WINDOW( user_data ));
+ BaseWindow *wndmain = BASE_WINDOW( user_data );
+
+ BaseApplication *appli;
+ g_object_get( G_OBJECT( wndmain ), PROP_WINDOW_APPLICATION_STR, &appli, NULL );
+ gchar *icon_name = base_application_get_icon_name( appli );
+
+ static const gchar *artists[] = {
+ N_( "Ulisse Perusin <uli peru gmail com>" ),
+ NULL
+ };
+
+ static const gchar *authors[] = {
+ N_( "Frederic Ruaudel <grumz grumz net>" ),
+ N_( "Rodrigo Moya <rodrigo gnome-db org>" ),
+ N_( "Pierre Wieser <pwieser trychlos org>" ),
+ NULL
+ };
+
+ static const gchar *documenters[] = {
+ NULL
+ };
+
+ static gchar *license[] = {
+ N_( "Nautilus Actions Configuration Tool 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." ),
+ N_( "Nautilus Actions Configuration Tool 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." ),
+ N_( "You should have received a copy of the GNU General Public License along "
+ "with Nautilus Actions Configuration Tool ; if not, write to the Free "
+ "Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, "
+ "MA 02110-1301, USA." ),
+ NULL
+ };
+ gchar *license_i18n = g_strjoinv( "\n\n", license );
+
+ GtkWidget *toplevel;
+ g_object_get( G_OBJECT( wndmain ), PROP_WINDOW_TOPLEVEL_WIDGET_STR, &toplevel, NULL );
+
+ gtk_show_about_dialog( GTK_WINDOW( toplevel ),
+ "artists", artists,
+ "authors", authors,
+ "comments", _( "A graphical tool to create and edit your Nautilus actions." ),
+ "copyright", _( "Copyright \xc2\xa9 2005-2007 Frederic Ruaudel <grumz grumz net>\nCopyright \xc2\xa9 2009 Pierre Wieser <pwieser trychlos org>" ),
+ "documenters", documenters,
+ "translator-credits", _( "The GNOME Translation Project <gnome-i18n gnome org>" ),
+ "license", license_i18n,
+ "wrap-license", TRUE,
+ "logo-icon-name", icon_name,
+ "version", PACKAGE_VERSION,
+ "website", "http://www.nautilus-actions.org",
+ NULL );
+
+ g_free( license_i18n );
+ g_free( icon_name );
+}
+
/*
* creating a new action
* pwi 2009-05-19
@@ -409,11 +348,17 @@ on_actions_list_double_click( GtkWidget *widget, GdkEventButton *event, gpointer
static void
on_add_button_clicked( GtkButton *button, gpointer user_data )
{
- static const gchar *thisfn = "nact_wnd_actions_on_add_button_clicked";
+ static const gchar *thisfn = "nact_main_window_on_add_button_clicked";
g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
- if( nact_action_editor_new()){
- nact_iactions_list_fill( BASE_WINDOW( user_data ));
+ g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactWindow *wndmain = NACT_WINDOW( user_data );
+
+ /* TODO: set the selection to the newly created action
+ * or restore the previous selection
+ */
+ if( nact_action_profile_run_editor( wndmain, NULL )){
+ nact_iactions_list_fill( wndmain );
}
}
@@ -431,7 +376,7 @@ on_add_button_clicked( GtkButton *button, gpointer user_data )
static void
on_edit_button_clicked( GtkButton *button, gpointer user_data )
{
- static const gchar *thisfn = "nact_wnd_actions_on_edit_button_clicked";
+ static const gchar *thisfn = "nact_main_window_on_edit_button_clicked";
g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
/*GtkTreeSelection *selection;
@@ -472,7 +417,7 @@ on_edit_button_clicked( GtkButton *button, gpointer user_data )
static void
on_duplicate_button_clicked( GtkButton *button, gpointer user_data )
{
- static const gchar *thisfn = "nact_wnd_actions_on_duplicate_button_clicked";
+ static const gchar *thisfn = "nact_main_window_on_duplicate_button_clicked";
g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
/*GtkTreeSelection *selection;
@@ -518,7 +463,7 @@ on_duplicate_button_clicked( GtkButton *button, gpointer user_data )
static void
on_delete_button_clicked( GtkButton *button, gpointer user_data )
{
- static const gchar *thisfn = "nact_wnd_actions_on_delete_button_clicked";
+ static const gchar *thisfn = "nact_main_window_on_delete_button_clicked";
g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
/*GtkTreeSelection *selection;
@@ -544,7 +489,7 @@ on_delete_button_clicked( GtkButton *button, gpointer user_data )
static void
on_import_export_button_clicked( GtkButton *button, gpointer user_data )
{
- static const gchar *thisfn = "nact_wnd_actions_on_import_export_button_clicked";
+ static const gchar *thisfn = "nact_main_window_on_import_export_button_clicked";
g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
/*GtkWidget *nact_actions_list;
@@ -557,12 +502,13 @@ on_import_export_button_clicked( GtkButton *button, gpointer user_data )
}
static void
-on_dialog_response( GtkDialog *dialog, gint response_id, gpointer user_data )
+on_dialog_response( GtkDialog *dialog, gint response_id, BaseWindow *window )
{
- GtkWidget *about_dialog;
- 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);*/
- g_debug( "dialog_response_cb: response_id=%d", response_id );
switch( response_id ){
case GTK_RESPONSE_NONE:
@@ -577,21 +523,19 @@ on_dialog_response( GtkDialog *dialog, gint response_id, gpointer user_data )
nact_prefs_save_preferences ();
*/
- window = BASE_WINDOW( g_object_get_data( G_OBJECT( dialog ), "base-window" ));
g_object_unref( window );
/*gtk_widget_destroy (GTK_WIDGET (dialog));
nact_destroy_glade_objects ();
gtk_main_quit ();*/
break;
-
- case GTK_RESPONSE_HELP:
-#if((( GTK_MAJOR_VERSION == 2 ) && ( GTK_MINOR_VERSION >= 6 )) || ( GTK_MAJOR_VERSION > 2 ))
- about_dialog = nact_get_glade_widget_from ("AboutDialog", GLADE_ABOUT_DIALOG_WIDGET);
- gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (about_dialog), PACKAGE_VERSION);
- gtk_about_dialog_set_logo_icon_name (GTK_ABOUT_DIALOG (about_dialog), "nautilus-actions");
- gtk_dialog_run (GTK_DIALOG (about_dialog));
- gtk_widget_hide (about_dialog);
-#endif
- break;
}
}
+
+/*static gint
+count_actions( BaseWindow *window )
+{
+ NactApplication *appli = NACT_APPLICATION( base_window_get_application( window ));
+ NAPivot *pivot = NA_PIVOT( nact_application_get_pivot( appli ));
+ GSList *actions = na_pivot_get_actions( pivot );
+ return( g_slist_length( actions ));
+}*/
diff --git a/src/nact/nact-wnd-actions.h b/src/nact/nact-main-window.h
similarity index 56%
rename from src/nact/nact-wnd-actions.h
rename to src/nact/nact-main-window.h
index e39efcd..c78734e 100644
--- a/src/nact/nact-wnd-actions.h
+++ b/src/nact/nact-main-window.h
@@ -28,11 +28,11 @@
* ... and many others (see AUTHORS)
*/
-#ifndef __NACT_WND_ACTIONS_H__
-#define __NACT_WND_ACTIONS_H__
+#ifndef __NACT_MAIN_WINDOW_H__
+#define __NACT_MAIN_WINDOW_H__
/*
- * NactWndActions class definition.
+ * NactMainWindow class definition.
*
* This class is derived from NactWindow.
* It encapsulates the "ActionsDialog" window.
@@ -42,33 +42,33 @@
G_BEGIN_DECLS
-#define NACT_WND_ACTIONS_TYPE ( nact_wnd_actions_get_type())
-#define NACT_WND_ACTIONS( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_WND_ACTIONS_TYPE, NactWndActions ))
-#define NACT_WND_ACTIONS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_WND_ACTIONS_TYPE, NactWndActionsClass ))
-#define NACT_IS_WND_ACTIONS( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_WND_ACTIONS_TYPE ))
-#define NACT_IS_WND_ACTIONS_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_WND_ACTIONS_TYPE ))
-#define NACT_WND_ACTIONS_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_WND_ACTIONS_TYPE, NactWndActionsClass ))
+#define NACT_MAIN_WINDOW_TYPE ( nact_main_window_get_type())
+#define NACT_MAIN_WINDOW( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_MAIN_WINDOW_TYPE, NactMainWindow ))
+#define NACT_MAIN_WINDOW_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_MAIN_WINDOW_TYPE, NactMainWindowClass ))
+#define NACT_IS_MAIN_WINDOW( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_MAIN_WINDOW_TYPE ))
+#define NACT_IS_MAIN_WINDOW_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_MAIN_WINDOW_TYPE ))
+#define NACT_MAIN_WINDOW_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_MAIN_WINDOW_TYPE, NactMainWindowClass ))
-typedef struct NactWndActionsPrivate NactWndActionsPrivate;
+typedef struct NactMainWindowPrivate NactMainWindowPrivate;
typedef struct {
NactWindow parent;
- NactWndActionsPrivate *private;
+ NactMainWindowPrivate *private;
}
- NactWndActions;
+ NactMainWindow;
-typedef struct NactWndActionsClassPrivate NactWndActionsClassPrivate;
+typedef struct NactMainWindowClassPrivate NactMainWindowClassPrivate;
typedef struct {
NactWindowClass parent;
- NactWndActionsClassPrivate *private;
+ NactMainWindowClassPrivate *private;
}
- NactWndActionsClass;
+ NactMainWindowClass;
-GType nact_wnd_actions_get_type( void );
+GType nact_main_window_get_type( void );
-NactWndActions *nact_wnd_actions_new( GObject *application );
+NactMainWindow *nact_main_window_new( GObject *application );
G_END_DECLS
-#endif /* __NACT_WND_ACTIONS_H__ */
+#endif /* __NACT_MAIN_WINDOW_H__ */
diff --git a/src/nact/nact-main.c b/src/nact/nact-main.c
index 30c7ac4..d746064 100644
--- a/src/nact/nact-main.c
+++ b/src/nact/nact-main.c
@@ -36,6 +36,8 @@
#include "nact-application.h"
+#include <glade/glade-xml.h>
+
int
main( int argc, char *argv[] )
{
diff --git a/src/nact/nact-profile-editor.c b/src/nact/nact-profile-editor.c
index c26817f..d052ebd 100644
--- a/src/nact/nact-profile-editor.c
+++ b/src/nact/nact-profile-editor.c
@@ -38,7 +38,7 @@
#include "nact-profile-editor.h"
#include "nact-utils.h"
#include "nact-prefs.h"
-#include "nact.h"
+#include "old-nact.h"
/* gui callback functions */
void profile_field_changed_cb (GObject *object, gpointer user_data);
diff --git a/src/nact/nact-window.c b/src/nact/nact-window.c
index 60cf88f..ad7986d 100644
--- a/src/nact/nact-window.c
+++ b/src/nact/nact-window.c
@@ -34,9 +34,10 @@
#include <glib.h>
-#include "nact-window.h"
+#include <common/na-pivot.h>
-#define GLADE_FILE GLADEDIR "/nautilus-actions-config.glade"
+#include "nact-application.h"
+#include "nact-window.h"
/* private class data
*/
@@ -46,21 +47,16 @@ struct NactWindowClassPrivate {
/* private instance data
*/
struct NactWindowPrivate {
- gboolean dispose_has_run;
+ gboolean dispose_has_run;
};
static GObjectClass *st_parent_class = NULL;
-static GType register_type( void );
-static void class_init( NactWindowClass *klass );
-static void instance_init( GTypeInstance *instance, gpointer klass );
-/*static void instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec );
-static void instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec );*/
-static void instance_dispose( GObject *application );
-static void instance_finalize( GObject *application );
-
-static void init_window( BaseWindow *window );
-static gchar *get_glade_file( BaseWindow *window );
+static GType register_type( void );
+static void class_init( NactWindowClass *klass );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *application );
+static void instance_finalize( GObject *application );
GType
nact_window_get_type( void )
@@ -108,14 +104,8 @@ class_init( NactWindowClass *klass )
GObjectClass *object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
- /*object_class->get_property = instance_get_property;
- object_class->set_property = instance_set_property;*/
klass->private = g_new0( NactWindowClassPrivate, 1 );
-
- BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
- base_class->init_window = init_window;
- base_class->get_glade_file = get_glade_file;
}
static void
@@ -132,91 +122,6 @@ instance_init( GTypeInstance *instance, gpointer klass )
self->private->dispose_has_run = FALSE;
}
-/*static void
-instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
-{
- g_assert( NACT_IS_WINDOW( object ));
- NactWindow *self = NACT_WINDOW( object );
-
- switch( property_id ){
- case PROP_ARGC:
- g_value_set_int( value, self->private->argc );
- break;
-
- case PROP_ARGV:
- g_value_set_pointer( value, self->private->argv );
- break;
-
- case PROP_UNIQUE_NAME:
- g_value_set_string( value, self->private->unique_name );
- break;
-
- case PROP_UNIQUE_APP:
- g_value_set_pointer( value, self->private->unique_app );
- break;
-
- case PROP_MAIN_WINDOW:
- g_value_set_pointer( value, self->private->main_window );
- break;
-
- case PROP_DLG_NAME:
- g_value_set_string( value, self->private->application_name );
- break;
-
- case PROP_ICON_NAME:
- g_value_set_string( value, self->private->icon_name );
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
- break;
- }
-}
-
-static void
-instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
-{
- g_assert( NACT_IS_WINDOW( object ));
- NactWindow *self = NACT_WINDOW( object );
-
- switch( property_id ){
- case PROP_ARGC:
- self->private->argc = g_value_get_int( value );
- break;
-
- case PROP_ARGV:
- self->private->argv = g_value_get_pointer( value );
- break;
-
- case PROP_UNIQUE_NAME:
- g_free( self->private->unique_name );
- self->private->unique_name = g_value_dup_string( value );
- break;
-
- case PROP_UNIQUE_APP:
- self->private->unique_app = g_value_get_pointer( value );
- break;
-
- case PROP_MAIN_WINDOW:
- self->private->main_window = g_value_get_pointer( value );
- break;
-
- case PROP_DLG_NAME:
- g_free( self->private->application_name );
- self->private->application_name = g_value_dup_string( value );
- break;
-
- case PROP_ICON_NAME:
- g_free( self->private->icon_name );
- self->private->icon_name = g_value_dup_string( value );
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID( object, property_id, spec );
- break;
- }
-}*/
-
static void
instance_dispose( GObject *window )
{
@@ -242,7 +147,9 @@ instance_finalize( GObject *window )
g_debug( "%s: window=%p", thisfn, window );
g_assert( NACT_IS_WINDOW( window ));
- /*NactWindow *self = ( NactWindow * ) window;*/
+ NactWindow *self = ( NactWindow * ) window;
+
+ g_free( self->private );
/* chain call to parent class */
if( st_parent_class->finalize ){
@@ -250,14 +157,19 @@ instance_finalize( GObject *window )
}
}
-static void
-init_window( BaseWindow *window )
+/**
+ * Returns a pointer to the list of actions.
+ */
+GSList *
+nact_window_get_actions( NactWindow *window )
{
- /* do nothing */
-}
+ NactApplication *application;
+ g_object_get( G_OBJECT( window ), PROP_WINDOW_APPLICATION_STR, &application, NULL );
+ g_return_val_if_fail( NACT_IS_APPLICATION( application ), NULL );
-static gchar *
-get_glade_file( BaseWindow *window )
-{
- return( g_strdup( GLADE_FILE ));
+ NAPivot *pivot = NA_PIVOT( nact_application_get_pivot( application ));
+ g_return_val_if_fail( NA_IS_PIVOT( pivot ), NULL );
+
+ GSList *actions = na_pivot_get_actions( pivot );
+ return( actions );
}
diff --git a/src/nact/nact-window.h b/src/nact/nact-window.h
index 3e3bf98..a3cd8f8 100644
--- a/src/nact/nact-window.h
+++ b/src/nact/nact-window.h
@@ -35,7 +35,7 @@
* NactWindow class definition.
*
* This class is derived from BaseWindow class.
- * It is a common base class for Nautilus Actions windows.
+ * It is a common base class for all Nautilus Actions window documents.
*/
#include "base-window.h"
@@ -65,7 +65,9 @@ typedef struct {
}
NactWindowClass;
-GType nact_window_get_type( void );
+GType nact_window_get_type( void );
+
+GSList *nact_window_get_actions( NactWindow *window );
G_END_DECLS
diff --git a/src/nact/nautilus-actions-config.ui b/src/nact/nautilus-actions-config.ui
new file mode 100644
index 0000000..4e788aa
--- /dev/null
+++ b/src/nact/nautilus-actions-config.ui
@@ -0,0 +1,1038 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkDialog" id="ActionsDialog">
+ <property name="title" translatable="yes">Nautilus Actions</property>
+ <property name="window_position">center</property>
+ <property name="default_width">300</property>
+ <property name="default_height">350</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox3">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkHBox" id="hbox20">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="spacing">6</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</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="GtkVButtonBox" id="vbuttonbox1">
+ <property name="visible">True</property>
+ <property name="spacing">3</property>
+ <property name="layout_style">start</property>
+ <child>
+ <object class="GtkButton" id="AddActionButton">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="EditActionButton">
+ <property name="label">gtk-edit</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="DuplicateActionButton">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Create a copy of the selected action.</property>
+ <child>
+ <object class="GtkAlignment" id="alignment14">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox51">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image21">
+ <property name="visible">True</property>
+ <property name="stock">gtk-copy</property>
+ <property name="icon-size">4</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label141">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Duplicate</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="DeleteActionButton">
+ <property name="label">gtk-delete</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Delete the action without any confirmation nor the possibility to restore it.</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="ImExportButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Manage importation of external action configurations and exportation of existing actions.</property>
+ <child>
+ <object class="GtkAlignment" id="alignment13">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox50">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image20">
+ <property name="visible">True</property>
+ <property name="stock">gtk-convert</property>
+ <property name="icon-size">4</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label140">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Import/Export</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">6</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area3">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="AboutButton">
+ <property name="label">gtk-about</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="closebutton2">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-11">AboutButton</action-widget>
+ <action-widget response="-7">closebutton2</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="EditActionDialogExt">
+ <property name="width_request">500</property>
+ <property name="height_request">430</property>
+ <property name="title" translatable="yes">Nautilus Action Editor</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-always</property>
+ <property name="default_width">400</property>
+ <property name="default_height">430</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox4">
+ <property name="width_request">500</property>
+ <property name="height_request">430</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkNotebook" id="notebook2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">6</property>
+ <child>
+ <object class="GtkVBox" id="vbox399">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="label159">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Nautilus Menu Item</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table3">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="MenuTooltipEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Tooltip of the menu item that will appear in the Nautilus statusbar.</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox63">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="IconImage"/>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxEntry" id="MenuIconComboBoxEntry">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="IconBrowseButton">
+ <property name="label" translatable="yes">_Browse</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Click to choose a custom icon from a file instead of a predefined icon from the drop-down list.</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="action_icon_browse_button_clicked_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="LabelAlign3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Icon:</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="LabelAlign2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Tooltip:</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="LabelAlign1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Label:</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="MenuLabelEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Label of the menu item in the Nautilus popup menu.</property>
+ <signal name="changed" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label40">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Action</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox396">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox32">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="LabelAlign4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Path:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="CommandPathEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">The command that will be launched by selecting the action in Nautilus popup menu.</property>
+ <property name="width_chars">10</property>
+ <signal name="changed" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="PathBrowseButton">
+ <property name="label" translatable="yes">_Browse</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Click to choose a command from the file chooser dialog.</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="action_path_browse_button_clicked_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox33">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="LabelAlign5">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Parameters:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="CommandParamsEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Parameters that will be sent to the program. Click on the 'Legend' button to see the different replacement tokens.</property>
+ <property name="width_chars">10</property>
+ <signal name="changed" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="LegendButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Click to toggle the display of the list of special tokens you can use in the parameter field.</property>
+ <signal name="toggled" handler="action_legend_button_toggled_cb"/>
+ <child>
+ <object class="GtkAlignment" id="alignment16">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkHBox" id="hbox62">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image25">
+ <property name="visible">True</property>
+ <property name="stock">gtk-help</property>
+ <property name="icon-size">4</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label158">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Legend</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox46">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="LabelAlign6">
+ <property name="visible">True</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="LabelExample">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><i><b><span size="small">e.g., %s</span></b></i></property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label134">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Action</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox394">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="aaaLabelAlign7">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Appears if file matches</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox398">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox52">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="CLabelAlign1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Filenames:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="PatternEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A string with wildcards (? or *) that will be used to match the filenames. You can set several filename patterns by separating them with a semi-colon (;).</property>
+ <property name="text">*</property>
+ <signal name="changed" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox54">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label146">
+ <property name="visible">True</property>
+ <property name="label"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="MatchCaseButton">
+ <property name="label" translatable="yes">Match case</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">If selected, the filename patterns will be matched case sensitive (eg, *.jpg will not match photo.JPG)</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox53">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="CLabelAlign2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Mimetypes:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="MimeTypeEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">A string with wildcards (? or *) that will be used to match the mimetypes of files. You can set several mimetype patterns by separating them with a semi-colon (;).</property>
+ <property name="text">*/*</property>
+ <signal name="changed" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label45">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Appears if selection contains</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox21">
+ <property name="visible">True</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <object class="GtkRadioButton" id="OnlyFilesButton">
+ <property name="label" translatable="yes">Only files</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="OnlyFoldersButton">
+ <property name="label" translatable="yes">Only folders</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">OnlyFilesButton</property>
+ <signal name="toggled" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="BothButton">
+ <property name="label" translatable="yes">Both</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">OnlyFilesButton</property>
+ <signal name="toggled" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="AcceptMultipleButton">
+ <property name="label" translatable="yes">Appears if selection has multiple files or folders</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="action_field_changed_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label135">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Conditions</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox340">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label46">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Appears if scheme is in this list</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox38">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="SchemesTreeView">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Select the kind of files where you want your action to appear. If you don't know what to choose, try selecting just 'file' which is the most common choice. You can add a new scheme by clicking on the '+' button.</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox345">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkButton" id="button7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Click to add a new scheme.</property>
+ <signal name="clicked" handler="action_add_scheme_clicked"/>
+ <child>
+ <object class="GtkImage" id="image16">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ <property name="icon-size">4</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="RemoveSchemeButton">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Click to remove the selected scheme.</property>
+ <signal name="clicked" handler="action_remove_scheme_clicked"/>
+ <child>
+ <object class="GtkImage" id="image17">
+ <property name="visible">True</property>
+ <property name="stock">gtk-remove</property>
+ <property name="icon-size">4</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label142">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Advanced Conditions</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">6</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area4">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="cancelbutton1">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="okbutton1">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">cancelbutton1</action-widget>
+ <action-widget response="-5">okbutton1</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/src/plugin/nautilus-actions.c b/src/plugin/nautilus-actions.c
index 9bca418..74777db 100644
--- a/src/plugin/nautilus-actions.c
+++ b/src/plugin/nautilus-actions.c
@@ -233,7 +233,9 @@ instance_finalize( GObject *object )
g_debug( "%s: object=%p", thisfn, object );
g_assert( NAUTILUS_IS_ACTIONS( object ));
- /*NautilusActions* self = NAUTILUS_ACTIONS (obj);*/
+ NautilusActions* self = NAUTILUS_ACTIONS( object );
+
+ g_free( self->private );
/* chain up to the parent class */
G_OBJECT_CLASS( st_parent_class )->finalize( object );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]