[nautilus-actions] Compiling with '-pedantic' gcc option
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Compiling with '-pedantic' gcc option
- Date: Mon, 24 Aug 2009 21:30:56 +0000 (UTC)
commit 7b82bb5805c15fff696a707c7f2bd83dc9f66980
Author: Pierre Wieser <pwieser trychlos org>
Date: Mon Aug 24 23:33:55 2009 +0200
Compiling with '-pedantic' gcc option
Fix na-compiler-flags.m4 macro to correctly handle provided default values.
make distcheck now defaults to compile with '--enable-iso-c' configure option.
ChangeLog | 53 ++++++
Makefile.am | 4 +-
NEWS | 2 +
configure.ac | 2 +-
m4/na-compiler-flags.m4 | 12 +-
src/common/na-about.c | 11 +-
src/common/na-action-profile.c | 134 +++++++++-----
src/common/na-action.c | 157 ++++++++++------
src/common/na-gconf.c | 236 ++++++++++++++----------
src/common/na-iduplicable.c | 29 ++--
src/common/na-iio-provider.c | 53 +++---
src/common/na-iio-provider.h | 2 +-
src/common/na-ipivot-consumer.c | 18 ++-
src/common/na-iprefs.c | 21 ++-
src/common/na-object.c | 59 ++++--
src/common/na-pivot.c | 77 +++++---
src/common/na-utils.c | 2 +-
src/common/na-xml-names.h | 76 ++++++--
src/common/na-xml-writer.c | 222 ++++++++++++++--------
src/nact/base-application.c | 136 +++++++++-----
src/nact/base-window.c | 89 ++++++---
src/nact/nact-application.c | 72 +++++---
src/nact/nact-assistant-export.c | 293 +++++++++++++++++------------
src/nact/nact-assistant-import.c | 205 +++++++++++++--------
src/nact/nact-assistant.c | 135 ++++++++------
src/nact/nact-iaction-tab.c | 160 ++++++++++------
src/nact/nact-iactions-list.c | 251 +++++++++++++++----------
src/nact/nact-iadvanced-tab.c | 175 ++++++++++--------
src/nact/nact-icommand-tab.c | 125 ++++++++-----
src/nact/nact-iconditions-tab.c | 149 ++++++++++-----
src/nact/nact-imenubar.c | 198 ++++++++++++--------
src/nact/nact-iprefs.c | 64 +++++--
src/nact/nact-main-window.c | 340 +++++++++++-----------------------
src/nact/nact-preferences-editor.c | 81 +++++---
src/nact/nact-window.c | 98 ++++++-----
src/nact/nact-xml-reader.c | 151 ++++++++++------
src/plugin/nautilus-actions.c | 97 ++++++-----
src/plugin/nautilus-module.c | 11 +-
src/test/test-parse-uris.c | 3 +-
src/utils/nautilus-actions-new.c | 42 +++--
src/utils/nautilus-actions-schemas.c | 22 ++-
41 files changed, 2452 insertions(+), 1615 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 065b7a2..aa44dc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,56 @@
+2009-08-24 Pierre Wieser <pwieser trychlos org>
+
+ * Makefile.am:
+ make distcheck uses now '--enable-iso-c' option.
+
+ * configure.ac:
+ Add '-pedantic' as '--enable-iso-c' default option.
+ Add also '-Wno-overlength-strings' to handle long strings in
+ src/common/xml-names.h.
+
+ * m4/na-compiler-flags.m4:
+ Fix '--enable-iso-c' macro to correctly handle provided values.
+
+ * src/common/na-about.c:
+ * src/common/na-action-profile.c:
+ * src/common/na-action.c:
+ * src/common/na-gconf.c:
+ * src/common/na-iduplicable.c:
+ * src/common/na-iio-provider.c:
+ * src/common/na-iio-provider.h:
+ * src/common/na-ipivot-consumer.c:
+ * src/common/na-iprefs.c:
+ * src/common/na-object.c:
+ * src/common/na-pivot.c:
+ * src/common/na-utils.c:
+ * src/common/na-xml-writer.c:
+ * src/nact/base-application.c:
+ * src/nact/base-window.c:
+ * src/nact/nact-application.c:
+ * src/nact/nact-assistant-export.c:
+ * src/nact/nact-assistant-import.c:
+ * src/nact/nact-assistant.c:
+ * src/nact/nact-iaction-tab.c:
+ * src/nact/nact-iactions-list.c:
+ * src/nact/nact-iadvanced-tab.c:
+ * src/nact/nact-icommand-tab.c:
+ * src/nact/nact-iconditions-tab.c:
+ * src/nact/nact-imenubar.c:
+ * src/nact/nact-iprefs.c:
+ * src/nact/nact-main-window.c:
+ * src/nact/nact-preferences-editor.c:
+ * src/nact/nact-window.c:
+ * src/nact/nact-xml-reader.c:
+ * src/plugin/nautilus-actions.c:
+ * src/plugin/nautilus-module.c:
+ * src/test/test-parse-uris.c:
+ * src/utils/nautilus-actions-new.c:
+ * src/utils/nautilus-actions-schemas.c:
+ Compile with -pedantic gcc option.
+
+ * src/common/na-xml-names.h:
+ Long names are rewritten on several lines for more readability.
+
2009-08-23 Pierre Wieser <pwieser trychlos org>
Get rid of unwanted notifications.
diff --git a/Makefile.am b/Makefile.am
index b6d4092..32b4216 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -44,7 +44,9 @@ DISTCHECK_CONFIGURE_FLAGS = \
# do not try to install schemas when making distcheck
DISTCHECK_CONFIGURE_FLAGS += \
- --disable-schemas-install
+ --disable-schemas-install \
+ --enable-iso-c \
+ $(NULL)
EXTRA_DIST = \
intltool-extract.in \
diff --git a/NEWS b/NEWS
index 3978530..306004d 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ Version xxxxxx
Use Gtk+ UI Manager.
+ Whole program is now compiled with '-pedantic' option.
+
New and updated translations
Version 1.12.0
diff --git a/configure.ac b/configure.ac
index a36b1f0..18c4706 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,7 +79,7 @@ AC_PROG_MAKE_SET
# Gnome stuff
GNOME_COMMON_INIT
GNOME_MAINTAINER_MODE_DEFINES
-NA_GNOME_COMPILE_WARNINGS([error],[-ansi])
+NA_GNOME_COMPILE_WARNINGS([error],[-ansi -pedantic -Wno-overlength-strings])
AC_SUBST([AM_CPPFLAGS],["${AM_CPPFLAGS} ${DISABLE_DEPRECATED}"])
# unique 1.0.8 doesn't satisfy this
#AC_SUBST([AM_CPPFLAGS],["${AM_CPPFLAGS} \
diff --git a/m4/na-compiler-flags.m4 b/m4/na-compiler-flags.m4
index 42d92e8..f65751b 100644
--- a/m4/na-compiler-flags.m4
+++ b/m4/na-compiler-flags.m4
@@ -2,7 +2,7 @@ dnl GNOME_COMPILE_WARNINGS
dnl Turn on many useful compiler warnings
dnl For now, only works on GCC
-# serial 2 change NACT_ prefix to NA_ (Nautilus Actions)
+# serial 3 Fix to correctly handle provided default values
#
# pwi 2009-05-15 shamelessly copied from gnome-compiler-flags.m4
@@ -12,7 +12,7 @@ dnl For now, only works on GCC
AC_DEFUN([NA_GNOME_COMPILE_WARNINGS],[
_ac_warning_def=m4_default([$1],[yes])
- _ac_compliant_def=m4_default([$2],[no])
+ _ac_compliant_def=m4_default(["$2"],[no])
dnl ******************************
dnl More compiler warnings
@@ -21,7 +21,7 @@ AC_DEFUN([NA_GNOME_COMPILE_WARNINGS],[
AC_ARG_ENABLE(compile-warnings,
AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],
[Turn on compiler warnings]),,
- [enable_compile_warnings=${_ac_warning_def}])
+ [enable_compile_warnings="${_ac_warning_def}"])
warnCFLAGS=
if test "x$GCC" != xyes; then
@@ -75,13 +75,13 @@ AC_DEFUN([NA_GNOME_COMPILE_WARNINGS],[
AC_ARG_ENABLE(iso-c,
AC_HELP_STRING([--enable-iso-c],
[Try to warn if code is not ISO C ]),,
- [enable_iso_c=${_ac_compliant_def}])
+ [enable_iso_c="${_ac_compliant_def}"])
AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
complCFLAGS=
if test "x$enable_iso_c" != "xno"; then
if test "x$GCC" = "xyes"; then
- if test "${enable_iso_c}" = "yes"; then
+ if test "x${_ac_compliant_def}" = "x"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) complCFLAGS="$complCFLAGS -ansi" ;;
@@ -91,7 +91,7 @@ AC_DEFUN([NA_GNOME_COMPILE_WARNINGS],[
*) complCFLAGS="$complCFLAGS -pedantic" ;;
esac
else
- complCFLAGS="$complCFLAGS ${enable_iso_c}"
+ complCFLAGS="$complCFLAGS ${_ac_compliant_def}"
fi
fi
fi
diff --git a/src/common/na-about.c b/src/common/na-about.c
index 903c71b..87c462f 100644
--- a/src/common/na-about.c
+++ b/src/common/na-about.c
@@ -50,9 +50,7 @@ void
na_about_display( GObject *toplevel )
{
static const gchar *thisfn = "na_about_display";
- g_debug( "%s: toplevel=%p", thisfn, toplevel );
-
- gchar *icon_name = na_about_get_icon_name();
+ gchar *icon_name, *license_i18n;
static const gchar *artists[] = {
N_( "Ulisse Perusin <uli peru gmail com>" ),
@@ -85,7 +83,12 @@ na_about_display( GObject *toplevel )
"MA 02110-1301, USA." ),
NULL
};
- gchar *license_i18n = g_strjoinv( "\n\n", license );
+
+ g_debug( "%s: toplevel=%p", thisfn, ( void * ) toplevel );
+
+ icon_name = na_about_get_icon_name();
+
+ license_i18n = g_strjoinv( "\n\n", license );
/*GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));*/
if( toplevel ){
diff --git a/src/common/na-action-profile.c b/src/common/na-action-profile.c
index ae0d785..3fab8bf 100644
--- a/src/common/na-action-profile.c
+++ b/src/common/na-action-profile.c
@@ -44,6 +44,7 @@
/* private class data
*/
struct NAActionProfileClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -133,7 +134,6 @@ static GType
register_type( void )
{
static const gchar *thisfn = "na_action_profile_register_type";
- g_debug( "%s", thisfn );
static GTypeInfo info = {
sizeof( NAActionProfileClass ),
@@ -147,6 +147,8 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
+ g_debug( "%s", thisfn );
+
return( g_type_register_static( NA_OBJECT_TYPE, "NAActionProfile", &info, 0 ));
}
@@ -154,17 +156,19 @@ static void
class_init( NAActionProfileClass *klass )
{
static const gchar *thisfn = "na_action_profile_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ GParamSpec *spec;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
object_class->set_property = instance_set_property;
object_class->get_property = instance_get_property;
- GParamSpec *spec;
spec = g_param_spec_pointer(
PROP_NAPROFILE_ACTION_STR,
"NAAction attachment",
@@ -264,8 +268,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
/*static const gchar *thisfn = "na_action_profile_instance_init";
g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );*/
+ NAActionProfile *self;
+
g_assert( NA_IS_ACTION_PROFILE( instance ));
- NAActionProfile* self = NA_ACTION_PROFILE( instance );
+ self = NA_ACTION_PROFILE( instance );
self->private = g_new0( NAActionProfilePrivate, 1 );
@@ -290,11 +296,12 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
- g_assert( NA_IS_ACTION_PROFILE( object ));
- NAActionProfile *self = NA_ACTION_PROFILE( object );
-
+ NAActionProfile *self;
GSList *list;
+ g_assert( NA_IS_ACTION_PROFILE( object ));
+ self = NA_ACTION_PROFILE( object );
+
switch( property_id ){
case PROP_NAPROFILE_ACTION:
g_value_set_pointer( value, self->private->action );
@@ -356,8 +363,10 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
static void
instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
+ NAActionProfile *self;
+
g_assert( NA_IS_ACTION_PROFILE( object ));
- NAActionProfile *self = NA_ACTION_PROFILE( object );
+ self = NA_ACTION_PROFILE( object );
switch( property_id ){
case PROP_NAPROFILE_ACTION:
@@ -423,10 +432,12 @@ static void
instance_dispose( GObject *object )
{
static const gchar *thisfn = "na_action_profile_instance_dispose";
- g_debug( "%s: object=%p", thisfn, object );
+ NAActionProfile *self;
+
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
g_assert( NA_IS_ACTION_PROFILE( object ));
- NAActionProfile *self = NA_ACTION_PROFILE( object );
+ self = NA_ACTION_PROFILE( object );
if( !self->private->dispose_has_run ){
@@ -441,10 +452,12 @@ static void
instance_finalize( GObject *object )
{
static const gchar *thisfn = "na_action_profile_instance_finalize";
- g_debug( "%s: object=%p", thisfn, object );
+ NAActionProfile *self;
+
+ g_debug( "%s: object=%p", thisfn, (void * ) object );
g_assert( NA_IS_ACTION_PROFILE( object ));
- NAActionProfile *self = ( NAActionProfile * ) object;
+ self = ( NAActionProfile * ) object;
g_free( self->private->path );
g_free( self->private->parameters );
@@ -495,9 +508,10 @@ na_action_profile_new( void )
NAAction *
na_action_profile_get_action( const NAActionProfile *profile )
{
+ NAAction *action;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- NAAction *action;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_ACTION_STR, &action, NULL );
return( action );
@@ -517,10 +531,12 @@ na_action_profile_get_action( const NAActionProfile *profile )
gchar *
na_action_profile_get_name( const NAActionProfile *profile )
{
+ gchar *id;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gchar *id;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_NAME_STR, &id, NULL );
+
return( id );
}
@@ -538,10 +554,12 @@ na_action_profile_get_name( const NAActionProfile *profile )
gchar *
na_action_profile_get_label( const NAActionProfile *profile )
{
+ gchar *label;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gchar *label;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_LABEL_STR, &label, NULL );
+
return( label );
}
@@ -557,9 +575,10 @@ na_action_profile_get_label( const NAActionProfile *profile )
gchar *
na_action_profile_get_path( const NAActionProfile *profile )
{
+ gchar *path;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gchar *path;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_PATH_STR, &path, NULL );
return( path );
@@ -577,9 +596,10 @@ na_action_profile_get_path( const NAActionProfile *profile )
gchar *
na_action_profile_get_parameters( const NAActionProfile *profile )
{
+ gchar *parameters;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gchar *parameters;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_PARAMETERS_STR, ¶meters, NULL );
return( parameters );
@@ -600,9 +620,10 @@ na_action_profile_get_parameters( const NAActionProfile *profile )
GSList *
na_action_profile_get_basenames( const NAActionProfile *profile )
{
+ GSList *basenames;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- GSList *basenames;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_BASENAMES_STR, &basenames, NULL );
return( basenames );
@@ -623,9 +644,10 @@ na_action_profile_get_basenames( const NAActionProfile *profile )
gboolean
na_action_profile_get_matchcase( const NAActionProfile *profile )
{
+ gboolean matchcase;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gboolean matchcase;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_MATCHCASE_STR, &matchcase, NULL );
return( matchcase );
@@ -646,9 +668,10 @@ na_action_profile_get_matchcase( const NAActionProfile *profile )
GSList *
na_action_profile_get_mimetypes( const NAActionProfile *profile )
{
+ GSList *mimetypes;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- GSList *mimetypes;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_MIMETYPES_STR, &mimetypes, NULL );
return( mimetypes );
@@ -668,9 +691,10 @@ na_action_profile_get_mimetypes( const NAActionProfile *profile )
gboolean
na_action_profile_get_is_file( const NAActionProfile *profile )
{
+ gboolean isfile;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gboolean isfile;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_ISFILE_STR, &isfile, NULL );
return( isfile );
@@ -690,9 +714,10 @@ na_action_profile_get_is_file( const NAActionProfile *profile )
gboolean
na_action_profile_get_is_dir( const NAActionProfile *profile )
{
+ gboolean isdir;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gboolean isdir;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_ISDIR_STR, &isdir, NULL );
return( isdir );
@@ -713,9 +738,10 @@ na_action_profile_get_is_dir( const NAActionProfile *profile )
gboolean
na_action_profile_get_multiple( const NAActionProfile *profile )
{
+ gboolean multiple;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gboolean multiple;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_ACCEPT_MULTIPLE_STR, &multiple, NULL );
return( multiple );
@@ -736,9 +762,10 @@ na_action_profile_get_multiple( const NAActionProfile *profile )
GSList *
na_action_profile_get_schemes( const NAActionProfile *profile )
{
+ GSList *schemes;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- GSList *schemes;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_SCHEMES_STR, &schemes, NULL );
return( schemes );
@@ -984,10 +1011,11 @@ void
na_action_profile_set_scheme( NAActionProfile *profile, const gchar *scheme, gboolean selected )
{
/*static const gchar *thisfn = "na_action_profile_set_scheme";*/
+ gboolean exist;
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gboolean exist = na_utils_find_in_list( profile->private->schemes, scheme );
+ exist = na_utils_find_in_list( profile->private->schemes, scheme );
/*g_debug( "%s: scheme=%s exist=%s", thisfn, scheme, exist ? "True":"False" );*/
if( selected && !exist ){
@@ -1036,8 +1064,6 @@ na_action_profile_set_schemes( NAActionProfile *profile, GSList *schemes )
gboolean
na_action_profile_is_candidate( const NAActionProfile *profile, GList* files )
{
- g_assert( NA_IS_ACTION_PROFILE( profile ));
-
gboolean retv = FALSE;
gboolean test_multiple_file = FALSE;
gboolean test_file_type = FALSE;
@@ -1057,6 +1083,9 @@ na_action_profile_is_candidate( const NAActionProfile *profile, GList* files )
guint mime_glob_ok_count = 0;
gboolean basename_match_ok = FALSE;
gboolean mimetype_match_ok = FALSE;
+ gchar *tmp_pattern, *tmp_filename, *tmp_filename2, *tmp_mimetype, *tmp_mimetype2;
+
+ g_assert( NA_IS_ACTION_PROFILE( profile ));
if (profile->private->basenames && profile->private->basenames->next != NULL &&
g_ascii_strcasecmp ((gchar*)(profile->private->basenames->data), "*") == 0)
@@ -1070,7 +1099,7 @@ na_action_profile_is_candidate( const NAActionProfile *profile, GList* files )
{
for (iter = profile->private->basenames; iter; iter = iter->next)
{
- gchar* tmp_pattern = (gchar*)iter->data;
+ tmp_pattern = (gchar*)iter->data;
if (!profile->private->match_case)
{
/* --> if case-insensitive asked, lower all the string
@@ -1108,11 +1137,11 @@ na_action_profile_is_candidate( const NAActionProfile *profile, GList* files )
for (iter1 = files; iter1; iter1 = iter1->next)
{
- gchar* tmp_filename = nautilus_file_info_get_name ((NautilusFileInfo *)iter1->data);
+ tmp_filename = nautilus_file_info_get_name ((NautilusFileInfo *)iter1->data);
if (tmp_filename)
{
- gchar* tmp_mimetype = nautilus_file_info_get_mime_type ((NautilusFileInfo *)iter1->data);
+ tmp_mimetype = nautilus_file_info_get_mime_type ((NautilusFileInfo *)iter1->data);
if (!profile->private->match_case)
{
@@ -1120,13 +1149,13 @@ na_action_profile_is_candidate( const NAActionProfile *profile, GList* files )
* since the pattern matching function don't manage it
* itself.
*/
- gchar* tmp_filename2 = g_ascii_strdown (tmp_filename, strlen (tmp_filename));
+ tmp_filename2 = g_ascii_strdown (tmp_filename, strlen (tmp_filename));
g_free (tmp_filename);
tmp_filename = tmp_filename2;
}
/* --> for the moment we deal with all mimetypes case-insensitively */
- gchar* tmp_mimetype2 = g_ascii_strdown (tmp_mimetype, strlen (tmp_mimetype));
+ tmp_mimetype2 = g_ascii_strdown (tmp_mimetype, strlen (tmp_mimetype));
g_free (tmp_mimetype);
tmp_mimetype = tmp_mimetype2;
@@ -1297,7 +1326,7 @@ na_action_profile_parse_parameters( const NAActionProfile *profile, GList* files
gchar *username = NULL;
gint port_number = 0;
GString *basename_list, *pathname_list, *uris_list;
- gchar *tmp;
+ gchar *tmp, *iter, *old_iter;
NAGnomeVFSURI *vfs;
g_return_val_if_fail( NA_IS_ACTION_PROFILE( profile ), NULL );
@@ -1350,8 +1379,8 @@ na_action_profile_parse_parameters( const NAActionProfile *profile, GList* files
g_free( iuri );
}
- gchar *iter = g_strdup( profile->private->parameters );
- gchar *old_iter = iter;
+ iter = g_strdup( profile->private->parameters );
+ old_iter = iter;
while(( iter = g_strstr_len( iter, strlen( iter ), "%" ))){
@@ -1455,15 +1484,16 @@ static void
object_dump( const NAObject *object )
{
static const gchar *thisfn = "na_action_profile_object_dump";
+ NAActionProfile *self;
g_assert( NA_IS_ACTION_PROFILE( object ));
- NAActionProfile *self = NA_ACTION_PROFILE( object );
+ self = NA_ACTION_PROFILE( object );
if( st_parent_class->dump ){
st_parent_class->dump( object );
}
- g_debug( "%s: action=%p", thisfn, self->private->action );
+ g_debug( "%s: action=%p", thisfn, ( void * ) self->private->action );
g_debug( "%s: path='%s'", thisfn, self->private->path );
g_debug( "%s: parameters='%s'", thisfn, self->private->parameters );
g_debug( "%s: accept_multiple='%s'", thisfn, self->private->accept_multiple ? "True" : "False" );
@@ -1486,9 +1516,11 @@ object_dump_list( const gchar *thisfn, const gchar *label, GSList *list )
static NAObject *
object_duplicate( const NAObject *profile )
{
+ NAObject *duplicate;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- NAObject *duplicate = NA_OBJECT( na_action_profile_new());
+ duplicate = NA_OBJECT( na_action_profile_new());
na_object_copy( duplicate, profile );
@@ -1498,13 +1530,13 @@ object_duplicate( const NAObject *profile )
static void
object_copy( NAObject *target, const NAObject *source )
{
- g_assert( NA_IS_ACTION_PROFILE( target ));
- g_assert( NA_IS_ACTION_PROFILE( source ));
-
gchar *path, *parameters;
gboolean matchcase, isfile, isdir, multiple;
GSList *basenames, *mimetypes, *schemes;
+ g_assert( NA_IS_ACTION_PROFILE( target ));
+ g_assert( NA_IS_ACTION_PROFILE( source ));
+
g_object_get( G_OBJECT( source ),
PROP_NAPROFILE_PATH_STR, &path,
PROP_NAPROFILE_PARAMETERS_STR, ¶meters,
@@ -1543,13 +1575,14 @@ object_copy( NAObject *target, const NAObject *source )
gboolean
object_are_equal( const NAObject *a, const NAObject *b )
{
- g_assert( NA_IS_ACTION_PROFILE( a ));
- g_assert( NA_IS_ACTION_PROFILE( b ));
-
NAActionProfile *first = NA_ACTION_PROFILE( a );
NAActionProfile *second = NA_ACTION_PROFILE( b );
+ gboolean equal;
- gboolean equal =
+ g_assert( NA_IS_ACTION_PROFILE( a ));
+ g_assert( NA_IS_ACTION_PROFILE( b ));
+
+ equal =
( g_utf8_collate( first->private->path, second->private->path ) == 0 ) &&
( g_utf8_collate( first->private->parameters, second->private->parameters ) == 0 );
@@ -1582,11 +1615,13 @@ object_are_equal( const NAObject *a, const NAObject *b )
gboolean
object_is_valid( const NAObject *profile )
{
+ gchar *label;
+ gboolean is_valid;
+
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gchar *label;
g_object_get( G_OBJECT( profile ), PROP_NAPROFILE_LABEL_STR, &label, NULL );
- gboolean is_valid = ( label && g_utf8_strlen( label, -1 ) > 0 );
+ is_valid = ( label && g_utf8_strlen( label, -1 ) > 0 );
g_free( label );
if( is_valid ){
@@ -1604,11 +1639,12 @@ validate_schemes( GSList* schemes2test, NautilusFileInfo* file )
int retv = 0;
GSList* iter;
gboolean found = FALSE;
+ gchar *scheme;
iter = schemes2test;
while (iter && !found)
{
- gchar* scheme = nautilus_file_info_get_uri_scheme (file);
+ scheme = nautilus_file_info_get_uri_scheme (file);
if (g_ascii_strncasecmp (scheme, (gchar*)iter->data, strlen ((gchar*)iter->data)) == 0)
{
diff --git a/src/common/na-action.c b/src/common/na-action.c
index 76afa0c..572a9e4 100644
--- a/src/common/na-action.c
+++ b/src/common/na-action.c
@@ -42,6 +42,7 @@
/* private class data
*/
struct NAActionClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -132,7 +133,6 @@ static GType
register_type( void )
{
static const gchar *thisfn = "na_action_register_type";
- g_debug( "%s", thisfn );
static GTypeInfo info = {
sizeof( NAActionClass ),
@@ -146,6 +146,8 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
+ g_debug( "%s", thisfn );
+
return( g_type_register_static( NA_OBJECT_TYPE, "NAAction", &info, 0 ));
}
@@ -153,17 +155,19 @@ static void
class_init( NAActionClass *klass )
{
static const gchar *thisfn = "na_action_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ GParamSpec *spec;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
object_class->set_property = instance_set_property;
object_class->get_property = instance_get_property;
- GParamSpec *spec;
spec = g_param_spec_string(
PROP_NAACTION_UUID_STR,
"Action UUID",
@@ -236,8 +240,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
/*static const gchar *thisfn = "na_action_instance_init";
g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );*/
+ NAAction *self;
+
g_assert( NA_IS_ACTION( instance ));
- NAAction* self = NA_ACTION( instance );
+ self = NA_ACTION( instance );
self->private = g_new0( NAActionPrivate, 1 );
@@ -256,8 +262,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
+ NAAction *self;
+
g_assert( NA_IS_ACTION( object ));
- NAAction *self = NA_ACTION( object );
+ self = NA_ACTION( object );
switch( property_id ){
case PROP_NAACTION_UUID:
@@ -301,8 +309,10 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
static void
instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
+ NAAction *self;
+
g_assert( NA_IS_ACTION( object ));
- NAAction *self = NA_ACTION( object );
+ self = NA_ACTION( object );
switch( property_id ){
case PROP_NAACTION_UUID:
@@ -350,10 +360,12 @@ static void
instance_dispose( GObject *object )
{
static const gchar *thisfn = "na_action_instance_dispose";
- g_debug( "%s: object=%p", thisfn, object );
+ NAAction *self;
+
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
g_assert( NA_IS_ACTION( object ));
- NAAction *self = NA_ACTION( object );
+ self = NA_ACTION( object );
if( !self->private->dispose_has_run ){
@@ -371,10 +383,12 @@ static void
instance_finalize( GObject *object )
{
static const gchar *thisfn = "na_action_instance_finalize";
- g_debug( "%s: object=%p", thisfn, object );
+ NAAction *self;
+
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
g_assert( NA_IS_ACTION( object ));
- NAAction *self = ( NAAction * ) object;
+ self = ( NAAction * ) object;
g_free( self->private->version );
g_free( self->private->tooltip );
@@ -401,7 +415,9 @@ instance_finalize( GObject *object )
NAAction *
na_action_new( void )
{
- NAAction *action = g_object_new( NA_ACTION_TYPE, NULL );
+ NAAction *action;
+
+ action = g_object_new( NA_ACTION_TYPE, NULL );
na_action_set_new_uuid( action );
@@ -421,9 +437,12 @@ na_action_new( void )
NAAction *
na_action_new_with_profile( void )
{
- NAAction *action = na_action_new();
+ NAAction *action;
+ NAActionProfile *profile;
+
+ action = na_action_new();
- NAActionProfile *profile = na_action_profile_new();
+ profile = na_action_profile_new();
na_action_attach_profile( action, profile );
@@ -444,9 +463,10 @@ na_action_new_with_profile( void )
gchar *
na_action_get_uuid( const NAAction *action )
{
+ gchar *id;
+
g_assert( NA_IS_ACTION( action ));
- gchar *id;
g_object_get( G_OBJECT( action ), PROP_NAACTION_UUID_STR, &id, NULL );
return( id );
@@ -466,9 +486,10 @@ na_action_get_uuid( const NAAction *action )
gchar *
na_action_get_label( const NAAction *action )
{
+ gchar *label;
+
g_assert( NA_IS_ACTION( action ));
- gchar *label;
g_object_get( G_OBJECT( action ), PROP_NAACTION_LABEL_STR, &label, NULL );
return( label );
@@ -489,9 +510,10 @@ na_action_get_label( const NAAction *action )
gchar *
na_action_get_version( const NAAction *action )
{
+ gchar *version;
+
g_assert( NA_IS_ACTION( action ));
- gchar *version;
g_object_get( G_OBJECT( action ), PROP_NAACTION_VERSION_STR, &version, NULL );
return( version );
@@ -510,9 +532,10 @@ na_action_get_version( const NAAction *action )
gchar *
na_action_get_tooltip( const NAAction *action )
{
+ gchar *tooltip;
+
g_assert( NA_IS_ACTION( action ));
- gchar *tooltip;
g_object_get( G_OBJECT( action ), PROP_NAACTION_TOOLTIP_STR, &tooltip, NULL );
return( tooltip );
@@ -531,9 +554,10 @@ na_action_get_tooltip( const NAAction *action )
gchar *
na_action_get_icon( const NAAction *action )
{
+ gchar *icon;
+
g_assert( NA_IS_ACTION( action ));
- gchar *icon;
g_object_get( G_OBJECT( action ), PROP_NAACTION_ICON_STR, &icon, NULL );
return( icon );
@@ -545,9 +569,10 @@ na_action_get_icon( const NAAction *action )
gchar *
na_action_get_verified_icon_name( const NAAction *action )
{
+ gchar *icon_name;
+
g_assert( NA_IS_ACTION( action ));
- gchar *icon_name;
g_object_get( G_OBJECT( action ), PROP_NAACTION_ICON_STR, &icon_name, NULL );
if( icon_name[0] == '/' ){
@@ -575,9 +600,10 @@ na_action_get_verified_icon_name( const NAAction *action )
gboolean
na_action_is_enabled( const NAAction *action )
{
+ gboolean enabled;
+
g_assert( NA_IS_ACTION( action ));
- gboolean enabled;
g_object_get( G_OBJECT( action ), PROP_NAACTION_ENABLED_STR, &enabled, NULL );
return( enabled );
@@ -596,9 +622,10 @@ na_action_is_enabled( const NAAction *action )
gboolean
na_action_is_readonly( const NAAction *action )
{
+ gboolean readonly;
+
g_assert( NA_IS_ACTION( action ));
- gboolean readonly;
g_object_get( G_OBJECT( action ), PROP_NAACTION_READONLY_STR, &readonly, NULL );
return( readonly );
@@ -620,9 +647,10 @@ na_action_is_readonly( const NAAction *action )
NAIIOProvider *
na_action_get_provider( const NAAction *action )
{
+ NAIIOProvider *provider;
+
g_assert( NA_IS_ACTION( action ));
- NAIIOProvider *provider;
g_object_get( G_OBJECT( action ), PROP_NAACTION_PROVIDER_STR, &provider, NULL );
return( provider );
@@ -637,10 +665,11 @@ na_action_get_provider( const NAAction *action )
void
na_action_set_new_uuid( NAAction *action )
{
- g_assert( NA_IS_ACTION( action ));
uuid_t uuid;
gchar uuid_str[64];
+ g_assert( NA_IS_ACTION( action ));
+
uuid_generate( uuid );
uuid_unparse_lower( uuid, uuid_str );
@@ -824,11 +853,12 @@ na_action_set_provider( NAAction *action, const NAIIOProvider *provider )
gchar *
na_action_get_new_profile_name( const NAAction *action )
{
- g_assert( NA_IS_ACTION( action ));
int i;
gboolean ok = FALSE;
gchar *candidate = NULL;
+ g_assert( NA_IS_ACTION( action ));
+
for( i=1 ; !ok ; ++i ){
g_free( candidate );
candidate = g_strdup_printf( "%s%d", ACTION_PROFILE_PREFIX, i );
@@ -836,10 +866,12 @@ na_action_get_new_profile_name( const NAAction *action )
ok = TRUE;
}
}
+
if( !ok ){
g_free( candidate );
candidate = NULL;
}
+
return( candidate );
}
@@ -859,13 +891,16 @@ na_action_get_new_profile_name( const NAAction *action )
NAActionProfile *
na_action_get_profile( const NAAction *action, const gchar *name )
{
- g_assert( NA_IS_ACTION( action ));
NAActionProfile *found = NULL;
GSList *ip;
+ NAActionProfile *iprofile;
+ gchar *iname;
+
+ g_assert( NA_IS_ACTION( action ));
for( ip = action->private->profiles ; ip && !found ; ip = ip->next ){
- NAActionProfile *iprofile = NA_ACTION_PROFILE( ip->data );
- gchar *iname = na_action_profile_get_name( iprofile );
+ iprofile = NA_ACTION_PROFILE( ip->data );
+ iname = na_action_profile_get_name( iprofile );
if( !strcmp( name, iname )){
found = iprofile;
}
@@ -942,13 +977,15 @@ na_action_get_profiles( const NAAction *action )
void
na_action_set_profiles( NAAction *action, GSList *list )
{
+ GSList *ip;
+ NAObject *new_profile;
+
g_assert( NA_IS_ACTION( action ));
free_profiles( action );
- GSList *ip;
for( ip = list ; ip ; ip = ip->next ){
- NAObject *new_profile = na_object_duplicate( NA_OBJECT( ip->data ));
+ new_profile = na_object_duplicate( NA_OBJECT( ip->data ));
na_action_attach_profile( action, NA_ACTION_PROFILE( new_profile ));
}
}
@@ -963,9 +1000,11 @@ void
na_action_free_profiles( GSList *list )
{
GSList *ip;
+
for( ip = list ; ip ; ip = ip->next ){
g_object_unref( NA_ACTION_PROFILE( ip->data ));
}
+
g_slist_free( list );
}
@@ -988,11 +1027,12 @@ na_action_get_profiles_count( const NAAction *action )
static void
object_check_edited_status( const NAObject *action )
{
+ GSList *ip;
+
if( st_parent_class->check_edited_status ){
st_parent_class->check_edited_status( action );
}
- GSList *ip;
for( ip = NA_ACTION( action )->private->profiles ; ip ; ip = ip->next ){
na_object_check_edited_status( NA_OBJECT( ip->data ));
}
@@ -1002,9 +1042,11 @@ static void
object_dump( const NAObject *action )
{
static const gchar *thisfn = "na_action_object_dump";
+ NAAction *self;
+ GSList *item;
g_assert( NA_IS_ACTION( action ));
- NAAction *self = NA_ACTION( action );
+ self = NA_ACTION( action );
if( st_parent_class->dump ){
st_parent_class->dump( action );
@@ -1015,11 +1057,10 @@ object_dump( const NAObject *action )
g_debug( "%s: icon='%s'", thisfn, self->private->icon );
g_debug( "%s: enabled='%s'", thisfn, self->private->enabled ? "True" : "False" );
g_debug( "%s: read-only='%s'", thisfn, self->private->read_only ? "True" : "False" );
- g_debug( "%s: provider=%p", thisfn, self->private->provider );
+ g_debug( "%s: provider=%p", thisfn, ( void * ) self->private->provider );
/* dump profiles */
- g_debug( "%s: %d profile(s) at %p", thisfn, na_action_get_profiles_count( self ), self->private->profiles );
- GSList *item;
+ g_debug( "%s: %d profile(s) at %p", thisfn, na_action_get_profiles_count( self ), ( void * ) self->private->profiles );
for( item = self->private->profiles ; item != NULL ; item = item->next ){
na_object_dump(( const NAObject * ) item->data );
}
@@ -1028,9 +1069,11 @@ object_dump( const NAObject *action )
static NAObject *
object_duplicate( const NAObject *action )
{
+ NAObject *duplicate;
+
g_assert( NA_IS_ACTION( action ));
- NAObject *duplicate = NA_OBJECT( na_action_new());
+ duplicate = NA_OBJECT( na_action_new());
na_object_copy( duplicate, action );
@@ -1040,12 +1083,14 @@ object_duplicate( const NAObject *action )
void
object_copy( NAObject *target, const NAObject *source )
{
- g_assert( NA_IS_ACTION( source ));
- g_assert( NA_IS_ACTION( target ));
-
gchar *version, *tooltip, *icon;
gboolean enabled, readonly;
gpointer provider;
+ GSList *ip;
+ NAActionProfile *profile;
+
+ g_assert( NA_IS_ACTION( source ));
+ g_assert( NA_IS_ACTION( target ));
g_object_get( G_OBJECT( source ),
PROP_NAACTION_VERSION_STR, &version,
@@ -1068,9 +1113,8 @@ object_copy( NAObject *target, const NAObject *source )
g_free( tooltip );
g_free( version );
- GSList *ip;
for( ip = NA_ACTION( source )->private->profiles ; ip ; ip = ip->next ){
- NAActionProfile *profile = NA_ACTION_PROFILE( na_object_duplicate( NA_OBJECT( ip->data )));
+ profile = NA_ACTION_PROFILE( na_object_duplicate( NA_OBJECT( ip->data )));
na_action_attach_profile( NA_ACTION( target ), profile );
}
@@ -1082,13 +1126,16 @@ object_copy( NAObject *target, const NAObject *source )
static gboolean
object_are_equal( const NAObject *a, const NAObject *b )
{
- g_assert( NA_IS_ACTION( a ));
- g_assert( NA_IS_ACTION( b ));
-
NAAction *first = NA_ACTION( a );
NAAction *second = NA_ACTION( b );
+ gboolean equal;
+ NAActionProfile *first_profile, *second_profile;
+ gchar *first_name, *second_name;
+
+ g_assert( NA_IS_ACTION( a ));
+ g_assert( NA_IS_ACTION( b ));
- gboolean equal =
+ equal =
( g_utf8_collate( first->private->version, second->private->version ) == 0 ) &&
( g_utf8_collate( first->private->tooltip, second->private->tooltip ) == 0 ) &&
( g_utf8_collate( first->private->icon, second->private->icon ) == 0 );
@@ -1103,9 +1150,9 @@ object_are_equal( const NAObject *a, const NAObject *b )
if( equal ){
GSList *ip;
for( ip = first->private->profiles ; ip && equal ; ip = ip->next ){
- NAActionProfile *first_profile = NA_ACTION_PROFILE( ip->data );
- gchar *first_name = na_action_profile_get_name( first_profile );
- NAActionProfile *second_profile = NA_ACTION_PROFILE( na_action_get_profile( second, first_name ));
+ first_profile = NA_ACTION_PROFILE( ip->data );
+ first_name = na_action_profile_get_name( first_profile );
+ second_profile = NA_ACTION_PROFILE( na_action_get_profile( second, first_name ));
if( second_profile ){
equal = na_object_are_equal( NA_OBJECT( first_profile ), NA_OBJECT( second_profile ));
} else {
@@ -1117,9 +1164,9 @@ object_are_equal( const NAObject *a, const NAObject *b )
if( equal ){
GSList *ip;
for( ip = second->private->profiles ; ip && equal ; ip = ip->next ){
- NAActionProfile *second_profile = NA_ACTION_PROFILE( ip->data );
- gchar *second_name = na_action_profile_get_name( second_profile );
- NAActionProfile *first_profile = NA_ACTION_PROFILE( na_action_get_profile( first, second_name ));
+ second_profile = NA_ACTION_PROFILE( ip->data );
+ second_name = na_action_profile_get_name( second_profile );
+ first_profile = NA_ACTION_PROFILE( na_action_get_profile( first, second_name ));
if( first_profile ){
equal = na_object_are_equal( NA_OBJECT( first_profile ), NA_OBJECT( second_profile ));
} else {
@@ -1140,14 +1187,16 @@ object_are_equal( const NAObject *a, const NAObject *b )
gboolean
object_is_valid( const NAObject *action )
{
+ gchar *label;
+ gboolean is_valid;
+ GSList *ip;
+
g_assert( NA_IS_ACTION( action ));
- gchar *label;
g_object_get( G_OBJECT( action ), PROP_NAACTION_LABEL_STR, &label, NULL );
- gboolean is_valid = ( label && g_utf8_strlen( label, -1 ) > 0 );
+ is_valid = ( label && g_utf8_strlen( label, -1 ) > 0 );
g_free( label );
- GSList *ip;
for( ip = NA_ACTION( action )->private->profiles ; ip && is_valid ; ip = ip->next ){
is_valid = na_object_is_valid( NA_OBJECT( ip->data ));
}
diff --git a/src/common/na-gconf.c b/src/common/na-gconf.c
index 70ed9c8..80656b1 100644
--- a/src/common/na-gconf.c
+++ b/src/common/na-gconf.c
@@ -46,6 +46,7 @@
/* private class data
*/
struct NAGConfClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -132,7 +133,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "na_gconf_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static GTypeInfo info = {
sizeof( NAGConfClass ),
@@ -146,16 +147,16 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( G_TYPE_OBJECT, "NAGConf", &info, 0 );
-
- /* implements IIOProvider interface
- */
static const GInterfaceInfo iio_provider_iface_info = {
( GInterfaceInitFunc ) iio_provider_iface_init,
NULL,
NULL
};
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_OBJECT, "NAGConf", &info, 0 );
+
g_type_add_interface_static( type, NA_IIO_PROVIDER_TYPE, &iio_provider_iface_info );
return( type );
@@ -165,17 +166,19 @@ static void
class_init( NAGConfClass *klass )
{
static const gchar *thisfn = "na_gconf_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ GParamSpec *spec;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
object_class->set_property = instance_set_property;
object_class->get_property = instance_get_property;
- GParamSpec *spec;
spec = g_param_spec_pointer(
PROP_NAGCONF_GCONF_STR,
"GConfClient object",
@@ -204,7 +207,8 @@ static void
iio_provider_iface_init( NAIIOProviderInterface *iface )
{
static const gchar *thisfn = "na_gconf_iio_provider_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->read_actions = iio_provider_read_actions;
iface->is_willing_to_write = iio_provider_is_willing_to_write;
@@ -217,10 +221,12 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "na_gconf_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NAGConf *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NA_IS_GCONF( instance ));
- NAGConf *self = NA_GCONF( instance );
+ self = NA_GCONF( instance );
self->private = g_new0( NAGConfPrivate, 1 );
@@ -232,8 +238,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
+ NAGConf *self;
+
g_assert( NA_IS_GCONF( object ));
- NAGConf *self = NA_GCONF( object );
+ self = NA_GCONF( object );
switch( property_id ){
case PROP_NAGCONF_GCONF:
@@ -257,8 +265,10 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
static void
instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
+ NAGConf *self;
+
g_assert( NA_IS_GCONF( object ));
- NAGConf *self = NA_GCONF( object );
+ self = NA_GCONF( object );
switch( property_id ){
case PROP_NAGCONF_GCONF:
@@ -282,8 +292,10 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
static void
instance_dispose( GObject *object )
{
+ NAGConf *self;
+
g_assert( NA_IS_GCONF( object ));
- NAGConf *self = NA_GCONF( object );
+ self = NA_GCONF( object );
if( !self->private->dispose_has_run ){
@@ -301,8 +313,10 @@ instance_dispose( GObject *object )
static void
instance_finalize( GObject *object )
{
+ NAGConf *self;
+
g_assert( NA_IS_GCONF( object ));
- NAGConf *self = NA_GCONF( object );
+ self = NA_GCONF( object );
g_free( self->private );
@@ -339,38 +353,28 @@ static GSList *
iio_provider_read_actions( const NAIIOProvider *provider )
{
static const gchar *thisfn = "nacf_gconf_iio_provider_read_actions";
- g_debug( "%s: provider=%p", thisfn, provider );
+ NAGConf *self;
+ GSList *items = NULL;
+ GSList *listpath, *ip;
+ NAAction *action;
+
+ g_debug( "%s: provider=%p", thisfn, ( void * ) provider );
g_assert( NA_IS_IIO_PROVIDER( provider ));
g_assert( NA_IS_GCONF( provider ));
- NAGConf *self = NA_GCONF( provider );
+ self = NA_GCONF( provider );
- GSList *items = NULL;
- GSList *ip;
- GSList *listpath = get_path_subdirs( self, NA_GCONF_CONFIG_PATH );
+ listpath = get_path_subdirs( self, NA_GCONF_CONFIG_PATH );
for( ip = listpath ; ip ; ip = ip->next ){
const gchar *path = ( const gchar * ) ip->data;
- NAAction *action = na_action_new();
+ action = na_action_new();
read_action( self, action, path );
items = g_slist_prepend( items, action );
-
- /*gchar *uuid = path_to_key( path );
-
- NAAction *action = na_action_new( uuid );
-
- if( load_action( self, action, path )){
- items = g_slist_prepend( items, action );
-
- } else {
- g_object_unref( action );
- }
-
- g_free( uuid );*/
}
na_utils_free_string_list( listpath );
@@ -396,11 +400,14 @@ static guint
iio_provider_write_action( const NAIIOProvider *provider, NAAction *action, gchar **message )
{
static const gchar *thisfn = "na_gconf_iio_provider_write_action";
- g_debug( "%s: provider=%p, action=%p, message=%p", thisfn, provider, action, message );
+ NAGConf *self;
+
+ g_debug( "%s: provider=%p, action=%p, message=%p",
+ thisfn, ( void * ) provider, ( void * ) action, ( void * ) message );
g_assert( NA_IS_IIO_PROVIDER( provider ));
g_assert( NA_IS_GCONF( provider ));
- NAGConf *self = NA_GCONF( provider );
+ self = NA_GCONF( provider );
message = NULL;
@@ -426,21 +433,26 @@ static guint
iio_provider_delete_action( const NAIIOProvider *provider, const NAAction *action, gchar **message )
{
static const gchar *thisfn = "na_gconf_iio_provider_delete_action";
- g_debug( "%s: provider=%p, action=%p, message=%p", thisfn, provider, action, message );
+ NAGConf *self;
+ guint ret;
+ gchar *uuid, *path;
+ GError *error = NULL;
+
+ g_debug( "%s: provider=%p, action=%p, message=%p",
+ thisfn, ( void * ) provider, ( void * ) action, ( void * ) message );
g_assert( NA_IS_IIO_PROVIDER( provider ));
g_assert( NA_IS_GCONF( provider ));
- NAGConf *self = NA_GCONF( provider );
+ self = NA_GCONF( provider );
message = NULL;
- guint ret = NA_IIO_PROVIDER_WRITE_OK;
+ ret = NA_IIO_PROVIDER_WRITE_OK;
g_assert( NA_IS_ACTION( action ));
- gchar *uuid = na_action_get_uuid( action );
+ uuid = na_action_get_uuid( action );
- GError *error = NULL;
- gchar *path = g_strdup_printf( "%s%s/%s", NA_GCONF_SCHEMA_PREFIX, NA_GCONF_CONFIG_PATH, uuid );
+ path = g_strdup_printf( "%s%s/%s", NA_GCONF_SCHEMA_PREFIX, NA_GCONF_CONFIG_PATH, uuid );
gconf_client_recursive_unset( self->private->gconf, path, 0, &error );
if( error ){
g_debug( "%s: error=%s for path=%s", thisfn, error->message, path );
@@ -488,28 +500,32 @@ static void
read_action( NAGConf *gconf, NAAction *action, const gchar *path )
{
static const gchar *thisfn = "na_gconf_read_action";
- g_debug( "%s: gconf=%p, action=%p, path=%s", thisfn, gconf, action, path );
+ gchar *uuid;
+ GSList *entries, *notifies, *list_profiles, *ip;
+ NAActionProfile *profile;
+
+ g_debug( "%s: gconf=%p, action=%p, path=%s",
+ thisfn, ( void * ) gconf, ( void * ) action, path );
g_assert( NA_IS_GCONF( gconf ));
g_assert( NA_IS_ACTION( action ));
- gchar *uuid = na_utils_path_to_key( path );
+ uuid = na_utils_path_to_key( path );
na_action_set_uuid( action, uuid );
g_free( uuid );
- GSList *entries = get_list_entries( gconf, path );
- GSList *notifies = entries_to_notifies( entries );
+ entries = get_list_entries( gconf, path );
+ notifies = entries_to_notifies( entries );
free_list_entries( entries );
fill_action_core_properties( gconf, action, notifies );
- GSList *ip;
- GSList *list_profiles = get_path_subdirs( gconf, path );
+ list_profiles = get_path_subdirs( gconf, path );
if( list_profiles ){
for( ip = list_profiles ; ip ; ip = ip->next ){
const gchar *profile_path = ( const gchar * ) ip->data;
- NAActionProfile *profile = na_action_profile_new();
+ profile = na_action_profile_new();
read_profile( gconf, profile, profile_path );
@@ -529,17 +545,21 @@ static void
read_profile( NAGConf *gconf, NAActionProfile *profile, const gchar *path )
{
static const gchar *thisfn = "na_gconf_read_profile";
- g_debug( "%s: gconf=%p, profile=%p, path=%s", thisfn, gconf, profile, path );
+ gchar *name;
+ GSList *entries, *notifies;
+
+ g_debug( "%s: gconf=%p, profile=%p, path=%s",
+ thisfn, ( void * ) gconf, ( void * ) profile, path );
g_assert( NA_IS_GCONF( gconf ));
g_assert( NA_IS_ACTION_PROFILE( profile ));
- gchar *name = na_utils_path_to_key( path );
+ name = na_utils_path_to_key( path );
na_action_profile_set_name( profile, name );
g_free( name );
- GSList *entries = get_list_entries( gconf, path );
- GSList *notifies = entries_to_notifies( entries );
+ entries = get_list_entries( gconf, path );
+ notifies = entries_to_notifies( entries );
free_list_entries( entries );
fill_profile_properties( gconf, profile, notifies );
@@ -555,10 +575,11 @@ static void
fill_action_core_properties( NAGConf *gconf, NAAction *action, GSList *notifies )
{
static const gchar *thisfn = "na_gconf_fill_action_properties";
+ gchar *label, *uuid, *version, *tooltip, *icon;
+ gboolean enabled;
- gchar *label;
if( !search_for_str( notifies, NULL, ACTION_LABEL_ENTRY, &label )){
- gchar *uuid = na_action_get_uuid( action );
+ uuid = na_action_get_uuid( action );
g_warning( "%s: no label found for action '%s'", thisfn, uuid );
g_free( uuid );
label = g_strdup( "" );
@@ -566,25 +587,21 @@ fill_action_core_properties( NAGConf *gconf, NAAction *action, GSList *notifies
na_action_set_label( action, label );
g_free( label );
- gchar *version;
if( search_for_str( notifies, NULL, ACTION_VERSION_ENTRY, &version )){
na_action_set_version( action, version );
g_free( version );
}
- gchar *tooltip;
if( search_for_str( notifies, NULL, ACTION_TOOLTIP_ENTRY, &tooltip )){
na_action_set_tooltip( action, tooltip );
g_free( tooltip );
}
- gchar *icon;
if( search_for_str( notifies, NULL, ACTION_ICON_ENTRY, &icon )){
na_action_set_icon( action, icon );
g_free( icon );
}
- gboolean enabled;
if( search_for_bool( notifies, NULL, ACTION_ENABLED_ENTRY, &enabled )){
na_action_set_enabled( action, enabled );
}
@@ -609,7 +626,10 @@ fill_action_v1_properties( NAGConf *gconf, NAAction *action, GSList *notifies )
static void
fill_profile_properties( NAGConf *gconf, NAActionProfile *profile, GSList *notifies )
{
- gchar *label;
+ gchar *label, *path, *parameters;
+ GSList *basenames, *schemes, *mimetypes;
+ gboolean isfile, isdir, multiple, matchcase;
+
if( !search_for_str( notifies, NULL, ACTION_PROFILE_LABEL_ENTRY, &label )){
/* i18n: default profile label */
label = g_strdup( NA_ACTION_PROFILE_DEFAULT_LABEL );
@@ -617,40 +637,33 @@ fill_profile_properties( NAGConf *gconf, NAActionProfile *profile, GSList *notif
na_action_profile_set_label( profile, label );
g_free( label );
- gchar *path;
if( search_for_str( notifies, NULL, ACTION_PATH_ENTRY, &path )){
na_action_profile_set_path( profile, path );
g_free( path );
}
- gchar *parameters;
if( search_for_str( notifies, NULL, ACTION_PARAMETERS_ENTRY, ¶meters )){
na_action_profile_set_parameters( profile, parameters );
g_free( parameters );
}
- GSList *basenames;
if( search_for_list( notifies, NULL, ACTION_BASENAMES_ENTRY, &basenames )){
na_action_profile_set_basenames( profile, basenames );
na_utils_free_string_list( basenames );
}
- gboolean isfile;
if( search_for_bool( notifies, NULL, ACTION_ISFILE_ENTRY, &isfile )){
na_action_profile_set_isfile( profile, isfile );
}
- gboolean isdir;
if( search_for_bool( notifies, NULL, ACTION_ISDIR_ENTRY, &isdir )){
na_action_profile_set_isdir( profile, isdir );
}
- gboolean multiple;
if( search_for_bool( notifies, NULL, ACTION_MULTIPLE_ENTRY, &multiple )){
na_action_profile_set_multiple( profile, multiple );
}
- GSList *schemes;
if( search_for_list( notifies, NULL, ACTION_SCHEMES_ENTRY, &schemes )){
na_action_profile_set_schemes( profile, schemes );
na_utils_free_string_list( schemes );
@@ -660,12 +673,10 @@ fill_profile_properties( NAGConf *gconf, NAActionProfile *profile, GSList *notif
* note that default values for 1.0 version have been set
* in na_action_profile_instance_init
*/
- gboolean matchcase;
if( search_for_bool( notifies, NULL, ACTION_MATCHCASE_ENTRY, &matchcase )){
na_action_profile_set_matchcase( profile, matchcase );
}
- GSList *mimetypes;
if( search_for_list( notifies, NULL, ACTION_MIMETYPES_ENTRY, &mimetypes )){
na_action_profile_set_mimetypes( profile, mimetypes );
na_utils_free_string_list( mimetypes );
@@ -680,9 +691,11 @@ static GSList *
get_path_subdirs( const NAGConf *gconf, const gchar *path )
{
static const gchar *thisfn = "na_gconf_get_path_subdirs";
-
GError *error = NULL;
- GSList *list = gconf_client_all_dirs( gconf->private->gconf, path, &error );
+ GSList *list;
+
+ list = gconf_client_all_dirs( gconf->private->gconf, path, &error );
+
if( error ){
g_warning( "%s: path=%s, error=%s", thisfn, path, error->message );
g_error_free( error );
@@ -703,9 +716,11 @@ static GSList *
get_list_entries( const NAGConf *gconf, const gchar *path )
{
static const gchar *thisfn = "na_gconf_get_list_values";
-
GError *error = NULL;
- GSList *list_path = gconf_client_all_entries( gconf->private->gconf, path, &error );
+ GSList *list_path;
+
+ list_path = gconf_client_all_entries( gconf->private->gconf, path, &error );
+
if( error ){
g_warning( "%s: path=%s, error=%s", thisfn, path, error->message );
g_error_free( error );
@@ -719,10 +734,12 @@ static void
free_list_entries( GSList *list )
{
GSList *item;
+
for( item = list ; item != NULL ; item = item->next ){
GConfEntry *entry = ( GConfEntry * ) item->data;
gconf_entry_unref( entry );
}
+
g_slist_free( list );
}
@@ -751,27 +768,35 @@ entry_to_notify( const GConfEntry *entry )
{
/*static const gchar *thisfn = "na_gconf_entry_to_notify";*/
GSList *listvalues, *iv, *strings;
+ NAPivotNotify *npn;
+ gchar **split;
+ const gchar *path;
+ const gchar *subpath;
+ const GConfValue *value;
g_assert( entry );
-
- const gchar *path = gconf_entry_get_key( entry );
+ path = gconf_entry_get_key( entry );
g_assert( path );
- NAPivotNotify *npn = g_new0( NAPivotNotify, 1 );
+ npn = g_new0( NAPivotNotify, 1 );
- const gchar *subpath = path + strlen( NA_GCONF_CONFIG_PATH ) + 1;
- gchar **split = g_strsplit( subpath, "/", -1 );
+ subpath = path + strlen( NA_GCONF_CONFIG_PATH ) + 1;
+ split = g_strsplit( subpath, "/", -1 );
/*g_debug( "%s: [0]=%s, [1]=%s", thisfn, split[0], split[1] );*/
npn->uuid = g_strdup( split[0] );
+
if( g_strv_length( split ) == 2 ){
npn->parm = g_strdup( split[1] );
+
} else if( g_strv_length( split ) == 3 ){
npn->profile = g_strdup( split[1] );
npn->parm = g_strdup( split[2] );
}
+
g_strfreev( split );
- const GConfValue *value = gconf_entry_get_value( entry );
+ value = gconf_entry_get_value( entry );
+
if( value ){
switch( value->type ){
@@ -814,11 +839,12 @@ entries_to_notifies( GSList *entries )
{
GSList *item;
GSList *notifies = NULL;
+ NAPivotNotify *npn;
for( item = entries ; item ; item = item->next ){
const GConfEntry *entry = ( const GConfEntry * ) item->data;
- NAPivotNotify *npn = entry_to_notify( entry );
+ npn = entry_to_notify( entry );
notifies = g_slist_prepend( notifies, npn );
}
@@ -829,6 +855,7 @@ static void
free_list_notifies( GSList *list )
{
GSList *il;
+
for( il = list ; il ; il = il->next ){
na_pivot_free_notify(( NAPivotNotify *) il->data );
}
@@ -837,10 +864,12 @@ free_list_notifies( GSList *list )
static gboolean
search_for_str( GSList *properties, const gchar *profile, const gchar *key, gchar **value )
{
- *value = NULL;
GSList *ip;
+ NAPivotNotify *npn;
+
+ *value = NULL;
for( ip = properties ; ip ; ip = ip->next ){
- NAPivotNotify *npn = ( NAPivotNotify * ) ip->data;
+ npn = ( NAPivotNotify * ) ip->data;
if( npn->type == NA_PIVOT_STR &&
( !profile || !g_ascii_strcasecmp( profile, npn->profile )) &&
!g_ascii_strcasecmp( key, npn->parm )){
@@ -848,16 +877,19 @@ search_for_str( GSList *properties, const gchar *profile, const gchar *key, gcha
return( TRUE );
}
}
+
return( FALSE );
}
static gboolean
search_for_bool( GSList *properties, const gchar *profile, const gchar *key, gboolean *value )
{
- *value = FALSE;
GSList *ip;
+ NAPivotNotify *npn;
+
+ *value = FALSE;
for( ip = properties ; ip ; ip = ip->next ){
- NAPivotNotify *npn = ( NAPivotNotify * ) ip->data;
+ npn = ( NAPivotNotify * ) ip->data;
if( npn->type == NA_PIVOT_BOOL &&
( !profile || !g_ascii_strcasecmp( profile, npn->profile )) &&
!g_ascii_strcasecmp( key, npn->parm )){
@@ -865,16 +897,19 @@ search_for_bool( GSList *properties, const gchar *profile, const gchar *key, gbo
return( TRUE );
}
}
+
return( FALSE );
}
static gboolean
search_for_list( GSList *properties, const gchar *profile, const gchar *key, GSList **value )
{
- *value = NULL;
GSList *ip;
+ NAPivotNotify *npn;
+
+ *value = NULL;
for( ip = properties ; ip ; ip = ip->next ){
- NAPivotNotify *npn = ( NAPivotNotify * ) ip->data;
+ npn = ( NAPivotNotify * ) ip->data;
if( npn->type == NA_PIVOT_STRLIST &&
( !profile || !g_ascii_strcasecmp( profile, npn->profile )) &&
!g_ascii_strcasecmp( key, npn->parm )){
@@ -882,6 +917,7 @@ search_for_list( GSList *properties, const gchar *profile, const gchar *key, GSL
return( TRUE );
}
}
+
return( FALSE );
}
@@ -943,22 +979,26 @@ key_is_writable( NAGConf *gconf, const gchar *path )
static gboolean
write_v2_keys( NAGConf *gconf, const NAAction *action, gchar **message )
{
- gchar *uuid = na_action_get_uuid( action );
+ gchar *uuid, *name;
+ gboolean ret;
+ GSList *profiles, *ip;
+ NAActionProfile *profile;
+
+ uuid = na_action_get_uuid( action );
- gboolean ret =
+ ret =
write_str( gconf, uuid, ACTION_VERSION_ENTRY, na_action_get_version( action ), message ) &&
write_str( gconf, uuid, ACTION_LABEL_ENTRY, na_action_get_label( action ), message ) &&
write_str( gconf, uuid, ACTION_TOOLTIP_ENTRY, na_action_get_tooltip( action ), message ) &&
write_str( gconf, uuid, ACTION_ICON_ENTRY, na_action_get_icon( action ), message ) &&
write_bool( gconf, uuid, NULL, ACTION_ENABLED_ENTRY, na_action_is_enabled( action ), message );
- GSList *ip;
- GSList *profiles = na_action_get_profiles( action );
+ profiles = na_action_get_profiles( action );
for( ip = profiles ; ip && ret ; ip = ip->next ){
- NAActionProfile *profile = NA_ACTION_PROFILE( ip->data );
- gchar *name = na_action_profile_get_name( profile );
+ profile = NA_ACTION_PROFILE( ip->data );
+ name = na_action_profile_get_name( profile );
ret =
write_str2( gconf, uuid, name, ACTION_PROFILE_LABEL_ENTRY, na_action_profile_get_label( profile ), message ) &&
@@ -1019,8 +1059,8 @@ write_bool( NAGConf *gconf, const gchar *uuid, const gchar *name, const gchar *k
{
gboolean ret = TRUE;
GError *error = NULL;
-
gchar *path;
+
if( name && strlen( name )){
path = g_strdup_printf( "%s/%s/%s/%s", NA_GCONF_CONFIG_PATH, uuid, name, key );
} else {
@@ -1067,10 +1107,11 @@ install_gconf_watch( NAGConf *gconf )
{
static const gchar *thisfn = "na_gconf_install_gconf_watch";
GError *error = NULL;
+ guint notify_id;
install_gconf_watched_dir( gconf );
- guint notify_id =
+ notify_id =
gconf_client_notify_add(
gconf->private->gconf,
NA_GCONF_CONFIG_PATH,
@@ -1153,11 +1194,14 @@ action_changed_cb( GConfClient *client, guint cnxn_id, GConfEntry *entry, gpoint
{
/*static const gchar *thisfn = "action_changed_cb";*/
/*g_debug( "%s: client=%p, cnxnid=%u, entry=%p, user_data=%p", thisfn, client, cnxn_id, entry, user_data );*/
+ NAGConf *gconf;
+ NAPivotNotify *npn;
g_assert( NA_IS_GCONF( user_data ));
- NAGConf *gconf = NA_GCONF( user_data );
+
+ gconf = NA_GCONF( user_data );
g_assert( NA_IS_IIO_PROVIDER( gconf ));
- NAPivotNotify *npn = entry_to_notify( entry );
+ npn = entry_to_notify( entry );
g_signal_emit_by_name( gconf->private->notified, NA_IIO_PROVIDER_SIGNAL_ACTION_CHANGED, npn );
}
diff --git a/src/common/na-iduplicable.c b/src/common/na-iduplicable.c
index 33907e5..3ba412e 100644
--- a/src/common/na-iduplicable.c
+++ b/src/common/na-iduplicable.c
@@ -37,6 +37,7 @@
/* private interface data
*/
struct NAIDuplicableInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* data set against GObject
@@ -76,7 +77,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "na_iduplicable_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NAIDuplicableInterface ),
@@ -90,7 +91,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NAIDuplicable", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NAIDuplicable", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -104,7 +107,7 @@ interface_base_init( NAIDuplicableInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NAIDuplicableInterfacePrivate, 1 );
@@ -119,7 +122,7 @@ interface_base_finalize( NAIDuplicableInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -157,7 +160,6 @@ void
na_iduplicable_dump( const NAObject *object )
{
static const gchar *thisfn = "na_iduplicable_dump";
-
NAObject *origin = NULL;
gboolean modified = FALSE;
gboolean valid = TRUE;
@@ -171,7 +173,7 @@ na_iduplicable_dump( const NAObject *object )
valid = get_valid( object );
}
- g_debug( "%s: origin=%p", thisfn, origin );
+ g_debug( "%s: origin=%p", thisfn, ( void * ) origin );
g_debug( "%s: modified=%s", thisfn, modified ? "True" : "False" );
g_debug( "%s: valid=%s", thisfn, valid ? "True" : "False" );
}
@@ -194,10 +196,10 @@ NAObject *
na_iduplicable_duplicate( const NAObject *object )
{
static const gchar *thisfn = "na_iduplicable_duplicate";
- g_debug( "%s: object=%p", thisfn, object );
-
NAObject *dup = NULL;
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
+
if( object ){
g_assert( NA_IS_OBJECT( object ));
g_assert( NA_IS_IDUPLICABLE( object ));
@@ -230,19 +232,21 @@ na_iduplicable_check_edited_status( const NAObject *object )
{
/*static const gchar *thisfn = "na_iduplicable_check_edited_status";
g_debug( "%s: object=%p", thisfn, object );*/
+ gboolean modified = TRUE;
+ NAObject *origin;
+ gboolean valid;
if( object ){
g_assert( NA_IS_OBJECT( object ));
g_assert( NA_IS_IDUPLICABLE( object ));
- gboolean modified = TRUE;
- NAObject *origin = get_origin( object );
+ origin = get_origin( object );
if( origin ){
modified = !v_are_equal( object, origin );
}
set_modified( object, modified );
- gboolean valid = v_is_valid( object );
+ valid = v_is_valid( object );
set_valid( object, valid );
}
}
@@ -262,7 +266,6 @@ na_iduplicable_is_modified( const NAObject *object )
{
/*static const gchar *thisfn = "na_iduplicable_is_modified";
g_debug( "%s: object=%p", thisfn, object );*/
-
gboolean is_modified = FALSE;
if( object ){
@@ -289,7 +292,6 @@ na_iduplicable_is_valid( const NAObject *object )
{
/*static const gchar *thisfn = "na_iduplicable_is_valid";
g_debug( "%s: object=%p", thisfn, object );*/
-
gboolean is_valid = FALSE;
if( object ){
@@ -315,7 +317,6 @@ na_iduplicable_get_origin( const NAObject *object )
{
/*static const gchar *thisfn = "na_iduplicable_is_valid";
g_debug( "%s: object=%p", thisfn, object );*/
-
NAObject *origin = NULL;
if( object ){
diff --git a/src/common/na-iio-provider.c b/src/common/na-iio-provider.c
index 9fb4f4c..eb8573b 100644
--- a/src/common/na-iio-provider.c
+++ b/src/common/na-iio-provider.c
@@ -38,6 +38,7 @@
/* private interface data
*/
struct NAIIOProviderInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
static GType register_type( void );
@@ -67,7 +68,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "na_iio_provider_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NAIIOProviderInterface ),
@@ -81,7 +82,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NAIIOProvider", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NAIIOProvider", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -95,7 +98,7 @@ interface_base_init( NAIIOProviderInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NAIIOProviderInterfacePrivate, 1 );
@@ -116,7 +119,7 @@ interface_base_finalize( NAIIOProviderInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -141,16 +144,14 @@ GSList *
na_iio_provider_read_actions( const NAPivot *pivot )
{
static const gchar *thisfn = "na_iio_provider_read_actions";
- g_debug( "%s: pivot=%p", thisfn, pivot );
-
- g_assert( NA_IS_PIVOT( pivot ));
-
GSList *actions = NULL;
- GSList *ip;
- GSList *list;
+ GSList *providers, *ip, *list, *ia;
NAIIOProvider *instance;
- GSList *providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
+ g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
+ g_assert( NA_IS_PIVOT( pivot ));
+
+ providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
for( ip = providers ; ip ; ip = ip->next ){
@@ -159,7 +160,6 @@ na_iio_provider_read_actions( const NAPivot *pivot )
list = NA_IIO_PROVIDER_GET_INTERFACE( instance )->read_actions( instance );
- GSList *ia;
for( ia = list ; ia ; ia = ia->next ){
na_action_set_provider( NA_ACTION( ia->data ), instance );
@@ -191,16 +191,20 @@ guint
na_iio_provider_write_action( const NAPivot *pivot, NAAction *action, gchar **message )
{
static const gchar *thisfn = "na_iio_provider_write_action";
- g_debug( "%s: pivot=%p, action=%p, message=%p", thisfn, pivot, action, message );
+ guint ret;
+ NAIIOProvider *instance;
+ GSList *providers, *ip;
+ g_debug( "%s: pivot=%p, action=%p, message=%p",
+ thisfn, ( void * ) pivot, ( void * ) action, ( void * ) message );
g_assert( NA_IS_PIVOT( pivot ) || !pivot );
g_assert( NA_IS_ACTION( action ));
- guint ret = NA_IIO_PROVIDER_NOT_WRITABLE;
+ ret = NA_IIO_PROVIDER_NOT_WRITABLE;
/* try to write to the original provider of the action
*/
- NAIIOProvider *instance = NA_IIO_PROVIDER( na_action_get_provider( action ));
+ instance = NA_IIO_PROVIDER( na_action_get_provider( action ));
if( instance ){
ret = write_action( instance, action, message );
@@ -213,8 +217,7 @@ na_iio_provider_write_action( const NAPivot *pivot, NAAction *action, gchar **me
/* else, search for a provider which is willing to write the action
*/
if( !instance && pivot ){
- GSList *providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
- GSList *ip;
+ providers = na_pivot_get_providers( pivot, NA_IIO_PROVIDER_TYPE );
for( ip = providers ; ip ; ip = ip->next ){
instance = NA_IIO_PROVIDER( ip->data );
@@ -247,13 +250,16 @@ guint
na_iio_provider_delete_action( const NAPivot *pivot, const NAAction *action, gchar **message )
{
static const gchar *thisfn = "na_iio_provider_delete_action";
- g_debug( "%s: pivot=%p, action=%p, message=%p", thisfn, pivot, action, message );
+ guint ret;
+ NAIIOProvider *instance;
+ g_debug( "%s: pivot=%p, action=%p, message=%p",
+ thisfn, ( void * ) pivot, ( void * ) action, ( void * ) message );
g_assert( NA_IS_PIVOT( pivot ));
g_assert( NA_IS_ACTION( action ));
- guint ret = NA_IIO_PROVIDER_NOT_WRITABLE;
- NAIIOProvider *instance = NA_IIO_PROVIDER( na_action_get_provider( action ));
+ ret = NA_IIO_PROVIDER_NOT_WRITABLE;
+ instance = NA_IIO_PROVIDER( na_action_get_provider( action ));
if( instance ){
g_assert( NA_IS_IIO_PROVIDER( instance ));
@@ -285,7 +291,10 @@ static guint
write_action( const NAIIOProvider *provider, NAAction *action, gchar **message )
{
static const gchar *thisfn = "na_iio_provider_write_action";
- g_debug( "%s: provider=%p, action=%p, message=%p", thisfn, provider, action, message );
+ guint ret;
+
+ g_debug( "%s: provider=%p, action=%p, message=%p",
+ thisfn, ( void * ) provider, ( void * ) action, ( void * ) message );
if( !NA_IIO_PROVIDER_GET_INTERFACE( provider )->is_willing_to_write( provider )){
return( NA_IIO_PROVIDER_NOT_WILLING_TO_WRITE );
@@ -300,7 +309,7 @@ write_action( const NAIIOProvider *provider, NAAction *action, gchar **message )
return( NA_IIO_PROVIDER_NOT_WILLING_TO_WRITE );
}
- guint ret = NA_IIO_PROVIDER_GET_INTERFACE( provider )->delete_action( provider, action, message );
+ ret = NA_IIO_PROVIDER_GET_INTERFACE( provider )->delete_action( provider, action, message );
if( ret != NA_IIO_PROVIDER_WRITE_OK ){
return( ret );
}
diff --git a/src/common/na-iio-provider.h b/src/common/na-iio-provider.h
index 728031b..87481f3 100644
--- a/src/common/na-iio-provider.h
+++ b/src/common/na-iio-provider.h
@@ -145,7 +145,7 @@ enum {
NA_IIO_PROVIDER_NOT_WRITABLE,
NA_IIO_PROVIDER_NOT_WILLING_TO_WRITE,
NA_IIO_PROVIDER_WRITE_ERROR,
- NA_IIO_PROVIDER_NO_PROVIDER,
+ NA_IIO_PROVIDER_NO_PROVIDER
};
G_END_DECLS
diff --git a/src/common/na-ipivot-consumer.c b/src/common/na-ipivot-consumer.c
index 4b7689c..a98c554 100644
--- a/src/common/na-ipivot-consumer.c
+++ b/src/common/na-ipivot-consumer.c
@@ -39,6 +39,7 @@
/* private interface data
*/
struct NAIPivotConsumerInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
static GType register_type( void );
@@ -66,7 +67,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "na_ipivot_consumer_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NAIPivotConsumerInterface ),
@@ -80,7 +81,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NAIPivotConsumer", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NAIPivotConsumer", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -94,7 +97,7 @@ interface_base_init( NAIPivotConsumerInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NAIPivotConsumerInterfacePrivate, 1 );
@@ -111,7 +114,7 @@ interface_base_finalize( NAIPivotConsumerInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -153,7 +156,8 @@ na_ipivot_consumer_delay_notify( NAIPivotConsumer *instance )
void na_ipivot_consumer_notify( NAIPivotConsumer *instance )
{
static const gchar *thisfn = "na_ipivot_consumer_notify";
- g_debug( "%s: instance=%p", thisfn, instance );
+
+ g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
if( is_notify_allowed( instance )){
if( NA_IPIVOT_CONSUMER_GET_INTERFACE( instance )->on_actions_changed ){
@@ -167,6 +171,7 @@ is_notify_allowed( const NAIPivotConsumer *instance )
{
GTimeVal *last_delay;
GTimeVal now;
+ glong ecart;
last_delay = ( GTimeVal * ) g_object_get_data( G_OBJECT( instance ), "na-ipivot-consumer-delay-notify" );
if( !last_delay ){
@@ -174,7 +179,8 @@ is_notify_allowed( const NAIPivotConsumer *instance )
}
g_get_current_time( &now );
- glong ecart = 1000000 * ( now.tv_sec - last_delay->tv_sec );
+ ecart = 1000000 * ( now.tv_sec - last_delay->tv_sec );
ecart += now.tv_usec - last_delay->tv_usec;
+
return( ecart > 1000000 );
}
diff --git a/src/common/na-iprefs.c b/src/common/na-iprefs.c
index e46eb0a..b4f0a6d 100644
--- a/src/common/na-iprefs.c
+++ b/src/common/na-iprefs.c
@@ -67,7 +67,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "na_iprefs_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NAIPrefsInterface ),
@@ -81,7 +81,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NAIPrefs", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NAIPrefs", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -95,7 +97,7 @@ interface_base_init( NAIPrefsInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NAIPrefsInterfacePrivate, 1 );
@@ -112,7 +114,7 @@ interface_base_finalize( NAIPrefsInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -142,9 +144,12 @@ read_key_bool( NAIPrefs *instance, const gchar *name )
{
static const gchar *thisfn = "na_iprefs_read_key_bool";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
+ gchar *path;
+ gboolean value;
- gboolean value = gconf_client_get_bool( NA_IPREFS_GET_INTERFACE( instance )->private->client, path, &error );
+ path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
+
+ value = gconf_client_get_bool( NA_IPREFS_GET_INTERFACE( instance )->private->client, path, &error );
if( error ){
g_warning( "%s: name=%s, %s", thisfn, name, error->message );
@@ -160,7 +165,9 @@ write_key_bool( NAIPrefs *instance, const gchar *name, gboolean value )
{
static const gchar *thisfn = "na_iprefs_write_key_bool";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
+ gchar *path;
+
+ path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
gconf_client_set_bool( NA_IPREFS_GET_INTERFACE( instance )->private->client, path, value, &error );
diff --git a/src/common/na-object.c b/src/common/na-object.c
index c3ea6a2..2ce37b8 100644
--- a/src/common/na-object.c
+++ b/src/common/na-object.c
@@ -40,6 +40,7 @@
/* private class data
*/
struct NAObjectClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -99,7 +100,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "na_object_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static GTypeInfo info = {
sizeof( NAObjectClass ),
@@ -113,16 +114,16 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( G_TYPE_OBJECT, "NAObject", &info, 0 );
-
- /* implements IDuplicable interface
- */
static const GInterfaceInfo idupicable_iface_info = {
( GInterfaceInitFunc ) iduplicable_iface_init,
NULL,
NULL
};
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_OBJECT, "NAObject", &info, 0 );
+
g_type_add_interface_static( type, NA_IDUPLICABLE_TYPE, &idupicable_iface_info );
return( type );
@@ -132,18 +133,20 @@ static void
class_init( NAObjectClass *klass )
{
static const gchar *thisfn = "na_object_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ GParamSpec *spec;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->constructed = instance_constructed;
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
object_class->set_property = instance_set_property;
object_class->get_property = instance_get_property;
- GParamSpec *spec;
spec = g_param_spec_string(
PROP_NAOBJECT_ID_STR,
"NAObject identifiant",
@@ -172,7 +175,8 @@ static void
iduplicable_iface_init( NAIDuplicableInterface *iface )
{
static const gchar *thisfn = "na_object_iduplicable_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->duplicate = iduplicable_duplicate;
iface->are_equal = iduplicable_are_equal;
@@ -184,9 +188,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
{
/*static const gchar *thisfn = "na_object_instance_init";
g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );*/
+ NAObject *self;
g_assert( NA_IS_OBJECT( instance ));
- NAObject *self = NA_OBJECT( instance );
+ self = NA_OBJECT( instance );
self->private = g_new0( NAObjectPrivate, 1 );
@@ -207,8 +212,10 @@ instance_constructed( GObject *object )
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
+ NAObject *self;
+
g_assert( NA_IS_OBJECT( object ));
- NAObject *self = NA_OBJECT( object );
+ self = NA_OBJECT( object );
switch( property_id ){
case PROP_NAOBJECT_ID:
@@ -228,8 +235,10 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
static void
instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
+ NAObject *self;
+
g_assert( NA_IS_OBJECT( object ));
- NAObject *self = NA_OBJECT( object );
+ self = NA_OBJECT( object );
switch( property_id ){
case PROP_NAOBJECT_ID:
@@ -251,8 +260,10 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
static void
instance_dispose( GObject *object )
{
+ NAObject *self;
+
g_assert( NA_IS_OBJECT( object ));
- NAObject *self = NA_OBJECT( object );
+ self = NA_OBJECT( object );
if( !self->private->dispose_has_run ){
@@ -266,8 +277,10 @@ instance_dispose( GObject *object )
static void
instance_finalize( GObject *object )
{
+ NAObject *self;
+
g_assert( NA_IS_OBJECT( object ));
- NAObject *self = ( NAObject * ) object;
+ self = ( NAObject * ) object;
g_free( self->private->id );
g_free( self->private->label );
@@ -474,9 +487,12 @@ na_object_set_origin( NAObject *object, const NAObject *origin )
gchar *
na_object_get_id( const NAObject *object )
{
- g_assert( NA_IS_OBJECT( object ));
gchar *id;
+
+ g_assert( NA_IS_OBJECT( object ));
+
g_object_get( G_OBJECT( object ), PROP_NAOBJECT_ID_STR, &id, NULL );
+
return( id );
}
@@ -492,9 +508,12 @@ na_object_get_id( const NAObject *object )
gchar *
na_object_get_label( const NAObject *object )
{
- g_assert( NA_IS_OBJECT( object ));
gchar *label;
+
+ g_assert( NA_IS_OBJECT( object ));
+
g_object_get( G_OBJECT( object ), PROP_NAOBJECT_LABEL_STR, &label, NULL );
+
return( label );
}
@@ -584,7 +603,7 @@ do_dump( const NAObject *object )
g_assert( NA_IS_OBJECT( object ));
- g_debug( "%s: object=%p", thisfn, object );
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
g_debug( "%s: id=%s", thisfn, object->private->id );
g_debug( "%s: label=%s", thisfn, object->private->label );
@@ -600,11 +619,13 @@ do_check_edited_status( const NAObject *object )
static void
do_copy( NAObject *target, const NAObject *source )
{
- gchar *id = na_object_get_id( source );
+ gchar *id, *label;
+
+ id = na_object_get_id( source );
na_object_set_id( target, id );
g_free( id );
- gchar *label = na_object_get_label( source );
+ label = na_object_get_label( source );
na_object_set_label( target, label );
g_free( label );
}
diff --git a/src/common/na-pivot.c b/src/common/na-pivot.c
index 0c60be7..2f308fb 100644
--- a/src/common/na-pivot.c
+++ b/src/common/na-pivot.c
@@ -45,6 +45,7 @@
/* private class data
*/
struct NAPivotClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -109,6 +110,9 @@ na_pivot_get_type( void )
static GType
register_type( void )
{
+ static const gchar *thisfn = "na_pivot_register_type";
+ GType type;
+
static GTypeInfo info = {
sizeof( NAPivotClass ),
( GBaseInitFunc ) NULL,
@@ -121,18 +125,24 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- return( g_type_register_static( G_TYPE_OBJECT, "NAPivot", &info, 0 ));
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_OBJECT, "NAPivot", &info, 0 );
+
+ return( type );
}
static void
class_init( NAPivotClass *klass )
{
static const gchar *thisfn = "na_pivot_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
@@ -160,10 +170,12 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "na_pivot_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NAPivot *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NA_IS_PIVOT( instance ));
- NAPivot* self = NA_PIVOT( instance );
+ self = NA_PIVOT( instance );
self->private = g_new0( NAPivotPrivate, 1 );
@@ -178,10 +190,10 @@ static GSList *
register_interface_providers( const NAPivot *pivot )
{
static const gchar *thisfn = "na_pivot_register_interface_providers";
- g_debug( "%s", thisfn );
-
GSList *list = NULL;
+ g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
+
list = g_slist_prepend( list, na_gconf_new( G_OBJECT( pivot )));
return( list );
@@ -191,10 +203,12 @@ static void
instance_dispose( GObject *object )
{
static const gchar *thisfn = "na_pivot_instance_dispose";
- g_debug( "%s: object=%p", thisfn, object );
+ NAPivot *self;
+
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
g_assert( NA_IS_PIVOT( object ));
- NAPivot *self = NA_PIVOT( object );
+ self = NA_PIVOT( object );
if( !self->private->dispose_has_run ){
@@ -216,13 +230,15 @@ static void
instance_finalize( GObject *object )
{
static const gchar *thisfn = "na_pivot_instance_finalize";
- g_debug( "%s: object=%p", thisfn, object );
+ NAPivot *self;
+ GSList *ip;
+
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
g_assert( NA_IS_PIVOT( object ));
- NAPivot *self = ( NAPivot * ) object;
+ self = ( NAPivot * ) object;
/* release the interface providers */
- GSList *ip;
for( ip = self->private->providers ; ip ; ip = ip->next ){
g_object_unref( G_OBJECT( ip->data ));
}
@@ -269,12 +285,13 @@ void
na_pivot_dump( const NAPivot *pivot )
{
static const gchar *thisfn = "na_pivot_dump";
-
GSList *it;
int i;
- g_debug( "%s: notified=%p (%d elts)", thisfn, pivot->private->notified, g_slist_length( pivot->private->notified ));
- g_debug( "%s: providers=%p (%d elts)", thisfn, pivot->private->providers, g_slist_length( pivot->private->providers ));
- g_debug( "%s: actions=%p (%d elts)", thisfn, pivot->private->actions, g_slist_length( pivot->private->actions ));
+
+ g_debug( "%s: notified=%p (%d elts)", thisfn, ( void * ) pivot->private->notified, g_slist_length( pivot->private->notified ));
+ g_debug( "%s: providers=%p (%d elts)", thisfn, ( void * ) pivot->private->providers, g_slist_length( pivot->private->providers ));
+ g_debug( "%s: actions=%p (%d elts)", thisfn, ( void * ) pivot->private->actions, g_slist_length( pivot->private->actions ));
+
for( it = pivot->private->actions, i = 0 ; it ; it = it->next ){
g_debug( "%s: [%d]: %p", thisfn, i++, it->data );
}
@@ -298,12 +315,12 @@ GSList *
na_pivot_get_providers( const NAPivot *pivot, GType type )
{
static const gchar *thisfn = "na_pivot_get_providers";
- g_debug( "%s: pivot=%p", thisfn, pivot );
+ GSList *list = NULL;
+ GSList *ip;
+ g_debug( "%s: pivot=%p", thisfn, ( void * ) pivot );
g_assert( NA_IS_PIVOT( pivot ));
- GSList *list = NULL;
- GSList *ip;
for( ip = pivot->private->providers ; ip ; ip = ip->next ){
if( G_TYPE_CHECK_INSTANCE_TYPE( G_OBJECT( ip->data ), type )){
list = g_slist_prepend( list, ip->data );
@@ -373,11 +390,11 @@ na_pivot_reload_actions( NAPivot *pivot )
GSList *
na_pivot_get_duplicate_actions( const NAPivot *pivot )
{
- g_assert( NA_IS_PIVOT( pivot ));
-
GSList *list = NULL;
GSList *ia;
+ g_assert( NA_IS_PIVOT( pivot ));
+
for( ia = pivot->private->actions ; ia ; ia = ia->next ){
list = g_slist_prepend( list, na_object_duplicate( NA_OBJECT( ia->data )));
}
@@ -395,9 +412,11 @@ void
na_pivot_free_actions( GSList *actions )
{
GSList *ia;
+
for( ia = actions ; ia ; ia = ia->next ){
g_object_unref( NA_ACTION( ia->data ));
}
+
g_slist_free( actions );
}
@@ -452,6 +471,7 @@ NAAction *
na_pivot_get_action( const NAPivot *pivot, const gchar *uuid )
{
uuid_t uua, i_uub;
+ GSList *ia;
g_assert( NA_IS_PIVOT( pivot ));
if( !uuid || !strlen( uuid )){
@@ -460,7 +480,6 @@ na_pivot_get_action( const NAPivot *pivot, const gchar *uuid )
uuid_parse( uuid, uua );
- GSList *ia;
for( ia = pivot->private->actions ; ia ; ia = ia->next ){
gchar *i_uuid = na_action_get_uuid( NA_ACTION( ia->data ));
@@ -528,8 +547,8 @@ void
na_pivot_add_consumer( NAPivot *pivot, const GObject *consumer )
{
static const gchar *thisfn = "na_pivot_add_consumer";
- g_debug( "%s: pivot=%p, consumer=%p", thisfn, pivot, consumer );
+ g_debug( "%s: pivot=%p, consumer=%p", thisfn, ( void * ) pivot, ( void * ) consumer );
g_assert( NA_IS_PIVOT( pivot ));
g_assert( G_IS_OBJECT( consumer ));
@@ -576,8 +595,10 @@ static void
free_consumers( GSList *consumers )
{
GSList *ic;
+
for( ic = consumers ; ic ; ic = ic->next )
;
+
g_slist_free( consumers );
}
@@ -597,6 +618,7 @@ action_changed_handler( NAPivot *self, gpointer user_data )
g_assert( NA_IS_PIVOT( self ));
g_assert( user_data );
+
if( self->private->dispose_has_run ){
return;
}
@@ -621,14 +643,16 @@ on_actions_changed_timeout( gpointer user_data )
{
/*static const gchar *thisfn = "na_pivot_on_actions_changed_timeout";
g_debug( "%s: pivot=%p", thisfn, user_data );*/
-
GTimeVal now;
+ const NAPivot *pivot;
+ gulong diff;
+ GSList *ic;
g_assert( NA_IS_PIVOT( user_data ));
- const NAPivot *pivot = NA_PIVOT( user_data );
+ pivot = NA_PIVOT( user_data );
g_get_current_time( &now );
- gulong diff = time_val_diff( &now, &st_last_event );
+ diff = time_val_diff( &now, &st_last_event );
if( diff < st_timeout_usec ){
return( TRUE );
}
@@ -638,7 +662,6 @@ on_actions_changed_timeout( gpointer user_data )
pivot->private->actions = na_iio_provider_read_actions( pivot );
}
- GSList *ic;
for( ic = pivot->private->notified ; ic ; ic = ic->next ){
na_ipivot_consumer_notify( NA_IPIVOT_CONSUMER( ic->data ));
}
diff --git a/src/common/na-utils.c b/src/common/na-utils.c
index 78028c1..0362ff3 100644
--- a/src/common/na-utils.c
+++ b/src/common/na-utils.c
@@ -209,7 +209,7 @@ na_utils_dump_string_list( GSList *list )
GSList *i;
int c;
- g_debug( "%s: list at %p has %d elements", thisfn, list, g_slist_length( list ));
+ g_debug( "%s: list at %p has %d elements", thisfn, ( void * ) list, g_slist_length( list ));
for( i=list, c=0 ; i ; i=i->next, c++ ){
gchar *s = ( gchar * ) i->data;
g_debug( "%s: %2d - %s", thisfn, c, s );
diff --git a/src/common/na-xml-names.h b/src/common/na-xml-names.h
index f4a5959..f2295c9 100644
--- a/src/common/na-xml-names.h
+++ b/src/common/na-xml-names.h
@@ -99,35 +99,79 @@ enum {
/* GConf schema descriptions
*/
#define ACTION_LABEL_DESC_SHORT _( "The label of the menu item" )
-#define ACTION_LABEL_DESC_LONG _( "The label of the menu item that will appear in the Nautilus popup menu when the selection matches the appearance condition settings" )
+#define ACTION_LABEL_DESC_LONG _( "The label of the menu item that will appear in the Nautilus popup " \
+ "menu when the selection matches the appearance condition settings" )
#define ACTION_TOOLTIP_DESC_SHORT _( "The tooltip of the menu item" )
-#define ACTION_TOOLTIP_DESC_LONG _( "The tooltip of the menu item that will appear in the Nautilus statusbar when the user points to the Nautilus popup menu item with his/her mouse" )
+#define ACTION_TOOLTIP_DESC_LONG _( "The tooltip of the menu item that will appear in the Nautilus " \
+ "statusbar when the user points to the Nautilus popup menu item "\
+ "with his/her mouse" )
#define ACTION_ICON_DESC_SHORT _( "The icon of the menu item" )
-#define ACTION_ICON_DESC_LONG _( "The icon of the menu item that will appear next to the label in the Nautilus popup menu when the selection matches the appearance conditions settings" )
+#define ACTION_ICON_DESC_LONG _( "The icon of the menu item that will appear next to the label " \
+ "in the Nautilus popup menu when the selection matches the appearance " \
+ "conditions settings" )
#define ACTION_ENABLED_DESC_SHORT _( "Whether the action is enabled" )
-#define ACTION_ENABLED_DESC_LONG _( "If the action is disabled, it will never appear in the Nautilus context menu" )
-#define ACTION_PROFILE_NAME_DESC_SHORT _( "A description name of the profile" )
-#define ACTION_PROFILE_NAME_DESC_LONG _( "The field is here to give the user a human readable name for a profile in the Nact interface. If not set there will be a default auto generated string set by default" )
+#define ACTION_ENABLED_DESC_LONG _( "If the action is disabled, it will never appear in the Nautilus " \
+ "context menu" )
+#define ACTION_PROFILE_NAME_DESC_SHORT _( "A description name of the profile" )
+#define ACTION_PROFILE_NAME_DESC_LONG _( "The field is here to give the user a human readable name for a " \
+ "profile in the Nact interface. If not set there will be a default " \
+ "auto generated string set by default" )
#define ACTION_PATH_DESC_SHORT _( "The path of the command" )
-#define ACTION_PATH_DESC_LONG _( "The path of the command to start when the user select the menu item in the Nautilus popup menu" )
+#define ACTION_PATH_DESC_LONG _( "The path of the command to start when the user select the menu item " \
+ "in the Nautilus popup menu" )
#define ACTION_PARAMETERS_DESC_SHORT _( "The parameters of the command" )
-#define ACTION_PARAMETERS_DESC_LONG _( "The parameters of the command to start when the user selects the menu item in the Nautilus popup menu.\n\nThe parameters can contain some special tokens which are replaced by Nautilus information before starting the command:\n\n%d: base folder of the selected file(s)\n%f: the name of the selected file or the first one if many are selected\n%h: hostname of the URI\n%m: space-separated list of the basenames of the selected file(s)/folder(s)\n%M: space-separated list of the selected file(s)/folder(s), with their full paths\n%p: port number of the first URI\n%R: space-separated list of selected URIs\n%s: scheme of the URI\n%u: URI\n%U: username of the URI\n%%: a percent sign" )
+/* too long string for iso c: 665 (max=509) */
+#define ACTION_PARAMETERS_DESC_LONG _( "The parameters of the command to start when the user selects the menu " \
+ "item in the Nautilus popup menu.\n\nThe parameters can contain some " \
+ "special tokens which are replaced by Nautilus information before starting " \
+ "the command:\n\n%d: base folder of the selected file(s)\n%f: the name of " \
+ "the selected file or the first one if many are selected\n%h: hostname of " \
+ "the URI\n%m: space-separated list of the basenames of the selected " \
+ "file(s)/folder(s)\n%M: space-separated list of the selected file(s)/folder(s), " \
+ "with their full paths\n%p: port number of the first URI\n%R: space-separated " \
+ "list of selected URIs\n%s: scheme of the URI\n%u: URI\n%U: username of the " \
+ "URI\n%%: a percent sign" )
#define ACTION_BASENAMES_DESC_SHORT _( "The list of pattern to match the selected file(s)/folder(s)" )
-#define ACTION_BASENAMES_DESC_LONG _( "A list of strings with joker '*' or '?' to match the name of the selected file(s)/folder(s). Each selected items must match at least one of the filename patterns for the action to appear" )
+#define ACTION_BASENAMES_DESC_LONG _( "A list of strings with joker '*' or '?' to match the name of the selected " \
+ "file(s)/folder(s). Each selected items must match at least one of the " \
+ "filename patterns for the action to appear" )
#define ACTION_MATCHCASE_DESC_SHORT _( "'true' if the filename patterns have to be case sensitive, 'false' otherwise" )
-#define ACTION_MATCHCASE_DESC_LONG _( "If you need to match a filename in a case-sensitive manner, set this key to 'true'. If you also want, for example '*.jpg' to match 'photo.JPG', set 'false'" )
+#define ACTION_MATCHCASE_DESC_LONG _( "If you need to match a filename in a case-sensitive manner, set this key to " \
+ "'true'. If you also want, for example '*.jpg' to match 'photo.JPG', " \
+ "set 'false'" )
#define ACTION_MIMETYPES_DESC_SHORT _( "The list of patterns to match the mimetypes of the selected file(s)" )
-#define ACTION_MIMETYPES_DESC_LONG _( "A list of strings with joker '*' or '?' to match the mimetypes of the selected file(s). Each selected items must match at least one of the mimetype patterns for the action to appear" )
+#define ACTION_MIMETYPES_DESC_LONG _( "A list of strings with joker '*' or '?' to match the mimetypes of the selected " \
+ "file(s). Each selected items must match at least one of the " \
+ "mimetype patterns for the action to appear" )
#define ACTION_ISFILE_DESC_SHORT _( "'true' if the selection can have files, 'false' otherwise" )
-#define ACTION_ISFILE_DESC_LONG _( "This setting is tied in with the 'isdir' setting. The valid combinations are:\n\nisfile=TRUE and isdir=FALSE: the selection may hold only files\nisfile=FALSE and isdir=TRUE: the selection may hold only folders\nisfile=TRUE and isdir=TRUE: the selection may hold both files and folders\nisfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration will never appear)" )
+#define ACTION_ISFILE_DESC_LONG _( "This setting is tied in with the 'isdir' setting. The valid combinations " \
+ "are:\n\nisfile=TRUE and isdir=FALSE: the selection may hold only files\n" \
+ "isfile=FALSE and isdir=TRUE: the selection may hold only folders\n" \
+ "isfile=TRUE and isdir=TRUE: the selection may hold both files and folders\n" \
+ "isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration " \
+ "will never appear)" )
#define ACTION_ISDIR_DESC_SHORT _( "'true' if the selection can have folders, 'false' otherwise" )
-#define ACTION_ISDIR_DESC_LONG _( "This setting is tied in with the 'isfile' setting. The valid combinations are:\n\nisfile=TRUE and isdir=FALSE: the selection may hold only files\nisfile=FALSE and isdir=TRUE: the selection may hold only folders\nisfile=TRUE and isdir=TRUE: the selection may hold both files and folders\nisfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration will never appear)" )
+#define ACTION_ISDIR_DESC_LONG _( "This setting is tied in with the 'isfile' setting. The valid combinations " \
+ "are:\n\nisfile=TRUE and isdir=FALSE: the selection may hold only files\n" \
+ "isfile=FALSE and isdir=TRUE: the selection may hold only folders\n" \
+ "isfile=TRUE and isdir=TRUE: the selection may hold both files and folders\n" \
+ "isfile=FALSE and isdir=FALSE: this is an invalid combination (your configuration " \
+ "will never appear)" )
#define ACTION_MULTIPLE_DESC_SHORT _( "'true' if the selection can have several items, 'false' otherwise" )
-#define ACTION_MULTIPLE_DESC_LONG _( "If you need one or more files or folders to be selected, set this key to 'true'. If you want just one file or folder, set 'false'" )
+#define ACTION_MULTIPLE_DESC_LONG _( "If you need one or more files or folders to be selected, set this " \
+ "key to 'true'. If you want just one file or folder, set 'false'" )
#define ACTION_SCHEMES_DESC_SHORT _( "The list of schemes where the selected files should be located" )
-#define ACTION_SCHEMES_DESC_LONG _( "Defines the list of valid schemes to be matched against the selected items. The scheme is the protocol used to access the files. The keyword to use is the one used in the URI.\n\nExamples of valid URI include:\nfile:///tmp/foo.txt\nsftp:///root test example net/tmp/foo.txt\n\nThe most common schemes are:\n\n'file': local files\n'sftp': files accessed via SSH\n'ftp': files accessed via FTP\n'smb': files accessed via Samba (Windows share)\n'dav': files accessed via WebDAV\n\nAll schemes used by Nautilus can be used here." )
+/* too long string for iso c: 510 (max=509) */
+#define ACTION_SCHEMES_DESC_LONG _( "Defines the list of valid schemes to be matched against the selected " \
+ "items. The scheme is the protocol used to access the files. The " \
+ "keyword to use is the one used in the URI.\n\nExamples of valid " \
+ "URI include:\nfile:///tmp/foo.txt\nsftp:///root test example net/tmp/foo.txt\n\n" \
+ "The most common schemes are:\n\n'file': local files\n'sftp': files accessed via SSH\n" \
+ "'ftp': files accessed via FTP\n'smb': files accessed via Samba (Windows share)\n" \
+ "'dav': files accessed via WebDAV\n\nAll schemes used by Nautilus can be used here." )
#define ACTION_VERSION_DESC_SHORT _( "The version of the configuration format" )
-#define ACTION_VERSION_DESC_LONG _( "The version of the configuration format that will be used to manage backward compatibility" )
+#define ACTION_VERSION_DESC_LONG _( "The version of the configuration format that will be used to manage " \
+ "backward compatibility" )
G_END_DECLS
diff --git a/src/common/na-xml-writer.c b/src/common/na-xml-writer.c
index 723f197..5d1043c 100644
--- a/src/common/na-xml-writer.c
+++ b/src/common/na-xml-writer.c
@@ -43,6 +43,7 @@
/* private class data
*/
struct NAXMLWriterClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -121,6 +122,9 @@ na_xml_writer_get_type( void )
static GType
register_type( void )
{
+ static const gchar *thisfn = "na_xml_writer_register_type";
+ GType type;
+
static GTypeInfo info = {
sizeof( NAXMLWriterClass ),
NULL,
@@ -133,7 +137,9 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( G_TYPE_OBJECT, "NAXMLWriter", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_OBJECT, "NAXMLWriter", &info, 0 );
return( type );
}
@@ -142,17 +148,19 @@ static void
class_init( NAXMLWriterClass *klass )
{
static const gchar *thisfn = "na_xml_writer_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ GParamSpec *spec;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ 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;
- GParamSpec *spec;
spec = g_param_spec_string(
PROP_GCONF_WRITER_UUID_STR,
PROP_GCONF_WRITER_UUID_STR,
@@ -167,10 +175,11 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "na_xml_writer_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NAXMLWriter *self;
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NA_IS_XML_WRITER( instance ));
- NAXMLWriter *self = NA_XML_WRITER( instance );
+ self = NA_XML_WRITER( instance );
self->private = g_new0( NAXMLWriterPrivate, 1 );
@@ -180,8 +189,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
+ NAXMLWriter *self;
+
g_assert( NA_IS_XML_WRITER( object ));
- NAXMLWriter *self = NA_XML_WRITER( object );
+ self = NA_XML_WRITER( object );
switch( property_id ){
case PROP_GCONF_WRITER_UUID:
@@ -197,8 +208,10 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
static void
instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
+ NAXMLWriter *self;
+
g_assert( NA_IS_XML_WRITER( object ));
- NAXMLWriter *self = NA_XML_WRITER( object );
+ self = NA_XML_WRITER( object );
switch( property_id ){
case PROP_GCONF_WRITER_UUID:
@@ -215,8 +228,10 @@ instance_set_property( GObject *object, guint property_id, const GValue *value,
static void
instance_dispose( GObject *object )
{
+ NAXMLWriter *self;
+
g_assert( NA_IS_XML_WRITER( object ));
- NAXMLWriter *self = NA_XML_WRITER( object );
+ self = NA_XML_WRITER( object );
if( !self->private->dispose_has_run ){
@@ -230,8 +245,10 @@ instance_dispose( GObject *object )
static void
instance_finalize( GObject *object )
{
+ NAXMLWriter *self;
+
g_assert( NA_IS_XML_WRITER( object ));
- NAXMLWriter *self = NA_XML_WRITER( object );
+ self = NA_XML_WRITER( object );
g_free( self->private->uuid );
@@ -262,14 +279,17 @@ xml_writer_new( const gchar *uuid )
gchar *
na_xml_writer_export( NAAction *action, const gchar *folder, gint format, gchar **msg )
{
- gchar *uuid = action ? na_action_get_uuid( action ) : NULL;
- NAXMLWriter *writer = xml_writer_new( uuid );
- g_free( uuid );
-
+ gchar *uuid;
+ NAXMLWriter *writer;
xmlDocPtr doc = NULL;
gchar *filename = NULL;
gboolean free_filename = FALSE;
+
+ uuid = action ? na_action_get_uuid( action ) : NULL;
+ writer = xml_writer_new( uuid );
+ g_free( uuid );
+
switch( format ){
case FORMAT_GCONFSCHEMAFILE_V1:
doc = create_xml_schema( writer, format, action );
@@ -332,100 +352,109 @@ na_xml_writer_export( NAAction *action, const gchar *folder, gint format, gchar
static xmlDocPtr
create_xml_schema( NAXMLWriter *writer, gint format, NAAction *action )
{
- xmlDocPtr doc = xmlNewDoc( BAD_CAST( "1.0" ));
- xmlNodePtr root_node = xmlNewNode( NULL, BAD_CAST( NACT_GCONF_SCHEMA_ROOT ));
+ xmlDocPtr doc;
+ xmlNodePtr root_node, list_node;
+ gchar *version, *label, *tooltip, *icon, *text;
+ gboolean enabled;
+ GSList *profiles, *ip;
+ NAActionProfile *profile;
+ gchar *profile_dir, *profile_label, *path, *parameters;
+ GSList *basenames, *mimetypes, *schemes;
+ gboolean match, isfile, isdir, multiple;
+
+ doc = xmlNewDoc( BAD_CAST( "1.0" ));
+ root_node = xmlNewNode( NULL, BAD_CAST( NACT_GCONF_SCHEMA_ROOT ));
xmlDocSetRootElement( doc, root_node );
- xmlNodePtr list_node = xmlNewChild( root_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_LIST ), NULL );
+ list_node = xmlNewChild( root_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_LIST ), NULL );
/* version */
- gchar *version = na_action_get_version( action );
+ version = na_action_get_version( action );
create_schema_entry( writer, format, NULL, ACTION_VERSION_ENTRY, version, doc, list_node, "string", FALSE, ACTION_VERSION_DESC_SHORT, ACTION_VERSION_DESC_LONG );
g_free( version );
/* label */
- gchar *label = na_action_get_label( action );
+ label = na_action_get_label( action );
create_schema_entry( writer, format, NULL, ACTION_LABEL_ENTRY, label, doc, list_node, "string", TRUE, ACTION_LABEL_DESC_SHORT, ACTION_LABEL_DESC_LONG );
g_free( label );
/* tooltip */
- gchar *tooltip = na_action_get_tooltip( action );
+ tooltip = na_action_get_tooltip( action );
create_schema_entry( writer, format, NULL, ACTION_TOOLTIP_ENTRY, tooltip, doc, list_node, "string", TRUE, ACTION_TOOLTIP_DESC_SHORT, ACTION_TOOLTIP_DESC_LONG );
g_free( tooltip );
/* icon name */
- gchar *icon = na_action_get_icon( action );
+ icon = na_action_get_icon( action );
create_schema_entry( writer, format, NULL, ACTION_ICON_ENTRY, icon, doc, list_node, "string", FALSE, ACTION_ICON_DESC_SHORT, ACTION_ICON_DESC_LONG );
g_free( icon );
/* enabled */
- gboolean enabled = na_action_is_enabled( action );
- gchar *text = na_utils_boolean_to_schema( enabled );
+ enabled = na_action_is_enabled( action );
+ text = na_utils_boolean_to_schema( enabled );
create_schema_entry( writer, format, NULL, ACTION_ENABLED_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_ENABLED_DESC_SHORT, ACTION_ENABLED_DESC_LONG );
g_free( text );
- GSList *profiles = na_action_get_profiles( action );
- GSList *ip;
+ profiles = na_action_get_profiles( action );
for( ip = profiles ; ip ; ip = ip->next ){
- NAActionProfile *profile = NA_ACTION_PROFILE( ip->data );
- gchar *profile_dir = na_action_profile_get_name( profile );
+ profile = NA_ACTION_PROFILE( ip->data );
+ profile_dir = na_action_profile_get_name( profile );
/* profile label */
- gchar *profile_label = na_action_profile_get_label( profile );
+ profile_label = na_action_profile_get_label( profile );
create_schema_entry( writer, format, profile_dir, ACTION_PROFILE_LABEL_ENTRY, profile_label, doc, list_node, "string", TRUE, ACTION_PROFILE_NAME_DESC_SHORT, ACTION_PROFILE_NAME_DESC_LONG );
g_free( profile_label );
/* path */
- gchar *path = na_action_profile_get_path( profile );
+ path = na_action_profile_get_path( profile );
create_schema_entry( writer, format, profile_dir, ACTION_PATH_ENTRY, path, doc, list_node, "string", FALSE, ACTION_PATH_DESC_SHORT, ACTION_PATH_DESC_LONG );
g_free( path );
/* parameters */
- gchar *parameters = na_action_profile_get_parameters( profile );
+ parameters = na_action_profile_get_parameters( profile );
create_schema_entry( writer, format, profile_dir, ACTION_PARAMETERS_ENTRY, parameters, doc, list_node, "string", FALSE, ACTION_PARAMETERS_DESC_SHORT, ACTION_PARAMETERS_DESC_LONG );
g_free( parameters );
/* basenames */
- GSList *basenames = na_action_profile_get_basenames( profile );
+ basenames = na_action_profile_get_basenames( profile );
text = na_utils_gslist_to_schema( basenames );
create_schema_entry( writer, format, profile_dir, ACTION_BASENAMES_ENTRY, text, doc, list_node, "list", FALSE, ACTION_BASENAMES_DESC_SHORT, ACTION_BASENAMES_DESC_LONG );
g_free( text );
na_utils_free_string_list( basenames );
/* match_case */
- gboolean match = na_action_profile_get_matchcase( profile );
+ match = na_action_profile_get_matchcase( profile );
text = na_utils_boolean_to_schema( match );
create_schema_entry( writer, format, profile_dir, ACTION_MATCHCASE_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_MATCHCASE_DESC_SHORT, ACTION_MATCHCASE_DESC_LONG );
g_free( text );
/* mimetypes */
- GSList *mimetypes = na_action_profile_get_mimetypes( profile );
+ mimetypes = na_action_profile_get_mimetypes( profile );
text = na_utils_gslist_to_schema( mimetypes );
create_schema_entry( writer, format, profile_dir, ACTION_MIMETYPES_ENTRY, text, doc, list_node, "list", FALSE, ACTION_MIMETYPES_DESC_SHORT, ACTION_MIMETYPES_DESC_LONG );
g_free( text );
na_utils_free_string_list( mimetypes );
/* is_file */
- gboolean isfile = na_action_profile_get_is_file( profile );
+ isfile = na_action_profile_get_is_file( profile );
text = na_utils_boolean_to_schema( isfile );
create_schema_entry( writer, format, profile_dir, ACTION_ISFILE_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_ISFILE_DESC_SHORT, ACTION_ISFILE_DESC_LONG );
g_free( text );
/* is_dir */
- gboolean isdir = na_action_profile_get_is_dir( profile );
+ isdir = na_action_profile_get_is_dir( profile );
text = na_utils_boolean_to_schema( isdir );
create_schema_entry( writer, format, profile_dir, ACTION_ISDIR_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_ISDIR_DESC_SHORT, ACTION_ISDIR_DESC_LONG );
g_free( text );
/* accept-multiple-files */
- gboolean mutiple = na_action_profile_get_multiple( profile );
- text = na_utils_boolean_to_schema( mutiple );
+ multiple = na_action_profile_get_multiple( profile );
+ text = na_utils_boolean_to_schema( multiple );
create_schema_entry( writer, format, profile_dir, ACTION_MULTIPLE_ENTRY, text, doc, list_node, "bool", FALSE, ACTION_MULTIPLE_DESC_SHORT, ACTION_MULTIPLE_DESC_LONG );
g_free( text );
/* schemes */
- GSList *schemes = na_action_profile_get_schemes( profile );
+ schemes = na_action_profile_get_schemes( profile );
text = na_utils_gslist_to_schema( schemes );
create_schema_entry( writer, format, profile_dir, ACTION_SCHEMES_ENTRY, text, doc, list_node, "list", FALSE, ACTION_SCHEMES_DESC_SHORT, ACTION_SCHEMES_DESC_LONG );
g_free( text );
@@ -445,15 +474,19 @@ create_schema_entry( NAXMLWriter *writer,
const gchar *short_desc, const gchar *long_desc )
{
gchar *path = NULL;
+ xmlNodePtr schema_node;
+ xmlChar *content, *encoded_content;
+ xmlNodePtr value_root_node, locale_node;
+
if( profile_name ){
path = g_build_path( "/", NA_GCONF_CONFIG_PATH, writer->private->uuid, profile_name, key, NULL );
} else {
path = g_build_path( "/", NA_GCONF_CONFIG_PATH, writer->private->uuid, key, NULL );
}
- xmlNodePtr schema_node = xmlNewChild( list_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_ENTRY ), NULL );
+ schema_node = xmlNewChild( list_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_ENTRY ), NULL );
- xmlChar *content = BAD_CAST( g_build_path( "/", NA_GCONF_SCHEMA_PREFIX, path, NULL ));
+ content = BAD_CAST( g_build_path( "/", NA_GCONF_SCHEMA_PREFIX, path, NULL ));
xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_KEY ), content );
xmlFree( content );
@@ -467,8 +500,8 @@ create_schema_entry( NAXMLWriter *writer,
/* always creates a 'locale' node,
* maybe with the default value if this later is localized
*/
- xmlNodePtr value_root_node = schema_node;
- xmlNodePtr locale_node = xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_LOCALE ), NULL );
+ value_root_node = schema_node;
+ locale_node = xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_LOCALE ), NULL );
xmlNewProp( locale_node, BAD_CAST( "name" ), BAD_CAST( "C" ));
if( is_l10n_value ){
value_root_node = locale_node;
@@ -476,7 +509,7 @@ create_schema_entry( NAXMLWriter *writer,
/* encode special chars <, >, &, ...
*/
- xmlChar *encoded_content = xmlEncodeSpecialChars( doc, BAD_CAST( value ));
+ encoded_content = xmlEncodeSpecialChars( doc, BAD_CAST( value ));
xmlNewChild( value_root_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_DEFAULT ), encoded_content );
xmlFree( encoded_content );
@@ -497,104 +530,115 @@ create_schema_entry( NAXMLWriter *writer,
static xmlDocPtr
create_xml_dump( NAXMLWriter *writer, gint format, NAAction *action )
{
- xmlDocPtr doc = xmlNewDoc( BAD_CAST( "1.0" ));
- xmlNodePtr root_node = xmlNewNode( NULL, BAD_CAST( NACT_GCONF_DUMP_ROOT ));
+ xmlDocPtr doc;
+ xmlNodePtr root_node, list_node;
+ gchar *path;
+ gchar *version, *label, *tooltip, *icon, *text;
+ gboolean enabled;
+ GSList *profiles, *ip;
+ NAActionProfile *profile;
+ gchar *profile_dir;
+ gchar *profile_label, *parameters;
+ GSList *basenames, *mimetypes, *schemes;
+ gboolean match, isfile, isdir, multiple;
+
+ doc = xmlNewDoc( BAD_CAST( "1.0" ));
+ root_node = xmlNewNode( NULL, BAD_CAST( NACT_GCONF_DUMP_ROOT ));
xmlDocSetRootElement( doc, root_node );
- gchar *path = g_build_path( "/", NA_GCONF_CONFIG_PATH, writer->private->uuid, NULL );
- xmlNodePtr list_node = xmlNewChild( root_node, NULL, BAD_CAST( NACT_GCONF_DUMP_ENTRYLIST ), NULL );
+ path = g_build_path( "/", NA_GCONF_CONFIG_PATH, writer->private->uuid, NULL );
+ list_node = xmlNewChild( root_node, NULL, BAD_CAST( NACT_GCONF_DUMP_ENTRYLIST ), NULL );
xmlNewProp( list_node, BAD_CAST( NACT_GCONF_DUMP_ENTRYLIST_BASE ), BAD_CAST( path ));
g_free( path );
/* version */
- gchar *version = na_action_get_version( action );
+ version = na_action_get_version( action );
create_dump_entry( writer, format, NULL, ACTION_VERSION_ENTRY, version, doc, list_node, "string" );
g_free( version );
/* label */
- gchar *label = na_action_get_label( action );
+ label = na_action_get_label( action );
create_dump_entry( writer, format, NULL, ACTION_LABEL_ENTRY, label, doc, list_node, "string" );
g_free( label );
/* tooltip */
- gchar *tooltip = na_action_get_tooltip( action );
+ tooltip = na_action_get_tooltip( action );
create_dump_entry( writer, format, NULL, ACTION_TOOLTIP_ENTRY, tooltip, doc, list_node, "string" );
g_free( tooltip );
/* icon name */
- gchar *icon = na_action_get_icon( action );
+ icon = na_action_get_icon( action );
create_dump_entry( writer, format, NULL, ACTION_ICON_ENTRY, icon, doc, list_node, "string" );
g_free( icon );
/* enabled */
- gboolean enabled = na_action_is_enabled( action );
- gchar *text = na_utils_boolean_to_schema( enabled );
+ enabled = na_action_is_enabled( action );
+ text = na_utils_boolean_to_schema( enabled );
create_dump_entry( writer, format, NULL, ACTION_ENABLED_ENTRY, text, doc, list_node, "bool" );
g_free( text );
- GSList *profiles = na_action_get_profiles( action );
- GSList *ip;
+ profiles = na_action_get_profiles( action );
for( ip = profiles ; ip ; ip = ip->next ){
- NAActionProfile *profile = NA_ACTION_PROFILE( ip->data );
- gchar *profile_dir = na_action_profile_get_name( profile );
+ profile = NA_ACTION_PROFILE( ip->data );
+ profile_dir = na_action_profile_get_name( profile );
/* profile label */
- gchar *profile_label = na_action_profile_get_label( profile );
+ profile_label = na_action_profile_get_label( profile );
create_dump_entry( writer, format, profile_dir, ACTION_PROFILE_LABEL_ENTRY, profile_label, doc, list_node, "string" );
g_free( profile_label );
/* path */
- gchar *path = na_action_profile_get_path( profile );
+ path = na_action_profile_get_path( profile );
create_dump_entry( writer, format, profile_dir, ACTION_PATH_ENTRY, path, doc, list_node, "string" );
g_free( path );
/* parameters */
- gchar *parameters = na_action_profile_get_parameters( profile );
+ parameters = na_action_profile_get_parameters( profile );
create_dump_entry( writer, format, profile_dir, ACTION_PARAMETERS_ENTRY, parameters, doc, list_node, "string" );
g_free( parameters );
/* basenames */
- GSList *basenames = na_action_profile_get_basenames( profile );
+ basenames = na_action_profile_get_basenames( profile );
text = na_utils_gslist_to_schema( basenames );
create_dump_entry( writer, format, profile_dir, ACTION_BASENAMES_ENTRY, text, doc, list_node, "list" );
g_free( text );
na_utils_free_string_list( basenames );
/* match_case */
- gboolean match = na_action_profile_get_matchcase( profile );
+ match = na_action_profile_get_matchcase( profile );
text = na_utils_boolean_to_schema( match );
create_dump_entry( writer, format, profile_dir, ACTION_MATCHCASE_ENTRY, text, doc, list_node, "bool" );
g_free( text );
/* mimetypes */
- GSList *mimetypes = na_action_profile_get_mimetypes( profile );
+ mimetypes = na_action_profile_get_mimetypes( profile );
text = na_utils_gslist_to_schema( mimetypes );
create_dump_entry( writer, format, profile_dir, ACTION_MIMETYPES_ENTRY, text, doc, list_node, "list" );
g_free( text );
na_utils_free_string_list( mimetypes );
/* is_file */
- gboolean isfile = na_action_profile_get_is_file( profile );
+ isfile = na_action_profile_get_is_file( profile );
text = na_utils_boolean_to_schema( isfile );
create_dump_entry( writer, format, profile_dir, ACTION_ISFILE_ENTRY, text, doc, list_node, "bool" );
g_free( text );
/* is_dir */
- gboolean isdir = na_action_profile_get_is_dir( profile );
+ isdir = na_action_profile_get_is_dir( profile );
text = na_utils_boolean_to_schema( isdir );
create_dump_entry( writer, format, profile_dir, ACTION_ISDIR_ENTRY, text, doc, list_node, "bool" );
g_free( text );
/* accept-multiple-files */
- gboolean mutiple = na_action_profile_get_multiple( profile );
- text = na_utils_boolean_to_schema( mutiple );
+ multiple = na_action_profile_get_multiple( profile );
+ text = na_utils_boolean_to_schema( multiple );
create_dump_entry( writer, format, profile_dir, ACTION_MULTIPLE_ENTRY, text, doc, list_node, "bool" );
g_free( text );
/* schemes */
- GSList *schemes = na_action_profile_get_schemes( profile );
+ schemes = na_action_profile_get_schemes( profile );
text = na_utils_gslist_to_schema( schemes );
create_dump_entry( writer, format, profile_dir, ACTION_SCHEMES_ENTRY, text, doc, list_node, "list" );
g_free( text );
@@ -612,9 +656,15 @@ create_dump_entry( NAXMLWriter *writer,
const gchar *profile_name, const gchar *key, const gchar *value,
xmlDocPtr doc, xmlNodePtr list_node, const gchar *type )
{
- xmlNodePtr entry_node = xmlNewChild( list_node, NULL, BAD_CAST( NACT_GCONF_DUMP_ENTRY ), NULL );
-
+ xmlNodePtr entry_node;
+ xmlNodePtr value_node;
+ xmlNodePtr value_list_node, value_list_value_node;
gchar *entry = NULL;
+ GSList *list, *is;
+ xmlChar *encoded_content;
+
+ entry_node = xmlNewChild( list_node, NULL, BAD_CAST( NACT_GCONF_DUMP_ENTRY ), NULL );
+
if( profile_name ){
entry = g_strdup_printf( "%s/%s", profile_name, key );
} else {
@@ -623,21 +673,20 @@ create_dump_entry( NAXMLWriter *writer,
xmlNewChild( entry_node, NULL, BAD_CAST( NACT_GCONF_DUMP_KEY ), BAD_CAST( entry ));
g_free( entry );
- xmlNodePtr value_node = xmlNewChild( entry_node, NULL, BAD_CAST( NACT_GCONF_DUMP_VALUE ), NULL );
+ value_node = xmlNewChild( entry_node, NULL, BAD_CAST( NACT_GCONF_DUMP_VALUE ), NULL );
if( !g_ascii_strcasecmp( type, "list" )){
- xmlNodePtr value_list_node = xmlNewChild( value_node, NULL, BAD_CAST( NACT_GCONF_DUMP_LIST ), NULL );
+ value_list_node = xmlNewChild( value_node, NULL, BAD_CAST( NACT_GCONF_DUMP_LIST ), NULL );
xmlNewProp( value_list_node, BAD_CAST( NACT_GCONF_DUMP_LIST_TYPE ), BAD_CAST( NACT_GCONF_DUMP_STRING ));
- xmlNodePtr value_list_value_node = xmlNewChild( value_list_node, NULL, BAD_CAST( NACT_GCONF_DUMP_VALUE ), NULL );
- GSList *list = na_utils_schema_to_gslist( value );
- GSList *is;
+ value_list_value_node = xmlNewChild( value_list_node, NULL, BAD_CAST( NACT_GCONF_DUMP_VALUE ), NULL );
+ list = na_utils_schema_to_gslist( value );
for( is = list ; is ; is = is->next ){
- xmlChar *encoded_content = xmlEncodeSpecialChars( doc, BAD_CAST(( gchar * ) is->data ));
+ encoded_content = xmlEncodeSpecialChars( doc, BAD_CAST(( gchar * ) is->data ));
xmlNewChild( value_list_value_node, NULL, BAD_CAST( NACT_GCONF_DUMP_STRING ), encoded_content );
xmlFree( encoded_content );
}
} else {
- xmlChar *encoded_content = xmlEncodeSpecialChars( doc, BAD_CAST( value ));
+ encoded_content = xmlEncodeSpecialChars( doc, BAD_CAST( value ));
xmlNewChild( value_node, NULL, BAD_CAST( NACT_GCONF_DUMP_STRING ), encoded_content );
xmlFree( encoded_content );
}
@@ -646,10 +695,13 @@ create_dump_entry( NAXMLWriter *writer,
static xmlDocPtr
create_gconf_schema( NAXMLWriter *writer )
{
- xmlDocPtr doc = xmlNewDoc( BAD_CAST( "1.0" ));
- xmlNodePtr root_node = xmlNewNode( NULL, BAD_CAST( NACT_GCONF_SCHEMA_ROOT ));
+ xmlDocPtr doc;
+ xmlNodePtr root_node, list_node;
+
+ doc = xmlNewDoc( BAD_CAST( "1.0" ));
+ root_node = xmlNewNode( NULL, BAD_CAST( NACT_GCONF_SCHEMA_ROOT ));
xmlDocSetRootElement( doc, root_node );
- xmlNodePtr list_node = xmlNewChild( root_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_LIST ), NULL );
+ list_node = xmlNewChild( root_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_LIST ), NULL );
create_gconf_schema_entry( writer, ACTION_VERSION_ENTRY , doc, list_node, "string", ACTION_VERSION_DESC_SHORT , ACTION_VERSION_DESC_LONG , NAUTILUS_ACTIONS_CONFIG_VERSION, FALSE );
create_gconf_schema_entry( writer, ACTION_LABEL_ENTRY , doc, list_node, "string", ACTION_LABEL_DESC_SHORT , ACTION_LABEL_DESC_LONG , "", TRUE );
@@ -677,9 +729,13 @@ create_gconf_schema_entry( NAXMLWriter *writer,
const gchar *short_desc, const gchar *long_desc,
const gchar *default_value, gboolean is_i18n )
{
- xmlNodePtr schema_node = xmlNewChild( list_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_ENTRY ), NULL );
+ xmlNodePtr schema_node;
+ xmlChar *content;
+ xmlNodePtr locale_node;
+
+ schema_node = xmlNewChild( list_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_ENTRY ), NULL );
- xmlChar *content = BAD_CAST( g_build_path( "/", NA_GCONF_SCHEMA_PREFIX, NA_GCONF_CONFIG_PATH, entry, NULL ));
+ content = BAD_CAST( g_build_path( "/", NA_GCONF_SCHEMA_PREFIX, NA_GCONF_CONFIG_PATH, entry, NULL ));
xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_KEY ), content );
xmlFree( content );
@@ -690,7 +746,7 @@ create_gconf_schema_entry( NAXMLWriter *writer,
xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_LIST_TYPE ), BAD_CAST( "string" ));
}
- xmlNodePtr locale_node = xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_LOCALE ), NULL );
+ locale_node = xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_SCHEMA_LOCALE ), NULL );
xmlNewProp( locale_node, BAD_CAST( "name" ), BAD_CAST( "C" ));
content = xmlEncodeSpecialChars( doc, BAD_CAST( default_value ));
diff --git a/src/nact/base-application.c b/src/nact/base-application.c
index 11ef711..c40c537 100644
--- a/src/nact/base-application.c
+++ b/src/nact/base-application.c
@@ -43,6 +43,7 @@
/* private class data
*/
struct BaseApplicationClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -133,9 +134,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "base_application_register_type";
- g_debug( "%s", thisfn );
-
- g_type_init();
+ GType type;
static GTypeInfo info = {
sizeof( BaseApplicationClass ),
@@ -149,24 +148,32 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- return( g_type_register_static( G_TYPE_OBJECT, "BaseApplication", &info, 0 ));
+ g_debug( "%s", thisfn );
+
+ g_type_init();
+
+ type = g_type_register_static( G_TYPE_OBJECT, "BaseApplication", &info, 0 );
+
+ return( type );
}
static void
class_init( BaseApplicationClass *klass )
{
static const gchar *thisfn = "base_application_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ GParamSpec *spec;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ 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;
- GParamSpec *spec;
spec = g_param_spec_int(
PROP_APPLICATION_ARGC,
"Command-line arguments count",
@@ -251,10 +258,12 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "base_application_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ BaseApplication *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( BASE_IS_APPLICATION( instance ));
- BaseApplication *self = BASE_APPLICATION( instance );
+ self = BASE_APPLICATION( instance );
self->private = g_new0( BaseApplicationPrivate, 1 );
@@ -265,8 +274,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
+ BaseApplication *self;
+
g_assert( BASE_IS_APPLICATION( object ));
- BaseApplication *self = BASE_APPLICATION( object );
+ self = BASE_APPLICATION( object );
switch( property_id ){
case PROP_APPLICATION_ARGC_ID:
@@ -314,8 +325,10 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
static void
instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
+ BaseApplication *self;
+
g_assert( BASE_IS_APPLICATION( object ));
- BaseApplication *self = BASE_APPLICATION( object );
+ self = BASE_APPLICATION( object );
switch( property_id ){
case PROP_APPLICATION_ARGC_ID:
@@ -366,10 +379,11 @@ static void
instance_dispose( GObject *application )
{
static const gchar *thisfn = "base_application_instance_dispose";
- g_debug( "%s: application=%p", thisfn, application );
+ BaseApplication *self;
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
- BaseApplication *self = BASE_APPLICATION( application );
+ self = BASE_APPLICATION( application );
if( !self->private->dispose_has_run ){
@@ -392,10 +406,11 @@ static void
instance_finalize( GObject *application )
{
static const gchar *thisfn = "base_application_instance_finalize";
- g_debug( "%s: application=%p", thisfn, application );
+ BaseApplication *self;
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
- BaseApplication *self = ( BaseApplication * ) application;
+ self = ( BaseApplication * ) application;
g_free( self->private->exit_message1 );
g_free( self->private->exit_message2 );
@@ -427,7 +442,8 @@ int
base_application_run( BaseApplication *application )
{
static const gchar *thisfn = "base_application_run";
- g_debug( "%s: application=%p", thisfn, application );
+
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
@@ -451,10 +467,10 @@ base_application_get_application_name( BaseApplication *application )
/*static const gchar *thisfn = "base_application_get_application_name";
g_debug( "%s: application=%p", thisfn, application );*/
- g_assert( BASE_IS_APPLICATION( application ));
-
gchar *name = NULL;
+ g_assert( BASE_IS_APPLICATION( application ));
+
if( BASE_APPLICATION_GET_CLASS( application )->application_get_application_name ){
name = BASE_APPLICATION_GET_CLASS( application )->application_get_application_name( application );
@@ -481,10 +497,10 @@ 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 = NULL;
+ g_assert( BASE_IS_APPLICATION( application ));
+
if( BASE_APPLICATION_GET_CLASS( application )->application_get_icon_name ){
name = BASE_APPLICATION_GET_CLASS( application )->application_get_icon_name( application );
@@ -511,10 +527,10 @@ base_application_get_unique_app_name( BaseApplication *application )
/*static const gchar *thisfn = "base_application_get_unique_app_name";
g_debug( "%s: icon=%p", thisfn, application );*/
- g_assert( BASE_IS_APPLICATION( application ));
-
gchar *name = NULL;
+ g_assert( BASE_IS_APPLICATION( application ));
+
if( BASE_APPLICATION_GET_CLASS( application )->application_get_unique_app_name ){
name = BASE_APPLICATION_GET_CLASS( application )->application_get_unique_app_name( application );
@@ -542,10 +558,10 @@ base_application_get_ui_filename( BaseApplication *application )
/*static const gchar *thisfn = "base_application_get_ui_filename";
g_debug( "%s: icon=%p", thisfn, application );*/
- g_assert( BASE_IS_APPLICATION( application ));
-
gchar *name = NULL;
+ g_assert( BASE_IS_APPLICATION( application ));
+
if( BASE_APPLICATION_GET_CLASS( application )->application_get_ui_filename ){
name = BASE_APPLICATION_GET_CLASS( application )->application_get_ui_filename( application );
@@ -573,8 +589,8 @@ base_application_get_ui_filename( BaseApplication *application )
BaseWindow *
base_application_get_main_window( BaseApplication *application )
{
- static const gchar *thisfn = "base_application_get_main_window";
- g_debug( "%s: application=%p", thisfn, application );
+ /*static const gchar *thisfn = "base_application_get_main_window";
+ g_debug( "%s: application=%p", thisfn, application );*/
g_assert( BASE_IS_APPLICATION( application ));
@@ -699,6 +715,7 @@ gboolean
base_application_yesno_dlg( BaseApplication *application, GtkMessageType type, const gchar *first, const gchar *second )
{
gint result = display_dlg( application, type, GTK_BUTTONS_YES_NO, first, second );
+
return( result == GTK_RESPONSE_YES );
}
@@ -706,8 +723,8 @@ static gboolean
v_initialize( BaseApplication *application )
{
static const gchar *thisfn = "base_application_v_initialize";
- g_debug( "%s: application=%p", thisfn, application );
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
return( BASE_APPLICATION_GET_CLASS( application )->application_initialize( application ));
@@ -717,11 +734,12 @@ static gboolean
v_initialize_i18n( BaseApplication *application )
{
static const gchar *thisfn = "base_application_v_initialize_i18n";
- g_debug( "%s: application=%p", thisfn, application );
+ gboolean ok;
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
- gboolean ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_i18n( application );
+ ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_i18n( application );
if( !ok ){
set_initialize_i18n_error( application );
@@ -734,11 +752,12 @@ static gboolean
v_initialize_gtk( BaseApplication *application )
{
static const gchar *thisfn = "base_application_v_initialize_gtk";
- g_debug( "%s: application=%p", thisfn, application );
+ gboolean ok;
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
- gboolean ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_gtk( application );
+ ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_gtk( application );
if( ok ){
application->private->is_gtk_initialized = TRUE;
@@ -754,11 +773,12 @@ static gboolean
v_initialize_unique_app( BaseApplication *application )
{
static const gchar *thisfn = "base_application_v_initialize_unique_app";
- g_debug( "%s: application=%p", thisfn, application );
+ gboolean ok;
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
- gboolean ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_unique_app( application );
+ ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_unique_app( application );
if( !ok ){
set_initialize_unique_app_error( application );
@@ -771,8 +791,8 @@ static gboolean
v_initialize_ui( BaseApplication *application )
{
static const gchar *thisfn = "base_application_v_initialize_ui";
- g_debug( "%s: application=%p", thisfn, application );
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
return( BASE_APPLICATION_GET_CLASS( application )->application_initialize_ui( application ));
@@ -782,11 +802,12 @@ static gboolean
v_initialize_default_icon( BaseApplication *application )
{
static const gchar *thisfn = "base_application_v_initialize_default_icon";
- g_debug( "%s: application=%p", thisfn, application );
+ gboolean ok;
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
- gboolean ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_default_icon( application );
+ ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_default_icon( application );
if( !ok ){
set_initialize_default_icon_error( application );
@@ -799,11 +820,12 @@ static gboolean
v_initialize_application( BaseApplication *application )
{
static const gchar *thisfn = "base_application_v_initialize_application";
- g_debug( "%s: application=%p", thisfn, application );
+ gboolean ok;
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( BASE_IS_APPLICATION( application ));
- gboolean ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_application( application );
+ ok = BASE_APPLICATION_GET_CLASS( application )->application_initialize_application( application );
if( !ok ){
set_initialize_application_error( application );
@@ -816,7 +838,9 @@ static int
do_application_run( BaseApplication *application )
{
static const gchar *thisfn = "base_application_do_application_run";
- g_debug( "%s: application=%p", thisfn, application );
+ GtkWindow *wnd;
+
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
if( v_initialize( application )){
@@ -825,7 +849,7 @@ do_application_run( BaseApplication *application )
base_window_init( application->private->main_window );
- GtkWindow *wnd = base_window_get_toplevel_dialog( application->private->main_window );
+ wnd = base_window_get_toplevel_dialog( application->private->main_window );
g_assert( wnd );
g_assert( GTK_IS_WINDOW( wnd ));
@@ -889,8 +913,9 @@ static gboolean
do_application_initialize_unique_app( BaseApplication *application )
{
gboolean ret = TRUE;
+ gchar *name;
- gchar *name = base_application_get_unique_app_name( application );
+ name = base_application_get_unique_app_name( application );
if( name && strlen( name )){
application->private->unique_app_handle = unique_app_new( name, NULL );
@@ -906,8 +931,10 @@ do_application_initialize_ui( BaseApplication *application )
{
gboolean ret = TRUE;
GError *error = NULL;
+ gchar *name;
+ guint retint;
- gchar *name = base_application_get_ui_filename( application );
+ name = base_application_get_ui_filename( application );
if( !name || !strlen( name )){
ret = FALSE;
@@ -915,7 +942,7 @@ do_application_initialize_ui( BaseApplication *application )
} else {
application->private->ui_xml = gtk_builder_new();
- guint retint = gtk_builder_add_from_file( application->private->ui_xml, name, &error );
+ retint = gtk_builder_add_from_file( application->private->ui_xml, name, &error );
if( error || retint == 0 ){
ret = FALSE;
set_initialize_ui_add_xml_error( application, name, error );
@@ -930,7 +957,9 @@ do_application_initialize_ui( BaseApplication *application )
static gboolean
do_application_initialize_default_icon( BaseApplication *application )
{
- gchar *name = base_application_get_icon_name( application );
+ gchar *name;
+
+ name = base_application_get_icon_name( application );
if( name && strlen( name )){
gtk_window_set_default_icon_name( name );
@@ -1001,19 +1030,23 @@ on_unique_message_received(
static gint
display_dlg( BaseApplication *application, GtkMessageType type_message, GtkButtonsType type_buttons, const gchar *first, const gchar *second )
{
+ GtkWidget *dialog;
+ const gchar *name;
+ gint result;
+
g_assert( BASE_IS_APPLICATION( application ));
- GtkWidget *dialog = gtk_message_dialog_new( NULL, GTK_DIALOG_MODAL, type_message, type_buttons, "%s", first );
+ dialog = gtk_message_dialog_new( NULL, GTK_DIALOG_MODAL, type_message, type_buttons, "%s", first );
if( second && g_utf8_strlen( second, -1 )){
gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG( dialog ), "%s", second );
}
- const gchar *name = g_get_application_name();
+ name = g_get_application_name();
g_object_set( G_OBJECT( dialog ) , "title", name, NULL );
- gint result = gtk_dialog_run( GTK_DIALOG( dialog ));
+ result = gtk_dialog_run( GTK_DIALOG( dialog ));
gtk_widget_destroy( dialog );
@@ -1035,10 +1068,11 @@ search_for_child_widget( GtkContainer *container, const gchar *name )
GList *children = gtk_container_get_children( container );
GList *ic;
GtkWidget *found = NULL;
+ GtkWidget *child;
for( ic = children ; ic ; ic = ic->next ){
if( GTK_IS_WIDGET( ic->data )){
- GtkWidget *child = GTK_WIDGET( ic->data );
+ child = GTK_WIDGET( ic->data );
if( child->name && strlen( child->name )){
/*g_debug( "%s: child=%s", thisfn, child->name );*/
if( !g_ascii_strcasecmp( name, child->name )){
@@ -1083,11 +1117,13 @@ display_error_message( BaseApplication *application )
static void
set_get_dialog_error( BaseApplication *application, const gchar *dialog )
{
+ gchar *fname, *msg;
+
application->private->exit_code = APPLICATION_ERROR_DIALOG_LOAD;
- gchar *fname = base_application_get_ui_filename( application );
+ fname = base_application_get_ui_filename( application );
- gchar *msg = g_strdup_printf(
+ msg = g_strdup_printf(
/* i18n: unable to load <dialog_name> dialog from XML definition in <filename> */
_( "Unable to load %s dialog from XML definition in %s." ), dialog, fname );
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index 1d0b457..2ee4c74 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -43,6 +43,7 @@
/* private class data
*/
struct BaseWindowClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -114,7 +115,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "base_window_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static GTypeInfo info = {
sizeof( BaseWindowClass ),
@@ -128,24 +129,30 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- return( g_type_register_static( G_TYPE_OBJECT, "BaseWindow", &info, 0 ));
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_OBJECT, "BaseWindow", &info, 0 );
+
+ return( type );
}
static void
class_init( BaseWindowClass *klass )
{
static const gchar *thisfn = "base_window_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ GParamSpec *spec;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ 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;
- GParamSpec *spec;
spec = g_param_spec_pointer(
PROP_WINDOW_PARENT_STR,
PROP_WINDOW_PARENT_STR,
@@ -200,10 +207,12 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "base_window_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ BaseWindow *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( BASE_IS_WINDOW( instance ));
- BaseWindow *self = BASE_WINDOW( instance );
+ self = BASE_WINDOW( instance );
self->private = g_new0( BaseWindowPrivate, 1 );
@@ -213,8 +222,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
+ BaseWindow *self;
+
g_assert( BASE_IS_WINDOW( object ));
- BaseWindow *self = BASE_WINDOW( object );
+ self = BASE_WINDOW( object );
switch( property_id ){
case PROP_WINDOW_PARENT:
@@ -246,8 +257,10 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
static void
instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
+ BaseWindow *self;
+
g_assert( BASE_IS_WINDOW( object ));
- BaseWindow *self = BASE_WINDOW( object );
+ self = BASE_WINDOW( object );
switch( property_id ){
case PROP_WINDOW_PARENT:
@@ -281,10 +294,11 @@ static void
instance_dispose( GObject *window )
{
static const gchar *thisfn = "base_window_instance_dispose";
- g_debug( "%s: window=%p", thisfn, window );
+ BaseWindow *self;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( BASE_IS_WINDOW( window ));
- BaseWindow *self = BASE_WINDOW( window );
+ self = BASE_WINDOW( window );
if( !self->private->dispose_has_run ){
@@ -314,10 +328,11 @@ static void
instance_finalize( GObject *window )
{
static const gchar *thisfn = "base_window_instance_finalize";
- g_debug( "%s: window=%p", thisfn, window );
+ BaseWindow *self;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( BASE_IS_WINDOW( window ));
- BaseWindow *self = ( BaseWindow * ) window;
+ self = ( BaseWindow * ) window;
g_free( self->private->toplevel_name );
@@ -424,9 +439,10 @@ base_window_get_widget( BaseWindow *window, const gchar *name )
static gchar *
v_get_toplevel_name( BaseWindow *window )
{
+ gchar *name;
+
g_assert( BASE_IS_WINDOW( window ));
- gchar *name;
g_object_get( G_OBJECT( window ), PROP_WINDOW_TOPLEVEL_NAME_STR, &name, NULL );
if( !name || !strlen( name )){
@@ -442,9 +458,11 @@ v_get_toplevel_name( BaseWindow *window )
static void
v_initial_load_toplevel( BaseWindow *window )
{
+ GtkWindow *toplevel;
+
g_assert( BASE_IS_WINDOW( window ));
- GtkWindow *toplevel = window->private->toplevel_dialog;
+ toplevel = window->private->toplevel_dialog;
g_assert( toplevel );
g_assert( GTK_IS_WINDOW( toplevel ));
@@ -514,25 +532,28 @@ static void
do_init_window( BaseWindow *window )
{
static const gchar *thisfn = "base_window_do_init_window";
+ gchar *dialog_name;
+ GtkWindow *toplevel;
+
g_assert( BASE_IS_WINDOW( window ));
if( !window->private->initialized ){
- g_debug( "%s: window=%p", thisfn, window );
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
if( !window->private->application ){
g_assert( window->private->parent );
g_assert( BASE_IS_WINDOW( window->private->parent ));
window->private->application = BASE_APPLICATION( base_window_get_application( window->private->parent ));
- g_debug( "%s: application=%p", thisfn, window->private->application );
+ g_debug( "%s: application=%p", thisfn, ( void * ) window->private->application );
}
g_assert( window->private->application );
g_assert( BASE_IS_APPLICATION( window->private->application ));
- gchar *dialog_name = v_get_toplevel_name( window );
+ dialog_name = v_get_toplevel_name( window );
g_assert( dialog_name && strlen( dialog_name ));
- GtkWindow *toplevel = base_window_get_dialog( window, dialog_name );
+ toplevel = base_window_get_dialog( window, dialog_name );
window->private->toplevel_dialog = toplevel;
if( toplevel ){
@@ -554,18 +575,22 @@ static void
do_initial_load_toplevel( BaseWindow *window )
{
static const gchar *thisfn = "base_window_do_initial_load_toplevel";
- g_debug( "%s: window=%p", thisfn, window );
+
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
}
static void
do_runtime_init_toplevel( BaseWindow *window )
{
static const gchar *thisfn = "base_window_do_runtime_init_toplevel";
- g_debug( "%s: window=%p, parent_window=%p", thisfn, window, window->private->parent );
+ GtkWindow *parent_toplevel;
+
+ g_debug( "%s: window=%p, parent_window=%p",
+ thisfn, ( void * ) window, ( void * ) window->private->parent );
if( window->private->parent ){
g_assert( BASE_IS_WINDOW( window->private->parent ));
- GtkWindow *parent_toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window->private->parent ));
+ parent_toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window->private->parent ));
gtk_window_set_transient_for( window->private->toplevel_dialog, parent_toplevel );
}
}
@@ -574,22 +599,26 @@ static void
do_all_widgets_showed( BaseWindow *window )
{
static const gchar *thisfn = "base_window_do_all_widgets_showed";
- g_debug( "%s: window=%p", thisfn, window );
+
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
}
static void
do_run_window( BaseWindow *window )
{
+ static const gchar *thisfn = "base_window_do_run_window";
+ GtkWidget *this_dialog;
+ gint code;
+
if( !window->private->initialized ){
base_window_init( window );
}
v_runtime_init_toplevel( window );
- static const gchar *thisfn = "base_window_do_run_window";
- g_debug( "%s: window=%p", thisfn, window );
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
- GtkWidget *this_dialog = GTK_WIDGET( window->private->toplevel_dialog );
+ this_dialog = GTK_WIDGET( window->private->toplevel_dialog );
gtk_widget_show_all( this_dialog );
v_all_widgets_showed( window );
@@ -601,7 +630,7 @@ do_run_window( BaseWindow *window )
g_signal_connect( G_OBJECT( this_dialog ), "delete-event", G_CALLBACK( v_delete_event ), window );
}
- g_debug( "%s: application=%p, starting gtk_main", thisfn, window->private->application );
+ g_debug( "%s: application=%p, starting gtk_main", thisfn, ( void * ) window->private->application );
gtk_main();
} else if( GTK_IS_ASSISTANT( this_dialog )){
@@ -611,7 +640,6 @@ do_run_window( BaseWindow *window )
} else {
g_assert( GTK_IS_DIALOG( this_dialog ));
g_debug( "%s: starting gtk_dialog_run", thisfn );
- gint code;
do {
code = gtk_dialog_run( GTK_DIALOG( this_dialog ));
}
@@ -623,7 +651,8 @@ static gboolean
do_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window )
{
static const gchar *thisfn = "base_window_do_dialog_response";
- g_debug( "%s: dialog=%p, code=%d, window=%p", thisfn, dialog, code, window );
+
+ g_debug( "%s: dialog=%p, code=%d, window=%p", thisfn, ( void * ) dialog, code, ( void * ) window );
return( TRUE );
}
@@ -672,7 +701,9 @@ static gboolean
is_toplevel_initialized( BaseWindow *window, GtkWindow *toplevel )
{
gboolean initialized;
+
initialized = GPOINTER_TO_UINT( g_object_get_data( G_OBJECT( toplevel ), "base-window-toplevel-initialized" ));
+
return( initialized );
}
diff --git a/src/nact/nact-application.c b/src/nact/nact-application.c
index a9d4a11..0835b42 100644
--- a/src/nact/nact-application.c
+++ b/src/nact/nact-application.c
@@ -43,6 +43,7 @@
/* private class data
*/
struct NactApplicationClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -94,7 +95,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_application_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static GTypeInfo info = {
sizeof( NactApplicationClass ),
@@ -108,24 +109,31 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- return( g_type_register_static( BASE_APPLICATION_TYPE, "NactApplication", &info, 0 ));
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( BASE_APPLICATION_TYPE, "NactApplication", &info, 0 );
+
+ return( type );
}
static void
class_init( NactApplicationClass *klass )
{
static const gchar *thisfn = "nact_application_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ GParamSpec *spec;
+ BaseApplicationClass *appli_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = BASE_APPLICATION_CLASS( g_type_class_peek_parent( klass ));
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ 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;
- GParamSpec *spec;
spec = g_param_spec_pointer(
PROP_PIVOT_STR,
PROP_PIVOT_STR,
@@ -135,7 +143,7 @@ class_init( NactApplicationClass *klass )
klass->private = g_new0( NactApplicationClassPrivate, 1 );
- BaseApplicationClass *appli_class = BASE_APPLICATION_CLASS( klass );
+ appli_class = BASE_APPLICATION_CLASS( klass );
appli_class->application_initialize_unique_app = appli_initialize_unique_app;
appli_class->application_initialize_application = appli_initialize_application;
@@ -150,10 +158,12 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "nact_application_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NactApplication *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NACT_IS_APPLICATION( instance ));
- NactApplication *self = NACT_APPLICATION( instance );
+ self = NACT_APPLICATION( instance );
self->private = g_new0( NactApplicationPrivate, 1 );
@@ -163,8 +173,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
+ NactApplication *self;
+
g_assert( NACT_IS_APPLICATION( object ));
- NactApplication *self = NACT_APPLICATION( object );
+ self = NACT_APPLICATION( object );
switch( property_id ){
case PROP_PIVOT:
@@ -180,8 +192,10 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
static void
instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
+ NactApplication *self;
+
g_assert( NACT_IS_APPLICATION( object ));
- NactApplication *self = NACT_APPLICATION( object );
+ self = NACT_APPLICATION( object );
switch( property_id ){
case PROP_PIVOT:
@@ -198,10 +212,11 @@ static void
instance_dispose( GObject *application )
{
static const gchar *thisfn = "nact_application_instance_dispose";
- g_debug( "%s: application=%p", thisfn, application );
+ NactApplication *self;
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( NACT_IS_APPLICATION( application ));
- NactApplication *self = NACT_APPLICATION( application );
+ self = NACT_APPLICATION( application );
if( !self->private->dispose_has_run ){
@@ -220,10 +235,11 @@ static void
instance_finalize( GObject *application )
{
static const gchar *thisfn = "nact_application_instance_finalize";
- g_debug( "%s: application=%p", thisfn, application );
+ NactApplication *self;
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
g_assert( NACT_IS_APPLICATION( application ));
- NactApplication *self = ( NactApplication * ) application;
+ self = ( NactApplication * ) application;
g_free( self->private );
@@ -273,13 +289,16 @@ nact_application_get_pivot( NactApplication *application )
static gboolean
appli_initialize_unique_app( BaseApplication *application )
{
+ gboolean ok;
+ gchar *msg1, *msg2;
+
/* call parent class */
- gboolean ok = st_parent_class->application_initialize_unique_app( application );
+ ok = st_parent_class->application_initialize_unique_app( application );
if( !ok ){
- gchar *msg1 = g_strdup( _( "Another instance of Nautilus Actions Configuration Tool is already running." ));
+ msg1 = g_strdup( _( "Another instance of Nautilus Actions Configuration Tool is already running." ));
/* i18n: another instance is already running: second line of error message */
- gchar *msg2 = g_strdup( _( "Please switch back to it." ));
+ msg2 = g_strdup( _( "Please switch back to it." ));
g_object_set( G_OBJECT( application ),
PROP_APPLICATION_EXIT_MESSAGE1, msg1,
@@ -300,10 +319,12 @@ appli_initialize_unique_app( BaseApplication *application )
static gboolean
appli_initialize_application( BaseApplication *application )
{
+ gboolean ok;
+
NACT_APPLICATION( application )->private->pivot = na_pivot_new( NULL );
/* call parent class */
- gboolean ok = st_parent_class->application_initialize_application( application );
+ ok = st_parent_class->application_initialize_application( application );
return( ok );
}
@@ -312,7 +333,8 @@ static gchar *
appli_get_application_name( BaseApplication *application )
{
static const gchar *thisfn = "nact_application_appli_get_application_name";
- g_debug( "%s: application=%p", thisfn, application );
+
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
/* i18n: this is the application name, used in window title */
return( g_strdup( _( "Nautilus Actions Configuration Tool" )));
@@ -322,7 +344,8 @@ static gchar *
appli_get_icon_name( BaseApplication *application )
{
static const gchar *thisfn = "nact_application_appli_get_icon_name";
- g_debug( "%s: application=%p", thisfn, application );
+
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
return( na_about_get_icon_name());
}
@@ -331,7 +354,8 @@ static gchar *
appli_get_unique_app_name( BaseApplication *application )
{
static const gchar *thisfn = "nact_application_appli_get_unique_app_name";
- g_debug( "%s: application=%p", thisfn, application );
+
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
return( g_strdup( "org.nautilus-actions.ConfigurationTool" ));
}
@@ -350,9 +374,11 @@ static GObject *
appli_get_main_window( BaseApplication *application )
{
static const gchar *thisfn = "nact_application_appli_get_main_window";
- g_debug( "%s: application=%p", thisfn, application );
+ BaseWindow *window;
+
+ g_debug( "%s: application=%p", thisfn, ( void * ) application );
- BaseWindow *window = BASE_WINDOW( nact_main_window_new( application ));
+ window = BASE_WINDOW( nact_main_window_new( application ));
na_pivot_add_consumer(
NA_PIVOT( nact_application_get_pivot( NACT_APPLICATION( application ))),
diff --git a/src/nact/nact-assistant-export.c b/src/nact/nact-assistant-export.c
index a210484..041f409 100644
--- a/src/nact/nact-assistant-export.c
+++ b/src/nact/nact-assistant-export.c
@@ -70,6 +70,7 @@ enum {
/* private class data
*/
struct NactAssistantExportClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -86,53 +87,53 @@ struct NactAssistantExportPrivate {
static GObjectClass *st_parent_class = NULL;
-static GType register_type( void );
-static void class_init( NactAssistantExportClass *klass );
-static void iactions_list_iface_init( NactIActionsListInterface *iface );
-static void instance_init( GTypeInstance *instance, gpointer klass );
-static void instance_dispose( GObject *application );
-static void instance_finalize( GObject *application );
+static GType register_type( void );
+static void class_init( NactAssistantExportClass *klass );
+static void iactions_list_iface_init( NactIActionsListInterface *iface );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *application );
+static void instance_finalize( GObject *application );
static NactAssistantExport *assist_new( BaseApplication *application );
-static gchar *do_get_iprefs_window_id( NactWindow *window );
-static gchar *do_get_dialog_name( BaseWindow *dialog );
-static GSList *get_actions( NactWindow *window );
-static void on_initial_load_dialog( BaseWindow *dialog );
-static void on_runtime_init_dialog( BaseWindow *dialog );
-static void on_all_widgets_showed( BaseWindow *dialog );
-static void on_apply( NactAssistant *window, GtkAssistant *assistant );
-static void on_prepare( NactAssistant *window, GtkAssistant *assistant, GtkWidget *page );
-
-static void assist_initial_load_intro( NactAssistantExport *window, GtkAssistant *assistant );
-static void assist_runtime_init_intro( NactAssistantExport *window, GtkAssistant *assistant );
-
-static void assist_initial_load_actions_list( NactAssistantExport *window, GtkAssistant *assistant );
-static void assist_runtime_init_actions_list( NactAssistantExport *window, GtkAssistant *assistant );
-static void on_actions_list_selection_changed( GtkTreeSelection *selection, gpointer user_data );
-
-static void assist_initial_load_target_folder( NactAssistantExport *window, GtkAssistant *assistant );
-static void assist_runtime_init_target_folder( NactAssistantExport *window, GtkAssistant *assistant );
-static GtkFileChooser *get_folder_chooser( NactAssistantExport *window );
-static void on_folder_selection_changed( GtkFileChooser *chooser, gpointer user_data );
-static gboolean is_writable_dir( const gchar *uri );
-
-static void assist_initial_load_format( NactAssistantExport *window, GtkAssistant *assistant );
-static void assist_runtime_init_format( NactAssistantExport *window, GtkAssistant *assistant );
-static void on_format_toggled( GtkToggleButton *button, gpointer user_data );
-static GtkWidget *get_gconfschemav1_button( NactWindow *window );
-static GtkWidget *get_gconfschemav2_button( NactWindow *window );
-static GtkWidget *get_gconfdump_button( NactWindow *window );
-
-static void assist_initial_load_confirm( NactAssistantExport *window, GtkAssistant *assistant );
-static void assist_runtime_init_confirm( NactAssistantExport *window, GtkAssistant *assistant );
-static void assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, GtkWidget *page );
-
-static void assist_initial_load_exportdone( NactAssistantExport *window, GtkAssistant *assistant );
-static void assist_runtime_init_exportdone( NactAssistantExport *window, GtkAssistant *assistant );
-static void assist_prepare_exportdone( NactAssistantExport *window, GtkAssistant *assistant, GtkWidget *page );
-
-static void do_export( NactAssistantExport *window );
+static gchar *do_get_iprefs_window_id( NactWindow *window );
+static gchar *do_get_dialog_name( BaseWindow *dialog );
+static GSList *get_actions( NactWindow *window );
+static void on_initial_load_dialog( BaseWindow *dialog );
+static void on_runtime_init_dialog( BaseWindow *dialog );
+static void on_all_widgets_showed( BaseWindow *dialog );
+static void on_apply( NactAssistant *window, GtkAssistant *assistant );
+static void on_prepare( NactAssistant *window, GtkAssistant *assistant, GtkWidget *page );
+
+static void assist_initial_load_intro( NactAssistantExport *window, GtkAssistant *assistant );
+static void assist_runtime_init_intro( NactAssistantExport *window, GtkAssistant *assistant );
+
+static void assist_initial_load_actions_list( NactAssistantExport *window, GtkAssistant *assistant );
+static void assist_runtime_init_actions_list( NactAssistantExport *window, GtkAssistant *assistant );
+static void on_actions_list_selection_changed( GtkTreeSelection *selection, gpointer user_data );
+
+static void assist_initial_load_target_folder( NactAssistantExport *window, GtkAssistant *assistant );
+static void assist_runtime_init_target_folder( NactAssistantExport *window, GtkAssistant *assistant );
+static GtkFileChooser *get_folder_chooser( NactAssistantExport *window );
+static void on_folder_selection_changed( GtkFileChooser *chooser, gpointer user_data );
+static gboolean is_writable_dir( const gchar *uri );
+
+static void assist_initial_load_format( NactAssistantExport *window, GtkAssistant *assistant );
+static void assist_runtime_init_format( NactAssistantExport *window, GtkAssistant *assistant );
+static void on_format_toggled( GtkToggleButton *button, gpointer user_data );
+static GtkWidget *get_gconfschemav1_button( NactWindow *window );
+static GtkWidget *get_gconfschemav2_button( NactWindow *window );
+static GtkWidget *get_gconfdump_button( NactWindow *window );
+
+static void assist_initial_load_confirm( NactAssistantExport *window, GtkAssistant *assistant );
+static void assist_runtime_init_confirm( NactAssistantExport *window, GtkAssistant *assistant );
+static void assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, GtkWidget *page );
+
+static void assist_initial_load_exportdone( NactAssistantExport *window, GtkAssistant *assistant );
+static void assist_runtime_init_exportdone( NactAssistantExport *window, GtkAssistant *assistant );
+static void assist_prepare_exportdone( NactAssistantExport *window, GtkAssistant *assistant, GtkWidget *page );
+
+static void do_export( NactAssistantExport *window );
#ifdef NA_MAINTAINER_MODE
static void dump( NactAssistantExport *window );
@@ -154,7 +155,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_assistant_export_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static GTypeInfo info = {
sizeof( NactAssistantExportClass ),
@@ -168,16 +169,16 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( NACT_ASSISTANT_TYPE, "NactAssistantExport", &info, 0 );
-
- /* implement IActionsList interface
- */
static const GInterfaceInfo iactions_list_iface_info = {
( GInterfaceInitFunc ) iactions_list_iface_init,
NULL,
NULL
};
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( NACT_ASSISTANT_TYPE, "NactAssistantExport", &info, 0 );
+
g_type_add_interface_static( type, NACT_IACTIONS_LIST_TYPE, &iactions_list_iface_info );
return( type );
@@ -187,26 +188,31 @@ static void
class_init( NactAssistantExportClass *klass )
{
static const gchar *thisfn = "nact_assistant_export_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ BaseWindowClass *base_class;
+ NactWindowClass *nact_class;
+ NactAssistantClass *assist_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
klass->private = g_new0( NactAssistantExportClassPrivate, 1 );
- BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
+ base_class = BASE_WINDOW_CLASS( klass );
base_class->get_toplevel_name = do_get_dialog_name;
base_class->initial_load_toplevel = on_initial_load_dialog;
base_class->runtime_init_toplevel = on_runtime_init_dialog;
base_class->all_widgets_showed = on_all_widgets_showed;
- NactWindowClass *nact_class = NACT_WINDOW_CLASS( klass );
+ nact_class = NACT_WINDOW_CLASS( klass );
nact_class->get_iprefs_window_id = do_get_iprefs_window_id;
- NactAssistantClass *assist_class = NACT_ASSISTANT_CLASS( klass );
+ assist_class = NACT_ASSISTANT_CLASS( klass );
assist_class->on_assistant_apply = on_apply;
assist_class->on_assistant_prepare = on_prepare;
}
@@ -215,7 +221,8 @@ static void
iactions_list_iface_init( NactIActionsListInterface *iface )
{
static const gchar *thisfn = "nact_assistant_export_iactions_list_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->get_actions = get_actions;
iface->on_selection_changed = on_actions_list_selection_changed;
@@ -225,10 +232,11 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "nact_assistant_export_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NactAssistantExport *self;
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NACT_IS_ASSISTANT_EXPORT( instance ));
- NactAssistantExport *self = NACT_ASSISTANT_EXPORT( instance );
+ self = NACT_ASSISTANT_EXPORT( instance );
self->private = g_new0( NactAssistantExportPrivate, 1 );
@@ -241,10 +249,11 @@ static void
instance_dispose( GObject *window )
{
static const gchar *thisfn = "nact_assistant_export_instance_dispose";
- g_debug( "%s: window=%p", thisfn, window );
+ NactAssistantExport *self;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_ASSISTANT_EXPORT( window ));
- NactAssistantExport *self = NACT_ASSISTANT_EXPORT( window );
+ self = NACT_ASSISTANT_EXPORT( window );
if( !self->private->dispose_has_run ){
@@ -259,10 +268,11 @@ static void
instance_finalize( GObject *window )
{
static const gchar *thisfn = "nact_assistant_export_instance_finalize";
- g_debug( "%s: window=%p", thisfn, window );
+ NactAssistantExport *self;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_ASSISTANT_EXPORT( window ));
- NactAssistantExport *self = ( NactAssistantExport * ) window;
+ self = ( NactAssistantExport * ) window;
g_free( self->private->uri );
na_utils_free_string_list( self->private->fnames );
@@ -290,9 +300,12 @@ assist_new( BaseApplication *application )
void
nact_assistant_export_run( NactWindow *main_window )
{
- BaseApplication *appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( main_window )));
+ BaseApplication *appli;
+ NactAssistantExport *assist;
- NactAssistantExport *assist = assist_new( appli );
+ appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( main_window )));
+
+ assist = assist_new( appli );
g_object_set( G_OBJECT( assist ), PROP_WINDOW_PARENT_STR, main_window, NULL );
assist->private->main_window = NACT_MAIN_WINDOW( main_window );
@@ -322,17 +335,19 @@ static void
on_initial_load_dialog( BaseWindow *dialog )
{
static const gchar *thisfn = "nact_assistant_export_on_initial_load_dialog";
+ NactAssistantExport *window;
+ GtkAssistant *assistant;
/* call parent class at the very beginning */
if( BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel ){
BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel( dialog );
}
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
g_assert( NACT_IS_ASSISTANT_EXPORT( dialog ));
- NactAssistantExport *window = NACT_ASSISTANT_EXPORT( dialog );
+ window = NACT_ASSISTANT_EXPORT( dialog );
- GtkAssistant *assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( dialog ));
+ assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( dialog ));
assist_initial_load_intro( window, assistant );
assist_initial_load_actions_list( window, assistant );
@@ -346,17 +361,19 @@ static void
on_runtime_init_dialog( BaseWindow *dialog )
{
static const gchar *thisfn = "nact_assistant_export_on_runtime_init_dialog";
+ NactAssistantExport *window;
+ GtkAssistant *assistant;
/* call parent class at the very beginning */
if( BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel ){
BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel( dialog );
}
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
g_assert( NACT_IS_ASSISTANT_EXPORT( dialog ));
- NactAssistantExport *window = NACT_ASSISTANT_EXPORT( dialog );
+ window = NACT_ASSISTANT_EXPORT( dialog );
- GtkAssistant *assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( dialog ));
+ assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( dialog ));
assist_runtime_init_intro( window, assistant );
assist_runtime_init_actions_list( window, assistant );
@@ -386,7 +403,7 @@ static void
on_apply( NactAssistant *window, GtkAssistant *assistant )
{
static const gchar *thisfn = "nact_assistant_export_on_apply";
- g_debug( "%s: window=%p, assistant=%p", thisfn, window, assistant );
+ g_debug( "%s: window=%p, assistant=%p", thisfn, ( void * ) window, ( void * ) assistant );
}
static void
@@ -420,9 +437,11 @@ static void
assist_runtime_init_intro( NactAssistantExport *window, GtkAssistant *assistant )
{
static const gchar *thisfn = "nact_assistant_export_runtime_init_intro";
- g_debug( "%s: window=%p, assistant=%p", thisfn, window, assistant );
+ GtkWidget *content;
+
+ g_debug( "%s: window=%p, assistant=%p", thisfn, ( void * ) window, ( void * ) assistant );
- GtkWidget *content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_INTRO );
+ content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_INTRO );
gtk_assistant_set_page_complete( assistant, content, TRUE );
}
@@ -439,9 +458,12 @@ assist_initial_load_actions_list( NactAssistantExport *window, GtkAssistant *ass
static void
assist_runtime_init_actions_list( NactAssistantExport *window, GtkAssistant *assistant )
{
+ GtkWidget *content;
+
nact_iactions_list_runtime_init( NACT_WINDOW( window ));
- GtkWidget *content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_ACTIONS_SELECTION );
+ content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_ACTIONS_SELECTION );
+
gtk_assistant_set_page_complete( assistant, content, FALSE );
}
@@ -451,14 +473,19 @@ on_actions_list_selection_changed( GtkTreeSelection *selection, gpointer user_da
/*static const gchar *thisfn = "nact_assistant_export_on_actions_list_selection_changed";
g_debug( "%s: selection=%p, user_data=%p", thisfn, selection, user_data );*/
+ GtkAssistant *assistant;
+ gint pos;
+ gboolean enabled;
+ GtkWidget *content;
+
g_assert( NACT_IS_ASSISTANT_EXPORT( user_data ));
- GtkAssistant *assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( BASE_WINDOW( user_data )));
- gint pos = gtk_assistant_get_current_page( assistant );
+ assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( BASE_WINDOW( user_data )));
+ pos = gtk_assistant_get_current_page( assistant );
if( pos == ASSIST_PAGE_ACTIONS_SELECTION ){
- gboolean enabled = ( gtk_tree_selection_count_selected_rows( selection ) > 0 );
+ enabled = ( gtk_tree_selection_count_selected_rows( selection ) > 0 );
- GtkWidget *content = gtk_assistant_get_nth_page( assistant, pos );
+ content = gtk_assistant_get_nth_page( assistant, pos );
gtk_assistant_set_page_complete( assistant, content, enabled );
gtk_assistant_update_buttons_state( assistant );
}
@@ -475,10 +502,14 @@ assist_initial_load_target_folder( NactAssistantExport *window, GtkAssistant *as
static void
assist_runtime_init_target_folder( NactAssistantExport *window, GtkAssistant *assistant )
{
- GtkFileChooser *chooser = get_folder_chooser( window );
+ GtkFileChooser *chooser;
+ gchar *uri;
+ GtkWidget *content;
+
+ chooser = get_folder_chooser( window );
gtk_file_chooser_unselect_all( chooser );
- gchar *uri = nact_iprefs_get_export_folder_uri( NACT_WINDOW( window ));
+ uri = nact_iprefs_get_export_folder_uri( NACT_WINDOW( window ));
if( uri && strlen( uri )){
gtk_file_chooser_set_uri( GTK_FILE_CHOOSER( chooser ), uri );
}
@@ -486,7 +517,7 @@ assist_runtime_init_target_folder( NactAssistantExport *window, GtkAssistant *as
nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( chooser ), "selection-changed", G_CALLBACK( on_folder_selection_changed ));
- GtkWidget *content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FOLDER_SELECTION );
+ content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FOLDER_SELECTION );
gtk_assistant_set_page_complete( assistant, content, FALSE );
}
@@ -505,19 +536,26 @@ static void
on_folder_selection_changed( GtkFileChooser *chooser, gpointer user_data )
{
static const gchar *thisfn = "nact_assistant_export_on_folder_selection_changed";
- g_debug( "%s: chooser=%p, user_data=%p", thisfn, chooser, user_data );
-
+ GtkAssistant *assistant;
+ gint pos;
+ gchar *uri;
+ gboolean enabled;
+ NactAssistantExport *assist;
+ GtkWidget *content;
+
+ g_debug( "%s: chooser=%p, user_data=%p", thisfn, ( void * ) chooser, ( void * ) user_data );
g_assert( NACT_IS_ASSISTANT_EXPORT( user_data ));
- GtkAssistant *assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( BASE_WINDOW( user_data )));
- gint pos = gtk_assistant_get_current_page( assistant );
+
+ assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( BASE_WINDOW( user_data )));
+ pos = gtk_assistant_get_current_page( assistant );
if( pos == ASSIST_PAGE_FOLDER_SELECTION ){
- gchar *uri = gtk_file_chooser_get_uri( chooser );
+ uri = gtk_file_chooser_get_uri( chooser );
g_debug( "%s: uri=%s", thisfn, uri );
- gboolean enabled = ( uri && strlen( uri ) && is_writable_dir( uri ));
+ enabled = ( uri && strlen( uri ) && is_writable_dir( uri ));
if( enabled ){
- NactAssistantExport *assist = NACT_ASSISTANT_EXPORT( user_data );
+ assist = NACT_ASSISTANT_EXPORT( user_data );
g_free( assist->private->uri );
assist->private->uri = g_strdup( uri );
nact_iprefs_save_export_folder_uri( NACT_WINDOW( user_data ), uri );
@@ -525,7 +563,7 @@ on_folder_selection_changed( GtkFileChooser *chooser, gpointer user_data )
g_free( uri );
- GtkWidget *content = gtk_assistant_get_nth_page( assistant, pos );
+ content = gtk_assistant_get_nth_page( assistant, pos );
gtk_assistant_set_page_complete( assistant, content, enabled );
gtk_assistant_update_buttons_state( assistant );
}
@@ -535,14 +573,18 @@ static gboolean
is_writable_dir( const gchar *uri )
{
static const gchar *thisfn = "nact_assistant_export_is_writable_dir";
+ GFile *file;
+ GError *error = NULL;
+ GFileInfo *info;
+ GFileType type;
+ gboolean writable;
if( !uri || !strlen( uri )){
return( FALSE );
}
- GFile *file = g_file_new_for_uri( uri );
- GError *error = NULL;
- GFileInfo *info = g_file_query_info( file,
+ file = g_file_new_for_uri( uri );
+ info = g_file_query_info( file,
G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE "," G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, &error );
@@ -553,14 +595,14 @@ is_writable_dir( const gchar *uri )
return( FALSE );
}
- GFileType type = g_file_info_get_file_type( info );
+ type = g_file_info_get_file_type( info );
if( type != G_FILE_TYPE_DIRECTORY ){
g_warning( "%s: %s is not a directory", thisfn, uri );
g_object_unref( info );
return( FALSE );
}
- gboolean writable = g_file_info_get_attribute_boolean( info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE );
+ writable = g_file_info_get_attribute_boolean( info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE );
if( !writable ){
g_warning( "%s: %s is not writable", thisfn, uri );
}
@@ -577,7 +619,10 @@ assist_initial_load_format( NactAssistantExport *window, GtkAssistant *assistant
static void
assist_runtime_init_format( NactAssistantExport *window, GtkAssistant *assistant )
{
- GtkWidget *button = get_gconfschemav1_button( NACT_WINDOW( window ));
+ GtkWidget *button;
+ GtkWidget *content;
+
+ button = get_gconfschemav1_button( NACT_WINDOW( window ));
nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( button ), "toggled", G_CALLBACK( on_format_toggled ));
button = get_gconfschemav2_button( NACT_WINDOW( window ));
@@ -588,15 +633,17 @@ assist_runtime_init_format( NactAssistantExport *window, GtkAssistant *assistant
window->private->format = FORMAT_GCONFENTRY;
nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( button ), "toggled", G_CALLBACK( on_format_toggled ));
- GtkWidget *content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FORMAT_SELECTION );
+ content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FORMAT_SELECTION );
gtk_assistant_set_page_complete( assistant, content, TRUE );
}
static void
on_format_toggled( GtkToggleButton *button, gpointer user_data )
{
+ NactWindow *window;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *window = NACT_WINDOW( user_data );
+ window = NACT_WINDOW( user_data );
if( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( get_gconfschemav1_button( window )))){
NACT_ASSISTANT_EXPORT( window )->private->format = FORMAT_GCONFSCHEMAFILE_V1;
@@ -641,20 +688,24 @@ static void
assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, GtkWidget *page )
{
static const gchar *thisfn = "nact_assistant_export_prepare_confirm";
- g_debug( "%s: window=%p, assistant=%p, page=%p", thisfn, window, assistant, page );
+ gchar *text, *tmp, *text2;
+ gchar *label1, *label2;
+ GSList *actions, *ia;
+
+ g_debug( "%s: window=%p, assistant=%p, page=%p",
+ thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
#ifdef NA_MAINTAINER_MODE
dump( window );
#endif
/* i18n: this is the title of the confirm page of the export assistant */
- gchar *text = g_strdup( _( "About to export selected actions:" ));
- gchar *tmp = g_strdup_printf( "<b>%s</b>\n\n", text );
+ text = g_strdup( _( "About to export selected actions:" ));
+ tmp = g_strdup_printf( "<b>%s</b>\n\n", text );
g_free( text );
text = tmp;
- GSList *actions = nact_iactions_list_get_selected_actions( NACT_WINDOW( window ));
- GSList *ia;
+ actions = nact_iactions_list_get_selected_actions( NACT_WINDOW( window ));
for( ia = actions ; ia ; ia = ia->next ){
tmp = g_strdup_printf( "%s\t%s\n", text, na_action_get_label( NA_ACTION( ia->data )));
@@ -665,14 +716,14 @@ assist_prepare_confirm( NactAssistantExport *window, GtkAssistant *assistant, Gt
g_assert( window->private->uri && strlen( window->private->uri ));
/* i18n: all exported actions go to one destination folder */
- gchar *text2 = g_strdup( _( "Into the destination folder:" ));
+ text2 = g_strdup( _( "Into the destination folder:" ));
tmp = g_strdup_printf( "%s\n\n<b>%s</b>\n\n\t%s", text, text2, window->private->uri );
g_free( text2 );
g_free( text );
text = tmp;
- gchar *label1 = NULL;
- gchar *label2 = NULL;
+ label1 = NULL;
+ label2 = NULL;
switch( window->private->format ){
case FORMAT_GCONFSCHEMAFILE_V1:
label1 = g_strdup( gtk_button_get_label( GTK_BUTTON( get_gconfschemav1_button( NACT_WINDOW( window )))));
@@ -719,7 +770,12 @@ static void
assist_prepare_exportdone( NactAssistantExport *window, GtkAssistant *assistant, GtkWidget *page )
{
static const gchar *thisfn = "nact_assistant_export_prepare_exportdone";
- g_debug( "%s: window=%p, assistant=%p, page=%p", thisfn, window, assistant, page );
+ gchar *text, *tmp, *text2, *bname;
+ GSList *ifn;
+ GFile *file;
+
+ g_debug( "%s: window=%p, assistant=%p, page=%p",
+ thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
do_export( window );
@@ -727,8 +783,6 @@ assist_prepare_exportdone( NactAssistantExport *window, GtkAssistant *assistant,
dump( window );
#endif
- gchar *text, *tmp, *text2;
-
if( window->private->errors ){
/* i18n: error message displayed in the result page of the export assistant */
text = g_strdup( _( "One or more errors have been detected when exporting actions." ));
@@ -757,10 +811,9 @@ assist_prepare_exportdone( NactAssistantExport *window, GtkAssistant *assistant,
g_free( text );
text = tmp;
- GSList *ifn;
for( ifn = window->private->fnames ; ifn ; ifn = ifn->next ){
- GFile *file = g_file_new_for_uri(( gchar * ) ifn->data );
- gchar *bname = g_file_get_basename( file );
+ file = g_file_new_for_uri(( gchar * ) ifn->data );
+ bname = g_file_get_basename( file );
tmp = g_strdup_printf( "%s\t%s\n", text, bname );
g_free( bname );
g_object_unref( file );
@@ -780,19 +833,21 @@ static void
do_export( NactAssistantExport *window )
{
static const gchar *thisfn = "nact_assistant_export_do_export";
- g_debug( "%s: window=%p", thisfn, window );
-
- GSList *actions = nact_iactions_list_get_selected_actions( NACT_WINDOW( window ));
- GSList *ia;
+ GSList *actions, *ia;
gchar *msg = NULL;
gchar *reason = NULL;
- gchar *tmp;
+ gchar *tmp, *fname;
+ NAAction *action;
+
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
+
+ actions = nact_iactions_list_get_selected_actions( NACT_WINDOW( window ));
g_assert( window->private->uri && strlen( window->private->uri ));
for( ia = actions ; ia ; ia = ia->next ){
- NAAction *action = NA_ACTION( ia->data );
- gchar *fname = na_xml_writer_export( action, window->private->uri, window->private->format, &msg );
+ action = NA_ACTION( ia->data );
+ fname = na_xml_writer_export( action, window->private->uri, window->private->format, &msg );
if( fname && strlen( fname )){
window->private->fnames = g_slist_prepend( window->private->fnames, fname );
@@ -829,8 +884,8 @@ static void
dump( NactAssistantExport *window )
{
static const gchar *thisfn = "nact_assistant_export_dump";
- g_debug( "%s: window=%p", thisfn, window );
- g_debug( "%s: private=%p", thisfn, window->private );
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
+ g_debug( "%s: private=%p", thisfn, ( void * ) window->private );
g_debug( "%s: dispose_has_run=%s", thisfn, window->private->dispose_has_run ? "True":"False" );
g_debug( "%s: uri=%s", thisfn, window->private->uri );
g_debug( "%s: errors=%d", thisfn, window->private->errors );
diff --git a/src/nact/nact-assistant-import.c b/src/nact/nact-assistant-import.c
index 6c4fd21..dc3d1e3 100644
--- a/src/nact/nact-assistant-import.c
+++ b/src/nact/nact-assistant-import.c
@@ -71,6 +71,7 @@ typedef struct {
/* private class data
*/
struct NactAssistantImportClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -83,26 +84,26 @@ struct NactAssistantImportPrivate {
static GObjectClass *st_parent_class = NULL;
-static GType register_type( void );
-static void class_init( NactAssistantImportClass *klass );
-static void instance_init( GTypeInstance *instance, gpointer klass );
-static void instance_dispose( GObject *application );
-static void instance_finalize( GObject *application );
+static GType register_type( void );
+static void class_init( NactAssistantImportClass *klass );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *application );
+static void instance_finalize( GObject *application );
static NactAssistantImport *assist_new( BaseApplication *application );
-static gchar *do_get_iprefs_window_id( NactWindow *window );
-static gchar *do_get_dialog_name( BaseWindow *dialog );
-static void on_runtime_init_dialog( BaseWindow *dialog );
-static void runtime_init_intro( NactAssistantImport *window, GtkAssistant *assistant );
-static void runtime_init_file_selector( NactAssistantImport *window, GtkAssistant *assistant );
-static void on_file_selection_changed( GtkFileChooser *chooser, gpointer user_data );
-static gboolean has_readable_files( GSList *uris );
-static void on_prepare( NactAssistant *window, GtkAssistant *assistant, GtkWidget *page );
-static void prepare_confirm( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page );
-static void prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page );
-static void do_import( NactAssistantImport *window, GtkAssistant *assistant );
-static void free_results( GSList *list );
+static gchar *do_get_iprefs_window_id( NactWindow *window );
+static gchar *do_get_dialog_name( BaseWindow *dialog );
+static void on_runtime_init_dialog( BaseWindow *dialog );
+static void runtime_init_intro( NactAssistantImport *window, GtkAssistant *assistant );
+static void runtime_init_file_selector( NactAssistantImport *window, GtkAssistant *assistant );
+static void on_file_selection_changed( GtkFileChooser *chooser, gpointer user_data );
+static gboolean has_readable_files( GSList *uris );
+static void on_prepare( NactAssistant *window, GtkAssistant *assistant, GtkWidget *page );
+static void prepare_confirm( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page );
+static void prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page );
+static void do_import( NactAssistantImport *window, GtkAssistant *assistant );
+static void free_results( GSList *list );
GType
nact_assistant_import_get_type( void )
@@ -120,7 +121,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_assistant_import_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static GTypeInfo info = {
sizeof( NactAssistantImportClass ),
@@ -134,7 +135,9 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( NACT_ASSISTANT_TYPE, "NactAssistantImport", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( NACT_ASSISTANT_TYPE, "NactAssistantImport", &info, 0 );
return( type );
}
@@ -143,24 +146,29 @@ static void
class_init( NactAssistantImportClass *klass )
{
static const gchar *thisfn = "nact_assistant_import_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ BaseWindowClass *base_class;
+ NactWindowClass *nact_class;
+ NactAssistantClass *assist_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
klass->private = g_new0( NactAssistantImportClassPrivate, 1 );
- BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
+ base_class = BASE_WINDOW_CLASS( klass );
base_class->get_toplevel_name = do_get_dialog_name;
base_class->runtime_init_toplevel = on_runtime_init_dialog;
- NactWindowClass *nact_class = NACT_WINDOW_CLASS( klass );
+ nact_class = NACT_WINDOW_CLASS( klass );
nact_class->get_iprefs_window_id = do_get_iprefs_window_id;
- NactAssistantClass *assist_class = NACT_ASSISTANT_CLASS( klass );
+ assist_class = NACT_ASSISTANT_CLASS( klass );
assist_class->on_assistant_prepare = on_prepare;
}
@@ -168,10 +176,12 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "nact_assistant_import_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NactAssistantImport *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NACT_IS_ASSISTANT_IMPORT( instance ));
- NactAssistantImport *self = NACT_ASSISTANT_IMPORT( instance );
+ self = NACT_ASSISTANT_IMPORT( instance );
self->private = g_new0( NactAssistantImportPrivate, 1 );
@@ -183,10 +193,11 @@ static void
instance_dispose( GObject *window )
{
static const gchar *thisfn = "nact_assistant_import_instance_dispose";
- g_debug( "%s: window=%p", thisfn, window );
+ NactAssistantImport *self;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_ASSISTANT_IMPORT( window ));
- NactAssistantImport *self = NACT_ASSISTANT_IMPORT( window );
+ self = NACT_ASSISTANT_IMPORT( window );
if( !self->private->dispose_has_run ){
@@ -201,10 +212,11 @@ static void
instance_finalize( GObject *window )
{
static const gchar *thisfn = "nact_assistant_import_instance_finalize";
- g_debug( "%s: window=%p", thisfn, window );
+ NactAssistantImport *self;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_ASSISTANT_IMPORT( window ));
- NactAssistantImport *self = ( NactAssistantImport * ) window;
+ self = ( NactAssistantImport * ) window;
free_results( self->private->results );
@@ -230,9 +242,12 @@ assist_new( BaseApplication *application )
GSList *
nact_assistant_import_run( NactWindow *main_window )
{
- BaseApplication *appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( main_window )));
+ BaseApplication *appli;
+ NactAssistantImport *assist;
- NactAssistantImport *assist = assist_new( appli );
+ appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( main_window )));
+
+ assist = assist_new( appli );
g_object_set( G_OBJECT( assist ), PROP_WINDOW_PARENT_STR, main_window, NULL );
@@ -257,17 +272,19 @@ static void
on_runtime_init_dialog( BaseWindow *dialog )
{
static const gchar *thisfn = "nact_assistant_import_on_runtime_init_dialog";
+ NactAssistantImport *window;
+ GtkAssistant *assistant;
/* call parent class at the very beginning */
if( BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel ){
BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel( dialog );
}
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
g_assert( NACT_IS_ASSISTANT_IMPORT( dialog ));
- NactAssistantImport *window = NACT_ASSISTANT_IMPORT( dialog );
+ window = NACT_ASSISTANT_IMPORT( dialog );
- GtkAssistant *assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( dialog ));
+ assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( dialog ));
runtime_init_intro( window, assistant );
runtime_init_file_selector( window, assistant );
@@ -277,10 +294,12 @@ static void
runtime_init_intro( NactAssistantImport *window, GtkAssistant *assistant )
{
static const gchar *thisfn = "nact_assistant_import_runtime_init_intro";
+ GtkWidget *content;
- GtkWidget *content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_INTRO );
+ content = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_INTRO );
- g_debug( "%s: window=%p, assistant=%p, content=%p", thisfn, window, assistant, content );
+ g_debug( "%s: window=%p, assistant=%p, content=%p",
+ thisfn, ( void * ) window, ( void * ) assistant, ( void * ) content );
gtk_assistant_set_page_complete( assistant, content, TRUE );
}
@@ -289,12 +308,15 @@ static void
runtime_init_file_selector( NactAssistantImport *window, GtkAssistant *assistant )
{
static const gchar *thisfn = "nact_assistant_import_runtime_init_file_selector";
+ GtkWidget *chooser;
+ gchar *uri;
- GtkWidget *chooser = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FILES_SELECTION );
+ chooser = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FILES_SELECTION );
- g_debug( "%s: window=%p, assistant=%p, chooser=%p", thisfn, window, assistant, chooser );
+ g_debug( "%s: window=%p, assistant=%p, chooser=%p",
+ thisfn, ( void * ) window, ( void * ) assistant, ( void * ) chooser );
- gchar *uri = nact_iprefs_get_import_folder_uri( NACT_WINDOW( window ));
+ uri = nact_iprefs_get_import_folder_uri( NACT_WINDOW( window ));
if( uri && strlen( uri )){
gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( chooser ), uri );
}
@@ -311,23 +333,30 @@ on_file_selection_changed( GtkFileChooser *chooser, gpointer user_data )
/*static const gchar *thisfn = "nact_assistant_import_on_file_selection_changed";
g_debug( "%s: chooser=%p, user_data=%p", thisfn, chooser, user_data );*/
+ GtkAssistant *assistant;
+ gint pos;
+ GSList *uris;
+ gboolean enabled;
+ gchar *folder;
+ GtkWidget *content;
+
g_assert( NACT_IS_ASSISTANT_IMPORT( user_data ));
- GtkAssistant *assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( BASE_WINDOW( user_data )));
- gint pos = gtk_assistant_get_current_page( assistant );
+ assistant = GTK_ASSISTANT( base_window_get_toplevel_dialog( BASE_WINDOW( user_data )));
+ pos = gtk_assistant_get_current_page( assistant );
if( pos == ASSIST_PAGE_FILES_SELECTION ){
- GSList *uris = gtk_file_chooser_get_uris( chooser );
- gboolean enabled = has_readable_files( uris );
+ uris = gtk_file_chooser_get_uris( chooser );
+ enabled = has_readable_files( uris );
if( enabled ){
- gchar *folder = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( chooser ));
+ folder = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( chooser ));
nact_iprefs_save_import_folder_uri( NACT_WINDOW( user_data ), folder );
g_free( folder );
}
na_utils_free_string_list( uris );
- GtkWidget *content = gtk_assistant_get_nth_page( assistant, pos );
+ content = gtk_assistant_get_nth_page( assistant, pos );
gtk_assistant_set_page_complete( assistant, content, enabled );
gtk_assistant_update_buttons_state( assistant );
}
@@ -337,20 +366,24 @@ static gboolean
has_readable_files( GSList *uris )
{
static const gchar *thisfn = "nact_assistant_import_has_readable_files";
-
GSList *iuri;
int readables = 0;
+ gchar *uri;
+ GFile *file;
+ GFileInfo *info;
+ GFileType type;
+ GError *error = NULL;
+ gboolean readable;
for( iuri = uris ; iuri ; iuri = iuri->next ){
- gchar *uri = ( gchar * ) iuri->data;
+ uri = ( gchar * ) iuri->data;
if( !strlen( uri )){
continue;
}
- GFile *file = g_file_new_for_uri( uri );
- GError *error = NULL;
- GFileInfo *info = g_file_query_info( file,
+ file = g_file_new_for_uri( uri );
+ info = g_file_query_info( file,
G_FILE_ATTRIBUTE_ACCESS_CAN_READ "," G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, &error );
@@ -361,14 +394,14 @@ has_readable_files( GSList *uris )
continue;
}
- GFileType type = g_file_info_get_file_type( info );
+ type = g_file_info_get_file_type( info );
if( type != G_FILE_TYPE_REGULAR ){
g_warning( "%s: %s is not a file", thisfn, uri );
g_object_unref( info );
continue;
}
- gboolean readable = g_file_info_get_attribute_boolean( info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ );
+ readable = g_file_info_get_attribute_boolean( info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ );
if( !readable ){
g_warning( "%s: %s is not readable", thisfn, uri );
g_object_unref( info );
@@ -386,9 +419,12 @@ static void
on_prepare( NactAssistant *window, GtkAssistant *assistant, GtkWidget *page )
{
static const gchar *thisfn = "nact_assistant_import_on_prepare";
- g_debug( "%s: window=%p, assistant=%p, page=%p", thisfn, window, assistant, page );
+ GtkAssistantPageType type;
- GtkAssistantPageType type = gtk_assistant_get_page_type( assistant, page );
+ g_debug( "%s: window=%p, assistant=%p, page=%p",
+ thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
+
+ type = gtk_assistant_get_page_type( assistant, page );
switch( type ){
case GTK_ASSISTANT_PAGE_CONFIRM:
@@ -408,17 +444,21 @@ static void
prepare_confirm( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page )
{
static const gchar *thisfn = "nact_assistant_import_prepare_confirm";
- g_debug( "%s: window=%p, assistant=%p, page=%p", thisfn, window, assistant, page );
+ gchar *text, *tmp;
+ GtkWidget *chooser;
+ GSList *uris, *is;
+
+ g_debug( "%s: window=%p, assistant=%p, page=%p",
+ thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
/* i18n: the title of the confirm page of the import assistant */
- gchar *text = g_strdup( _( "About to import selected files:" ));
- gchar *tmp = g_strdup_printf( "<b>%s</b>\n\n", text );
+ text = g_strdup( _( "About to import selected files:" ));
+ tmp = g_strdup_printf( "<b>%s</b>\n\n", text );
g_free( text );
text = tmp;
- GtkWidget *chooser = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FILES_SELECTION );
- GSList *uris = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER( chooser ));
- GSList *is;
+ chooser = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FILES_SELECTION );
+ uris = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER( chooser ));
for( is = uris ; is ; is = is->next ){
tmp = g_strdup_printf( "%s\t%s\n", text, ( gchar * ) is->data );
@@ -436,12 +476,16 @@ static void
prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWidget *page )
{
static const gchar *thisfn = "nact_assistant_import_prepare_importdone";
- g_debug( "%s: window=%p, assistant=%p, page=%p", thisfn, window, assistant, page );
+ gchar *text, *tmp, *text2;
+ gchar *bname, *uuid, *label;
+ GSList *is, *im;
+ ImportUriStruct *str;
+ GFile *file;
- do_import( window, assistant );
+ g_debug( "%s: window=%p, assistant=%p, page=%p",
+ thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
- gchar *text, *tmp, *text2;
- GSList *is;
+ do_import( window, assistant );
/* i18n: result of the import assistant */
text = g_strdup( _( "Selected files have been imported:" ));
@@ -452,10 +496,10 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
for( is = window->private->results ; is ; is = is->next ){
- ImportUriStruct *str = ( ImportUriStruct * ) is->data;
+ str = ( ImportUriStruct * ) is->data;
- GFile *file = g_file_new_for_uri( str->uri );
- gchar *bname = g_file_get_basename( file );
+ file = g_file_new_for_uri( str->uri );
+ bname = g_file_get_basename( file );
g_object_unref( file );
tmp = g_strdup_printf( "%s\t%s\n\n", text, bname );
g_free( text );
@@ -463,8 +507,8 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
g_free( bname );
if( str->action ){
- gchar *uuid = na_action_get_uuid( str->action );
- gchar *label = na_action_get_label( str->action );
+ uuid = na_action_get_uuid( str->action );
+ label = na_action_get_label( str->action );
/* i18n: this is the globally unique identifier and the label of the newly imported action */
text2 = g_strdup_printf( _( "UUID: %s\t%s" ), uuid, label);
g_free( label );
@@ -483,7 +527,6 @@ prepare_importdone( NactAssistantImport *window, GtkAssistant *assistant, GtkWid
g_free( text );
text = tmp;
- GSList *im;
for( im = str->msg ; im ; im = im->next ){
tmp = g_strdup_printf( "%s\t\t%s\n", text, ( const char * ) im->data );
g_free( text );
@@ -506,18 +549,22 @@ static void
do_import( NactAssistantImport *window, GtkAssistant *assistant )
{
static const gchar *thisfn = "nact_assistant_import_do_import";
- g_debug( "%s: window=%p", thisfn, window );
+ GtkWidget *chooser;
+ GSList *uris, *is, *msg;
+ NAAction *action;
+ ImportUriStruct *str;
- GtkWidget *chooser = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FILES_SELECTION );
- GSList *uris = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER( chooser ));
- GSList *is, *msg;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
+
+ chooser = gtk_assistant_get_nth_page( assistant, ASSIST_PAGE_FILES_SELECTION );
+ uris = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER( chooser ));
for( is = uris ; is ; is = is->next ){
msg = NULL;
- NAAction *action = nact_xml_reader_import( NACT_WINDOW( window ), ( const gchar * ) is->data, &msg );
+ action = nact_xml_reader_import( NACT_WINDOW( window ), ( const gchar * ) is->data, &msg );
- ImportUriStruct *str = g_new0( ImportUriStruct, 1 );
+ str = g_new0( ImportUriStruct, 1 );
str->uri = g_strdup(( const gchar * ) is->data );
str->action = action;
str->msg = na_utils_duplicate_string_list( msg );
@@ -534,8 +581,10 @@ static void
free_results( GSList *list )
{
GSList *is;
+ ImportUriStruct *str;
+
for( is = list ; is ; is = is->next ){
- ImportUriStruct *str = ( ImportUriStruct * ) is->data;
+ str = ( ImportUriStruct * ) is->data;
g_free( str->uri );
na_utils_free_string_list( str->msg );
}
diff --git a/src/nact/nact-assistant.c b/src/nact/nact-assistant.c
index 5375d53..cac0f0f 100644
--- a/src/nact/nact-assistant.c
+++ b/src/nact/nact-assistant.c
@@ -42,6 +42,7 @@
/* private class data
*/
struct NactAssistantClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -61,28 +62,28 @@ enum {
static GObjectClass *st_parent_class = NULL;
-static GType register_type( void );
-static void class_init( NactAssistantClass *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 GtkWindow * get_dialog( BaseWindow *window, const gchar *name );
-
-static void v_assistant_apply( GtkAssistant *assistant, gpointer user_data );
-static void v_assistant_cancel( GtkAssistant *assistant, gpointer user_data );
-static void v_assistant_close( GtkAssistant *assistant, gpointer user_data );
-static void v_assistant_prepare( GtkAssistant *assistant, GtkWidget *page, gpointer user_data );
-
-static void on_runtime_init_toplevel( BaseWindow *window );
-static gboolean on_key_pressed_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data );
-static gboolean on_escape_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer user_data );
-static void do_assistant_apply( NactAssistant *window, GtkAssistant *assistant );
-static void do_assistant_cancel( NactAssistant *window, GtkAssistant *assistant );
-static void do_assistant_close( NactAssistant *window, GtkAssistant *assistant );
-static void do_assistant_prepare( NactAssistant *window, GtkAssistant *assistant, GtkWidget *page );
+static GType register_type( void );
+static void class_init( NactAssistantClass *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 GtkWindow *get_dialog( BaseWindow *window, const gchar *name );
+
+static void v_assistant_apply( GtkAssistant *assistant, gpointer user_data );
+static void v_assistant_cancel( GtkAssistant *assistant, gpointer user_data );
+static void v_assistant_close( GtkAssistant *assistant, gpointer user_data );
+static void v_assistant_prepare( GtkAssistant *assistant, GtkWidget *page, gpointer user_data );
+
+static void on_runtime_init_toplevel( BaseWindow *window );
+static gboolean on_key_pressed_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data );
+static gboolean on_escape_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer user_data );
+static void do_assistant_apply( NactAssistant *window, GtkAssistant *assistant );
+static void do_assistant_cancel( NactAssistant *window, GtkAssistant *assistant );
+static void do_assistant_close( NactAssistant *window, GtkAssistant *assistant );
+static void do_assistant_prepare( NactAssistant *window, GtkAssistant *assistant, GtkWidget *page );
GType
nact_assistant_get_type( void )
@@ -100,9 +101,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_assistant_register_type";
- g_debug( "%s", thisfn );
-
- g_type_init();
+ GType type;
static GTypeInfo info = {
sizeof( NactAssistantClass ),
@@ -116,7 +115,11 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( NACT_WINDOW_TYPE, "NactAssistant", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ g_type_init();
+
+ type = g_type_register_static( NACT_WINDOW_TYPE, "NactAssistant", &info, 0 );
return( type );
}
@@ -125,17 +128,20 @@ static void
class_init( NactAssistantClass *klass )
{
static const gchar *thisfn = "nact_assistant_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ GParamSpec *spec;
+ BaseWindowClass *base_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ 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;
- GParamSpec *spec;
spec = g_param_spec_boolean(
PROP_ASSIST_WARN_ON_CANCEL_STR,
PROP_ASSIST_WARN_ON_CANCEL_STR,
@@ -145,7 +151,8 @@ class_init( NactAssistantClass *klass )
klass->private = g_new0( NactAssistantClassPrivate, 1 );
- BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
+ base_class = BASE_WINDOW_CLASS( klass );
+
base_class->get_dialog = get_dialog;
base_class->runtime_init_toplevel = on_runtime_init_toplevel;
@@ -160,10 +167,12 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "nact_assistant_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NactAssistant *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NACT_IS_ASSISTANT( instance ));
- NactAssistant *self = NACT_ASSISTANT( instance );
+ self = NACT_ASSISTANT( instance );
self->private = g_new0( NactAssistantPrivate, 1 );
@@ -173,8 +182,10 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *spec )
{
+ NactAssistant *self;
+
g_assert( NACT_IS_ASSISTANT( object ));
- NactAssistant *self = NACT_ASSISTANT( object );
+ self = NACT_ASSISTANT( object );
switch( property_id ){
case PROP_ASSIST_WARN_ON_CANCEL:
@@ -190,8 +201,10 @@ instance_get_property( GObject *object, guint property_id, GValue *value, GParam
static void
instance_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *spec )
{
+ NactAssistant *self;
+
g_assert( NACT_IS_ASSISTANT( object ));
- NactAssistant *self = NACT_ASSISTANT( object );
+ self = NACT_ASSISTANT( object );
switch( property_id ){
case PROP_ASSIST_WARN_ON_CANCEL:
@@ -208,10 +221,11 @@ static void
instance_dispose( GObject *window )
{
static const gchar *thisfn = "nact_assistant_instance_dispose";
- g_debug( "%s: window=%p", thisfn, window );
+ NactAssistant *self;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_ASSISTANT( window ));
- NactAssistant *self = NACT_ASSISTANT( window );
+ self = NACT_ASSISTANT( window );
if( !self->private->dispose_has_run ){
@@ -226,10 +240,11 @@ static void
instance_finalize( GObject *window )
{
static const gchar *thisfn = "nact_assistant_instance_finalize";
- g_debug( "%s: window=%p", thisfn, window );
+ NactAssistant *self;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_ASSISTANT( window ));
- NactAssistant *self = ( NactAssistant * ) window;
+ self = ( NactAssistant * ) window;
g_free( self->private );
@@ -241,7 +256,7 @@ instance_finalize( GObject *window )
/*
* cf. http://bugzilla.gnome.org/show_bug.cgi?id=589746 against Gtk+ 2.16
- * a GtkFileChooseWidget embedded in a GtkAssistant is not displayed
+ * a GtkFileChooserWidget embedded in a GtkAssistant is not displayed
* when run more than once
*
* as a work-around, reload the XML ui each time we run an assistant !
@@ -249,17 +264,22 @@ instance_finalize( GObject *window )
static GtkWindow *
get_dialog( BaseWindow *window, const gchar *name )
{
- GtkBuilder *builder = gtk_builder_new();
+ GtkBuilder *builder;
+ BaseApplication *appli;
+ gchar *fname;
+ GtkWindow *dialog;
- BaseApplication *appli = base_window_get_application( window );
+ builder = gtk_builder_new();
- gchar *fname = base_application_get_ui_filename( appli );
+ appli = base_window_get_application( window );
+
+ fname = base_application_get_ui_filename( appli );
gtk_builder_add_from_file( builder, fname, NULL );
g_free( fname );
- GtkWindow *dialog = GTK_WINDOW( gtk_builder_get_object( builder, name ));
+ dialog = GTK_WINDOW( gtk_builder_get_object( builder, name ));
return( dialog );
}
@@ -327,16 +347,17 @@ static void
on_runtime_init_toplevel( BaseWindow *window )
{
static const gchar *thisfn = "nact_assistant_on_runtime_init_toplevel";
+ GtkWindow *toplevel;
/* call parent class at the very beginning */
if( BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel ){
BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel( window );
}
- g_debug( "%s: window=%p", thisfn, window );
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_ASSISTANT( window ));
- GtkWindow *toplevel = base_window_get_toplevel_dialog( window );
+ toplevel = base_window_get_toplevel_dialog( window );
g_assert( GTK_IS_ASSISTANT( toplevel ));
nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( toplevel ), "key-press-event", G_CALLBACK( on_key_pressed_event ));
@@ -369,9 +390,12 @@ static gboolean
on_escape_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer user_data )
{
static const gchar *thisfn = "nact_assistant_on_escape_key_pressed";
- g_debug( "%s: widget=%p, event=%p, user_data=%p", thisfn, widget, event, user_data );
+ GtkWindow *toplevel;
+
+ g_debug( "%s: widget=%p, event=%p, user_data=%p",
+ thisfn, ( void * ) widget, ( void * ) event, ( void * ) user_data );
- GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( user_data ));
+ toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( user_data ));
v_assistant_cancel( GTK_ASSISTANT( toplevel ), user_data );
return( TRUE );
@@ -381,7 +405,8 @@ static void
do_assistant_apply( NactAssistant *window, GtkAssistant *assistant )
{
static const gchar *thisfn = "nact_assistant_do_assistant_apply";
- g_debug( "%s: window=%p, assistant=%p", thisfn, window, assistant );
+
+ g_debug( "%s: window=%p, assistant=%p", thisfn, ( void * ) window, ( void * ) assistant );
}
/*
@@ -391,12 +416,13 @@ static void
do_assistant_cancel( NactAssistant *window, GtkAssistant *assistant )
{
static const gchar *thisfn = "nact_assistant_do_assistant_cancel";
- g_debug( "%s: window=%p, assistant=%p", thisfn, window, assistant );
-
gboolean ok = TRUE;
+ gchar *first;
+
+ g_debug( "%s: window=%p, assistant=%p", thisfn, ( void * ) window, ( void * ) assistant );
if( window->private->warn_on_cancel ){
- gchar *first = g_strdup( _( "Are you sure you want to quit this assistant ?" ));
+ first = g_strdup( _( "Are you sure you want to quit this assistant ?" ));
ok = base_window_yesno_dlg( BASE_WINDOW( window ), GTK_MESSAGE_QUESTION, first, NULL );
g_free( first );
}
@@ -410,7 +436,8 @@ static void
do_assistant_close( NactAssistant *window, GtkAssistant *assistant )
{
static const gchar *thisfn = "nact_assistant_do_assistant_close";
- g_debug( "%s: window=%p, assistant=%p", thisfn, window, assistant );
+
+ g_debug( "%s: window=%p, assistant=%p", thisfn, ( void * ) window, ( void * ) assistant );
g_object_unref( window );
}
@@ -419,5 +446,7 @@ static void
do_assistant_prepare( NactAssistant *window, GtkAssistant *assistant, GtkWidget *page )
{
static const gchar *thisfn = "nact_assistant_do_assistant_prepare";
- g_debug( "%s: window=%p, assistant=%p, page=%p", thisfn, window, assistant, page );
+
+ g_debug( "%s: window=%p, assistant=%p, page=%p",
+ thisfn, ( void * ) window, ( void * ) assistant, ( void * ) page );
}
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index 62db79d..1f2237c 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -42,6 +42,7 @@
/* private interface data
*/
struct NactIActionTabInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* columns in the icon combobox
@@ -94,7 +95,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_iaction_tab_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NactIActionTabInterface ),
@@ -108,7 +109,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIActionTab", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NactIActionTab", &info, 0 );
g_type_interface_add_prerequisite( type, NACT_WINDOW_TYPE );
@@ -122,7 +125,7 @@ interface_base_init( NactIActionTabInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NactIActionTabInterfacePrivate, 1 );
@@ -140,7 +143,7 @@ interface_base_finalize( NactIActionTabInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -152,9 +155,11 @@ void
nact_iaction_tab_initial_load( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iaction_tab_initial_load";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ GtkWidget *icon_widget;
- GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
+
+ icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
gtk_combo_box_set_model( GTK_COMBO_BOX( icon_widget ), create_stock_icon_model());
icon_combo_list_fill( GTK_COMBO_BOX_ENTRY( icon_widget ));
}
@@ -163,21 +168,25 @@ void
nact_iaction_tab_runtime_init( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iaction_tab_runtime_init";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ GtkWidget *label_widget, *tooltip_widget, *icon_widget;
+ GtkWidget *button;
+ GtkButton *enabled_button;
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
- GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionLabelEntry" );
+ label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionLabelEntry" );
nact_window_signal_connect( dialog, G_OBJECT( label_widget ), "changed", G_CALLBACK( on_label_changed ));
- GtkWidget *tooltip_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionTooltipEntry" );
+ tooltip_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionTooltipEntry" );
nact_window_signal_connect( dialog, G_OBJECT( tooltip_widget ), "changed", G_CALLBACK( on_tooltip_changed ));
- GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
+ icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
nact_window_signal_connect( dialog, G_OBJECT( GTK_BIN( icon_widget )->child ), "changed", G_CALLBACK( on_icon_changed ));
- GtkWidget *button = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconBrowseButton" );
+ button = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconBrowseButton" );
nact_window_signal_connect( dialog, G_OBJECT( button ), "clicked", G_CALLBACK( on_icon_browse ));
- GtkButton *enabled_button = get_enabled_button( dialog );
+ enabled_button = get_enabled_button( dialog );
nact_window_signal_connect( dialog, G_OBJECT( enabled_button ), "toggled", G_CALLBACK( on_enabled_toggled ));
}
@@ -188,14 +197,16 @@ void
nact_iaction_tab_all_widgets_showed( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iaction_tab_all_widgets_showed";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
void
nact_iaction_tab_dispose( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iaction_tab_dispose";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
/*
@@ -208,16 +219,23 @@ nact_iaction_tab_set_action( NactWindow *dialog, const NAAction *action )
/*static const gchar *thisfn = "nact_iaction_tab_set_action";
g_debug( "%s: dialog=%p, action=%p", thisfn, dialog, action );*/
- NAObject *current = v_get_selected( dialog );
- gboolean enabled = ( action != NULL );
+ NAObject *current;
+ gboolean enabled;
+ GtkWidget *label_widget, *tooltip_widget, *icon_widget, *button;
+ gchar *label, *tooltip, *icon;
+ GtkButton *enabled_button;
+ gboolean enabled_action;
+
+ current = v_get_selected( dialog );
+ enabled = ( action != NULL );
if( NA_IS_ACTION_PROFILE( current)){
if( na_action_get_profiles_count( action ) > 1 ){
enabled = FALSE;
}
}
- GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionLabelEntry" );
- gchar *label = action ? na_action_get_label( action ) : g_strdup( "" );
+ label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionLabelEntry" );
+ label = action ? na_action_get_label( action ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
gtk_widget_set_sensitive( label_widget, enabled );
if( action ){
@@ -225,23 +243,23 @@ nact_iaction_tab_set_action( NactWindow *dialog, const NAAction *action )
}
g_free( label );
- GtkWidget *tooltip_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionTooltipEntry" );
- gchar *tooltip = action ? na_action_get_tooltip( action ) : g_strdup( "" );
+ tooltip_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionTooltipEntry" );
+ tooltip = action ? na_action_get_tooltip( action ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( tooltip_widget ), tooltip );
gtk_widget_set_sensitive( tooltip_widget, enabled );
g_free( tooltip );
- GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
- gchar *icon = action ? na_action_get_icon( action ) : g_strdup( "" );
+ icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
+ icon = action ? na_action_get_icon( action ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( GTK_BIN( icon_widget )->child ), icon );
gtk_widget_set_sensitive( icon_widget, enabled );
g_free( icon );
- GtkWidget *button = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconBrowseButton" );
+ button = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconBrowseButton" );
gtk_widget_set_sensitive( button, enabled );
- GtkButton *enabled_button = get_enabled_button( dialog );
- gboolean enabled_action = action ? na_action_is_enabled( action ) : FALSE;
+ enabled_button = get_enabled_button( dialog );
+ enabled_action = action ? na_action_is_enabled( action ) : FALSE;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( enabled_button ), enabled_action );
gtk_widget_set_sensitive( GTK_WIDGET( enabled_button ), enabled );
}
@@ -253,8 +271,11 @@ nact_iaction_tab_set_action( NactWindow *dialog, const NAAction *action )
gboolean
nact_iaction_tab_has_label( NactWindow *window )
{
- GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( window ), "ActionLabelEntry" );
- const gchar *label = gtk_entry_get_text( GTK_ENTRY( label_widget ));
+ GtkWidget *label_widget;
+ const gchar *label;
+
+ label_widget = base_window_get_widget( BASE_WINDOW( window ), "ActionLabelEntry" );
+ label = gtk_entry_get_text( GTK_ENTRY( label_widget ));
return( g_utf8_strlen( label, -1 ) > 0 );
}
@@ -295,13 +316,17 @@ v_field_modified( NactWindow *window )
static void
on_label_changed( GtkEntry *entry, gpointer user_data )
{
+ NactWindow *dialog;
+ NAAction *edited;
+ const gchar *label;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
- NAAction *edited = v_get_edited_action( dialog );
+ edited = v_get_edited_action( dialog );
if( edited ){
- const gchar *label = gtk_entry_get_text( entry );
+ label = gtk_entry_get_text( entry );
na_action_set_label( edited, label );
v_field_modified( dialog );
check_for_label( dialog, entry, label );
@@ -316,16 +341,17 @@ on_label_changed( GtkEntry *entry, gpointer user_data )
}
g_get_current_time( &end );
g_debug( "on_label_changed: %ld usec", ( 1000000 * ( end.tv_sec - begin.tv_sec )) + end.tv_usec - begin.tv_usec );*/
-
}
static void
check_for_label( NactWindow *window, GtkEntry *entry, const gchar *label )
{
+ NAAction *edited;
+
nact_statusbar_hide_status( NACT_MAIN_WINDOW( window ), PROP_IACTION_TAB_STATUS_CONTEXT );
set_label_label( window, "black" );
- NAAction *edited = v_get_edited_action( window );
+ edited = v_get_edited_action( window );
if( edited && g_utf8_strlen( label, -1 ) == 0 ){
/* i18n: status bar message when the action label is empty */
@@ -337,19 +363,25 @@ check_for_label( NactWindow *window, GtkEntry *entry, const gchar *label )
static void
set_label_label( NactWindow *window, const gchar *color )
{
- GtkWidget *label = base_window_get_widget( BASE_WINDOW( window ), "ActionLabelLabel" );
+ GtkWidget *label;
+ gchar *text;
+
+ label = base_window_get_widget( BASE_WINDOW( window ), "ActionLabelLabel" );
/* i18n: label in front of the GtkEntry where user enters the action label */
- gchar *text = g_markup_printf_escaped( "<span color=\"%s\">%s</span>", color, _( "_Label :" ));
+ text = g_markup_printf_escaped( "<span color=\"%s\">%s</span>", color, _( "_Label :" ));
gtk_label_set_markup_with_mnemonic( GTK_LABEL( label ), text );
}
static void
on_tooltip_changed( GtkEntry *entry, gpointer user_data )
{
+ NactWindow *dialog;
+ NAAction *edited;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
- NAAction *edited = v_get_edited_action( dialog );
+ edited = v_get_edited_action( dialog );
if( edited ){
na_action_set_tooltip( edited, gtk_entry_get_text( entry ));
@@ -361,18 +393,24 @@ static void
on_icon_changed( GtkEntry *icon_entry, gpointer user_data )
{
static const gchar *thisfn = "nact_iaction_tab_on_icon_changed";
+ NactWindow *dialog;
+ GtkWidget *image;
+ const gchar *icon_name;
+ GtkStockItem stock_item;
+ GdkPixbuf *icon = NULL;
+ gint width, height;
+ GError *error = NULL;
+ NAAction *edited;
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
- GtkWidget *image = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconImage" );
+ image = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconImage" );
g_assert( GTK_IS_WIDGET( image ));
display_icon( dialog, image, FALSE );
- const gchar *icon_name = gtk_entry_get_text( icon_entry );
+ icon_name = gtk_entry_get_text( icon_entry );
/*g_debug( "%s: icon_name=%s", thisfn, icon_name );*/
- GtkStockItem stock_item;
- GdkPixbuf *icon = NULL;
if( icon_name && strlen( icon_name ) > 0 ){
@@ -385,9 +423,6 @@ on_icon_changed( GtkEntry *icon_entry, gpointer user_data )
} else if( g_file_test( icon_name, G_FILE_TEST_EXISTS ) &&
g_file_test( icon_name, G_FILE_TEST_IS_REGULAR )){
g_debug( "%s: g_file_test", thisfn );
- gint width;
- gint height;
- GError *error = NULL;
gtk_icon_size_lookup( GTK_ICON_SIZE_MENU, &width, &height );
icon = gdk_pixbuf_new_from_file_at_size( icon_name, width, height, &error );
@@ -402,7 +437,7 @@ on_icon_changed( GtkEntry *icon_entry, gpointer user_data )
}
}
- NAAction *edited = v_get_edited_action( dialog );
+ edited = v_get_edited_action( dialog );
if( edited ){
na_action_set_icon( edited, icon_name );
@@ -414,9 +449,13 @@ on_icon_changed( GtkEntry *icon_entry, gpointer user_data )
static void
on_icon_browse( GtkButton *button, gpointer user_data )
{
+ GtkWidget *dialog;
+ gchar *filename;
+ GtkWidget *icon_widget;
+
g_assert( NACT_IS_IACTION_TAB( user_data ));
- GtkWidget *dialog = gtk_file_chooser_dialog_new(
+ dialog = gtk_file_chooser_dialog_new(
_( "Choosing an icon" ),
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -426,8 +465,8 @@ on_icon_browse( GtkButton *button, gpointer user_data )
);
if( gtk_dialog_run( GTK_DIALOG( dialog )) == GTK_RESPONSE_ACCEPT ){
- gchar *filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ));
- GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( user_data ), "MenuIconComboBoxEntry" );
+ filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ));
+ icon_widget = base_window_get_widget( BASE_WINDOW( user_data ), "MenuIconComboBoxEntry" );
gtk_entry_set_text( GTK_ENTRY( GTK_BIN( icon_widget )->child ), filename );
g_free (filename);
}
@@ -462,22 +501,25 @@ create_stock_icon_model( void )
{
GtkStockItem stock_item;
gchar* label;
+ GtkListStore *model;
+ GtkTreeIter row;
+ GSList *stock_list, *iter;
+ GtkIconTheme *icon_theme;
+ GtkIconInfo *icon_info;
- GtkListStore *model = gtk_list_store_new( ICON_N_COLUMN, G_TYPE_STRING, G_TYPE_STRING );
+ model = gtk_list_store_new( ICON_N_COLUMN, G_TYPE_STRING, G_TYPE_STRING );
- GtkTreeIter row;
gtk_list_store_append( model, &row );
/* i18n notes: when no icon is selected in the drop-down list */
gtk_list_store_set( model, &row, ICON_STOCK_COLUMN, "", ICON_LABEL_COLUMN, _( "None" ), -1 );
- GSList *stock_list = gtk_stock_list_ids();
- GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
+ stock_list = gtk_stock_list_ids();
+ icon_theme = gtk_icon_theme_get_default();
stock_list = g_slist_sort( stock_list, ( GCompareFunc ) sort_stock_ids );
- GSList *iter;
for( iter = stock_list ; iter ; iter = iter->next ){
- GtkIconInfo *icon_info = gtk_icon_theme_lookup_icon( icon_theme, ( gchar * ) iter->data, GTK_ICON_SIZE_MENU, GTK_ICON_LOOKUP_FORCE_SVG );
+ icon_info = gtk_icon_theme_lookup_icon( icon_theme, ( gchar * ) iter->data, GTK_ICON_SIZE_MENU, GTK_ICON_LOOKUP_FORCE_SVG );
if( icon_info ){
if( gtk_stock_lookup(( gchar * ) iter->data, &stock_item )){
gtk_list_store_append( model, &row );
@@ -565,12 +607,16 @@ display_icon( NactWindow *window, GtkWidget *image, gboolean show )
static void
on_enabled_toggled( GtkToggleButton *button, gpointer user_data )
{
+ NactWindow *dialog;
+ NAAction *edited;
+ gboolean enabled;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
- NAAction *edited = v_get_edited_action( dialog );
+ edited = v_get_edited_action( dialog );
if( edited ){
- gboolean enabled = gtk_toggle_button_get_active( button );
+ enabled = gtk_toggle_button_get_active( button );
na_action_set_enabled( edited, enabled );
v_field_modified( dialog );
}
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index 40131b2..75315ab 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -41,6 +41,7 @@
/* private interface data
*/
struct NactIActionsListInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* column ordering
@@ -99,7 +100,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_iactions_list_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NactIActionsListInterface ),
@@ -113,7 +114,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIActionsList", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NactIActionsList", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -127,7 +130,7 @@ interface_base_init( NactIActionsListInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NactIActionsListInterfacePrivate, 1 );
@@ -142,7 +145,7 @@ interface_base_finalize( NactIActionsListInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -157,22 +160,27 @@ void
nact_iactions_list_initial_load( NactWindow *window )
{
static const gchar *thisfn = "nact_iactions_list_initial_load";
- g_debug( "%s: window=%p", thisfn, window );
+ GtkWidget *widget, *label;
+ GtkTreeStore *ts_model;
+ GtkTreeModel *tmf_model;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_IACTIONS_LIST( window ));
g_assert( NACT_IS_WINDOW( window ));
- GtkWidget *widget = get_actions_list_widget( window );
+ widget = get_actions_list_widget( window );
/* associates the ActionsList to the label */
- GtkWidget *label = base_window_get_widget( BASE_WINDOW( window ), "ActionsListLabel" );
+ label = base_window_get_widget( BASE_WINDOW( window ), "ActionsListLabel" );
gtk_label_set_mnemonic_widget( GTK_LABEL( label ), widget );
nact_iactions_list_set_send_selection_changed_on_fill_list( window, FALSE );
nact_iactions_list_set_is_filling_list( window, FALSE );
/* create the model */
- GtkTreeStore *ts_model = gtk_tree_store_new(
+ ts_model = gtk_tree_store_new(
IACTIONS_LIST_N_COLUMN, GDK_TYPE_PIXBUF, G_TYPE_STRING, NA_OBJECT_TYPE );
gtk_tree_sortable_set_default_sort_func(
@@ -183,7 +191,7 @@ nact_iactions_list_initial_load( NactWindow *window )
GTK_TREE_SORTABLE( ts_model ),
IACTIONS_LIST_LABEL_COLUMN, GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID );
- GtkTreeModel *tmf_model = gtk_tree_model_filter_new( GTK_TREE_MODEL( ts_model ), NULL );
+ tmf_model = gtk_tree_model_filter_new( GTK_TREE_MODEL( ts_model ), NULL );
gtk_tree_model_filter_set_visible_func(
GTK_TREE_MODEL_FILTER( tmf_model ), ( GtkTreeModelFilterVisibleFunc ) filter_visible, window, NULL );
@@ -195,7 +203,7 @@ nact_iactions_list_initial_load( NactWindow *window )
g_object_unref( ts_model );
/* create visible columns on the tree view */
- GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(
+ 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 );
@@ -204,7 +212,7 @@ nact_iactions_list_initial_load( NactWindow *window )
column = gtk_tree_view_column_new();
gtk_tree_view_column_set_title( column, "label" );
gtk_tree_view_column_set_sort_column_id( column, IACTIONS_LIST_LABEL_COLUMN );
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ renderer = gtk_cell_renderer_text_new();
gtk_tree_view_column_pack_start( column, renderer, TRUE );
gtk_tree_view_column_set_cell_data_func(
column, renderer, ( GtkTreeCellDataFunc ) display_label, window, NULL );
@@ -218,12 +226,14 @@ void
nact_iactions_list_runtime_init( NactWindow *window )
{
static const gchar *thisfn = "nact_iactions_list_runtime_init";
- g_debug( "%s: window=%p", thisfn, window );
+ GtkWidget *widget;
+ GtkTreeSelection *selection;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_IACTIONS_LIST( window ));
g_assert( NACT_IS_WINDOW( window ));
- GtkWidget *widget = get_actions_list_widget( window );
+ widget = get_actions_list_widget( window );
g_assert( GTK_IS_WIDGET( widget ));
nact_iactions_list_fill( window, TRUE );
@@ -250,7 +260,7 @@ nact_iactions_list_runtime_init( NactWindow *window )
G_CALLBACK( v_on_button_press_event ));
/* clear the selection */
- GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( widget ));
+ selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( widget ));
gtk_tree_selection_unselect_all( selection );
}
@@ -261,40 +271,46 @@ void
nact_iactions_list_fill( NactWindow *window, gboolean keep_expanded )
{
static const gchar *thisfn = "nact_iactions_list_fill";
- g_debug( "%s: window=%p", thisfn, window );
+ GSList *expanded = NULL;
+ GtkWidget *widget;
+ GtkTreeModelFilter *tmf_model;
+ GtkTreeStore *ts_model;
+ GSList *actions, *ia;
+ GSList *profiles, *ip;
+ GtkTreeIter iter, profile_iter;
+ NAAction *action;
+ NAActionProfile *profile;
+
+ g_debug( "%s: window=%p, keep_expanded=%s",
+ thisfn, ( void * ) window, keep_expanded ? "True":"False" );
g_assert( NACT_IS_IACTIONS_LIST( window ));
nact_iactions_list_set_is_filling_list( window, TRUE );
- GSList *expanded = NULL;
if( keep_expanded ){
expanded = get_expanded_rows( window );
}
- GtkWidget *widget = get_actions_list_widget( window );
- GtkTreeModelFilter *tmf_model = GTK_TREE_MODEL_FILTER( gtk_tree_view_get_model( GTK_TREE_VIEW( widget )));
- GtkTreeStore *ts_model = GTK_TREE_STORE( gtk_tree_model_filter_get_model( tmf_model ));
+ widget = get_actions_list_widget( window );
+ tmf_model = GTK_TREE_MODEL_FILTER( gtk_tree_view_get_model( GTK_TREE_VIEW( widget )));
+ ts_model = GTK_TREE_STORE( gtk_tree_model_filter_get_model( tmf_model ));
gtk_tree_store_clear( ts_model );
- GSList *actions = v_get_actions( window );
- GSList *ia;
+ actions = v_get_actions( window );
g_debug( "%s: actions has %d elements", thisfn, g_slist_length( actions ));
for( ia = actions ; ia != NULL ; ia = ia->next ){
- GtkTreeIter iter;
- NAAction *action = NA_ACTION( ia->data );
+ action = NA_ACTION( ia->data );
gtk_tree_store_append( ts_model, &iter, NULL );
gtk_tree_store_set( ts_model, &iter, IACTIONS_LIST_NAOBJECT_COLUMN, action, -1);
setup_action( widget, ts_model, &iter, action );
- g_debug( "%s: action=%p", thisfn, action );
+ g_debug( "%s: action=%p", thisfn, ( void * ) action );
if( is_edition_mode( window )){
- GSList *profiles = na_action_get_profiles( action );
- GSList *ip;
- GtkTreeIter profile_iter;
+ profiles = na_action_get_profiles( action );
for( ip = profiles ; ip ; ip = ip->next ){
- NAActionProfile *profile = NA_ACTION_PROFILE( ip->data );
+ profile = NA_ACTION_PROFILE( ip->data );
gtk_tree_store_append( ts_model, &profile_iter, &iter );
gtk_tree_store_set( ts_model, &profile_iter, IACTIONS_LIST_NAOBJECT_COLUMN, profile, -1 );
setup_profile( widget, ts_model, &profile_iter, profile );
@@ -347,10 +363,24 @@ void
nact_iactions_list_set_selection( NactWindow *window, GType type, const gchar *uuid, const gchar *label )
{
static const gchar *thisfn = "nact_iactions_list_set_selection";
- g_debug( "%s: window=%p, type=%s, uuid=%s, label=%s", thisfn, window, type == NA_ACTION_TYPE ? "action":"profile", uuid, label );
+ GtkWidget *list;
+ GtkTreeSelection *selection;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ gboolean iterok, iter_child_ok;
+ gboolean found = FALSE;
+ GtkTreeIter previous;
+ NAObject *iter_object;
+ gchar *iter_uuid, *iter_label;
+ gint ret_uuid, ret_label;
+ guint nb_profiles;
+ GtkTreeIter iter_child, previous_child;
- GtkWidget *list = get_actions_list_widget( window );
- GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( list ));
+ g_debug( "%s: window=%p, type=%s, uuid=%s, label=%s",
+ thisfn, ( void * ) window, type == NA_ACTION_TYPE ? "action":"profile", uuid, label );
+
+ list = get_actions_list_widget( window );
+ selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( list ));
if( !uuid || !strlen( uuid )){
g_debug( "%s: null or empty uuid: unselect all", thisfn );
@@ -359,9 +389,8 @@ nact_iactions_list_set_selection( NactWindow *window, GType type, const gchar *u
return;
}
- GtkTreeIter iter;
- GtkTreeModel *model = gtk_tree_view_get_model( GTK_TREE_VIEW( list ));
- gboolean iterok = gtk_tree_model_get_iter_first( model, &iter );
+ model = gtk_tree_view_get_model( GTK_TREE_VIEW( list ));
+ iterok = gtk_tree_model_get_iter_first( model, &iter );
if( !iterok ){
g_debug( "%s: empty actions list: unselect all", thisfn );
gtk_tree_selection_unselect_all( selection );
@@ -369,39 +398,33 @@ nact_iactions_list_set_selection( NactWindow *window, GType type, const gchar *u
return;
}
- gboolean found = FALSE;
- GtkTreeIter previous;
- NAObject *iter_object;
- gchar *iter_uuid, *iter_label;
-
while( iterok && !found ){
gtk_tree_model_get( model, &iter, IACTIONS_LIST_NAOBJECT_COLUMN, &iter_object, IACTIONS_LIST_LABEL_COLUMN, &iter_label, -1 );
g_assert( NA_IS_ACTION( iter_object ));
iter_uuid = na_action_get_uuid( NA_ACTION( iter_object ));
- gint ret_uuid = g_ascii_strcasecmp( iter_uuid, uuid );
- guint nb_profiles = na_action_get_profiles_count( NA_ACTION( iter_object ));
+ ret_uuid = g_ascii_strcasecmp( iter_uuid, uuid );
+ nb_profiles = na_action_get_profiles_count( NA_ACTION( iter_object ));
if( type == NA_ACTION_TYPE || ( ret_uuid == 0 && nb_profiles == 1 )){
- gint ret_label = g_utf8_collate( iter_label, label );
+ ret_label = g_utf8_collate( iter_label, label );
if( ret_uuid == 0 || ret_label > 0 ){
- g_debug( "%s: selecting action iter_object=%p, ret_uuid=%d, ret_label=%d", thisfn, iter_object, ret_uuid, ret_label );
+ g_debug( "%s: selecting action iter_object=%p, ret_uuid=%d, ret_label=%d", thisfn, ( void * ) iter_object, ret_uuid, ret_label );
gtk_tree_selection_select_iter( selection, &iter );
found = TRUE;
break;
}
} else if( ret_uuid == 0 && gtk_tree_model_iter_has_child( model, &iter )){
- GtkTreeIter iter_child, previous_child;
- gboolean iter_child_ok = gtk_tree_model_iter_children( model, &iter_child, &iter );
+ iter_child_ok = gtk_tree_model_iter_children( model, &iter_child, &iter );
while( iter_child_ok ){
gtk_tree_model_get( model, &iter_child, IACTIONS_LIST_NAOBJECT_COLUMN, &iter_object, IACTIONS_LIST_LABEL_COLUMN, &iter_label, -1 );
- gint ret_label = g_utf8_collate( iter_label, label );
+ ret_label = g_utf8_collate( iter_label, label );
if( ret_label >= 0 ){
- g_debug( "%s: selecting profile iter_object=%p, ret_uuid=%d, ret_label=%d", thisfn, iter_object, ret_uuid, ret_label );
+ g_debug( "%s: selecting profile iter_object=%p, ret_uuid=%d, ret_label=%d", thisfn, ( void * ) iter_object, ret_uuid, ret_label );
gtk_tree_selection_select_iter( selection, &iter_child );
found = TRUE;
break;
@@ -430,14 +453,19 @@ void
nact_iactions_list_select_first( NactWindow *window )
{
static const gchar *thisfn = "nact_iactions_list_select_first";
- g_debug( "%s: window=%p", thisfn, window );
+ GtkWidget *list;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean iterok;
- GtkWidget *list = get_actions_list_widget( window );
- GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( list ));
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
- GtkTreeIter iter;
- GtkTreeModel *model = gtk_tree_view_get_model( GTK_TREE_VIEW( list ));
- gboolean iterok = gtk_tree_model_get_iter_first( model, &iter );
+ list = get_actions_list_widget( window );
+ selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( list ));
+
+ model = gtk_tree_view_get_model( GTK_TREE_VIEW( list ));
+ iterok = gtk_tree_model_get_iter_first( model, &iter );
if( !iterok ){
g_debug( "%s: empty actions list: unselect all", thisfn );
gtk_tree_selection_unselect_all( selection );
@@ -465,12 +493,14 @@ NAObject *
nact_iactions_list_get_selected_object( NactWindow *window )
{
NAObject *object = NULL;
-
- GtkWidget *treeview = get_actions_list_widget( window );
- GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ));
-
+ GtkWidget *treeview;
+ GtkTreeSelection *selection;
GtkTreeModel *tm_model;
GtkTreeIter iter;
+
+ treeview = get_actions_list_widget( window );
+ selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ));
+
if( gtk_tree_selection_get_selected( selection, &tm_model, &iter )){
gtk_tree_model_get( tm_model, &iter, IACTIONS_LIST_NAOBJECT_COLUMN, &object, -1 );
@@ -492,20 +522,21 @@ GSList *
nact_iactions_list_get_selected_actions( NactWindow *window )
{
GSList *actions = NULL;
-
- GtkWidget *treeview = get_actions_list_widget( window );
- GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ));
-
+ GtkWidget *treeview;
+ GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
- GList *it;
+ GList *it, *listrows;
NAAction *action;
+ GtkTreePath *path;
+
+ treeview = get_actions_list_widget( window );
+ selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ));
+ listrows = gtk_tree_selection_get_selected_rows( selection, &model );
- GList *listrows = gtk_tree_selection_get_selected_rows( selection, &model );
for( it = listrows ; it ; it = it->next ){
- GtkTreePath *path = ( GtkTreePath * ) it->data;
+ path = ( GtkTreePath * ) it->data;
gtk_tree_model_get_iter( model, &iter, path );
-
gtk_tree_model_get( model, &iter, IACTIONS_LIST_NAOBJECT_COLUMN, &action, -1 );
actions = g_slist_prepend( actions, action );
}
@@ -555,6 +586,8 @@ void
nact_iactions_list_toggle_collapse( NactWindow *window, const NAAction *action )
{
static const gchar *thisfn = "nact_iactions_list_toggle_collapse";
+ NAObject *iter_object;
+ GtkTreePath *path;
GtkWidget *treeview = get_actions_list_widget( window );
GtkTreeModel *model = gtk_tree_view_get_model( GTK_TREE_VIEW( treeview ));
@@ -564,21 +597,20 @@ nact_iactions_list_toggle_collapse( NactWindow *window, const NAAction *action )
while( iterok ){
- NAObject *iter_object;
gtk_tree_model_get( model, &iter, IACTIONS_LIST_NAOBJECT_COLUMN, &iter_object, -1 );
if( iter_object == NA_OBJECT( action )){
if( na_action_get_profiles_count( action ) > 1 ){
- GtkTreePath *path = gtk_tree_model_get_path( model, &iter );
+ path = gtk_tree_model_get_path( model, &iter );
if( gtk_tree_view_row_expanded( GTK_TREE_VIEW( treeview ), path )){
gtk_tree_view_collapse_row( GTK_TREE_VIEW( treeview ), path );
- g_debug( "%s: action=%p collapsed", thisfn, action );
+ g_debug( "%s: action=%p collapsed", thisfn, ( void * ) action );
} else {
gtk_tree_view_expand_row( GTK_TREE_VIEW( treeview ), path, TRUE );
- g_debug( "%s: action=%p expanded", thisfn, action );
+ g_debug( "%s: action=%p expanded", thisfn, ( void * ) action );
}
gtk_tree_path_free( path );
@@ -608,17 +640,22 @@ nact_iactions_list_update_selected( NactWindow *window, NAAction *action )
GtkTreeModel *tm_model;
GtkTreeIter iter;
+ NAObject *object;
+ GtkTreePath *path;
+ GtkTreeModelFilter *tmf_model;
+ GtkTreeStore *ts_model;
+ GtkTreeIter ts_iter;
+ GSList *profiles, *ip;
+
if( gtk_tree_selection_get_selected( selection, &tm_model, &iter )){
- NAObject *object;
gtk_tree_model_get( tm_model, &iter, IACTIONS_LIST_NAOBJECT_COLUMN, &object, -1 );
g_assert( object );
- GtkTreePath *path = gtk_tree_model_get_path( tm_model, &iter );
+ path = gtk_tree_model_get_path( tm_model, &iter );
- GtkTreeModelFilter *tmf_model = GTK_TREE_MODEL_FILTER( gtk_tree_view_get_model( GTK_TREE_VIEW( treeview )));
- GtkTreeStore *ts_model = GTK_TREE_STORE( gtk_tree_model_filter_get_model( tmf_model ));
- GtkTreeIter ts_iter;
+ tmf_model = GTK_TREE_MODEL_FILTER( gtk_tree_view_get_model( GTK_TREE_VIEW( treeview )));
+ ts_model = GTK_TREE_STORE( gtk_tree_model_filter_get_model( tmf_model ));
gtk_tree_model_get_iter( GTK_TREE_MODEL( ts_model ), &ts_iter, path );
if( NA_IS_ACTION( object )){
@@ -629,8 +666,7 @@ nact_iactions_list_update_selected( NactWindow *window, NAAction *action )
} else {
g_assert( NA_IS_ACTION_PROFILE( object ));
/*g_debug( "nact_iactions_list_update_selected: selected profile=%p", object );*/
- GSList *profiles = na_action_get_profiles( action );
- GSList *ip;
+ profiles = na_action_get_profiles( action );
for( ip = profiles ; ip ; ip = ip->next ){
if( object == NA_OBJECT( ip->data )){
setup_profile( treeview, ts_model, &ts_iter, NA_ACTION_PROFILE( ip->data ));
@@ -662,11 +698,14 @@ nact_iactions_list_set_edition_mode( NactWindow *window, gboolean edition )
void
nact_iactions_list_set_multiple_selection( NactWindow *window, gboolean multiple )
{
+ GtkWidget *list;
+ GtkTreeSelection *selection;
+
g_assert( NACT_IS_IACTIONS_LIST( window ));
g_object_set_data( G_OBJECT( window ), ACCEPT_MULTIPLE_SELECTION, GINT_TO_POINTER( multiple ));
- GtkWidget *list = get_actions_list_widget( window );
- GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( list ));
+ list = get_actions_list_widget( window );
+ selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( list ));
gtk_tree_selection_set_mode( selection, multiple ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE );
}
@@ -694,8 +733,10 @@ nact_iactions_list_set_is_filling_list( NactWindow *window, gboolean is_filling
static GSList *
v_get_actions( NactWindow *window )
{
+ NactIActionsList *instance;
+
g_assert( NACT_IS_IACTIONS_LIST( window ));
- NactIActionsList *instance = NACT_IACTIONS_LIST( window );
+ instance = NACT_IACTIONS_LIST( window );
if( NACT_IACTIONS_LIST_GET_INTERFACE( instance )->get_actions ){
return( NACT_IACTIONS_LIST_GET_INTERFACE( instance )->get_actions( window ));
@@ -718,14 +759,17 @@ v_set_sorted_actions( NactWindow *window, GSList *actions )
static void
v_on_selection_changed( GtkTreeSelection *selection, gpointer user_data )
{
+ NactIActionsList *instance;
+ gboolean send_message, is_filling;
+
g_assert( NACT_IS_IACTIONS_LIST( user_data ));
g_assert( BASE_IS_WINDOW( user_data ));
- NactIActionsList *instance = NACT_IACTIONS_LIST( user_data );
+ instance = NACT_IACTIONS_LIST( user_data );
g_assert( NACT_IS_WINDOW( user_data ));
- gboolean send_message = GPOINTER_TO_INT( g_object_get_data( G_OBJECT( user_data ), SEND_SELECTION_CHANGED_MESSAGE ));
- gboolean is_filling = GPOINTER_TO_INT( g_object_get_data( G_OBJECT( user_data ), IS_FILLING_LIST ));
+ send_message = GPOINTER_TO_INT( g_object_get_data( G_OBJECT( user_data ), SEND_SELECTION_CHANGED_MESSAGE ));
+ is_filling = GPOINTER_TO_INT( g_object_get_data( G_OBJECT( user_data ), IS_FILLING_LIST ));
if( send_message || !is_filling ){
if( NACT_IACTIONS_LIST_GET_INTERFACE( instance )->on_selection_changed ){
@@ -740,11 +784,12 @@ v_on_button_press_event( GtkWidget *widget, GdkEventButton *event, gpointer user
/*static const gchar *thisfn = "nact_iactions_list_v_on_button_pres_event";
g_debug( "%s: widget=%p, event=%p, user_data=%p", thisfn, widget, event, user_data );*/
+ gboolean stop = FALSE;
+ NactIActionsList *instance;
+
g_assert( NACT_IS_IACTIONS_LIST( user_data ));
g_assert( NACT_IS_WINDOW( user_data ));
-
- gboolean stop = FALSE;
- NactIActionsList *instance = NACT_IACTIONS_LIST( user_data );
+ instance = NACT_IACTIONS_LIST( user_data );
if( NACT_IACTIONS_LIST_GET_INTERFACE( instance )->on_button_press_event ){
stop = NACT_IACTIONS_LIST_GET_INTERFACE( instance )->on_button_press_event( widget, event, user_data );
@@ -766,12 +811,14 @@ v_on_key_pressed_event( GtkWidget *widget, GdkEventKey *event, gpointer user_dat
/*static const gchar *thisfn = "nact_iactions_list_v_on_key_pressed_event";
g_debug( "%s: widget=%p, event=%p, user_data=%p", thisfn, widget, event, user_data );*/
+ gboolean stop = FALSE;
+ NactIActionsList *instance;
+
g_assert( NACT_IS_IACTIONS_LIST( user_data ));
g_assert( NACT_IS_WINDOW( user_data ));
g_assert( event->type == GDK_KEY_PRESS );
- gboolean stop = FALSE;
- NactIActionsList *instance = NACT_IACTIONS_LIST( user_data );
+ instance = NACT_IACTIONS_LIST( user_data );
if( NACT_IACTIONS_LIST_GET_INTERFACE( instance )->on_key_pressed_event ){
stop = NACT_IACTIONS_LIST_GET_INTERFACE( instance )->on_key_pressed_event( widget, event, user_data );
@@ -840,13 +887,15 @@ static void
display_label( GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, NactWindow *window )
{
NAObject *object;
+ gchar *label;
+ gboolean modified = FALSE;
+ gboolean valid = TRUE;
+
gtk_tree_model_get( model, iter, IACTIONS_LIST_NAOBJECT_COLUMN, &object, -1 );
if( object ){
g_assert( NA_IS_OBJECT( object ));
- gchar *label = na_object_get_label( object );
- gboolean modified = FALSE;
- gboolean valid = TRUE;
+ label = na_object_get_label( object );
if( is_edition_mode( window )){
if( NA_IS_ACTION( object )){
@@ -883,6 +932,8 @@ setup_action( GtkWidget *treeview, GtkTreeStore *model, GtkTreeIter *iter, NAAct
static const gchar *thisfn = "nact_iactions_list_setup_action";
GtkStockItem item;
GdkPixbuf* icon = NULL;
+ gint width, height;
+ GError* error = NULL;
gchar *label = na_action_get_label( action );
gchar *iconname = na_action_get_icon( action );
@@ -897,9 +948,6 @@ setup_action( GtkWidget *treeview, GtkTreeStore *model, GtkTreeIter *iter, NAAct
} else if( g_file_test( iconname, G_FILE_TEST_EXISTS )
&& g_file_test( iconname, G_FILE_TEST_IS_REGULAR )){
- gint width;
- gint height;
- GError* error = NULL;
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
icon = gdk_pixbuf_new_from_file_at_size( iconname, width, height, &error );
@@ -929,13 +977,13 @@ setup_profile( GtkWidget *treeview, GtkTreeStore *model, GtkTreeIter *iter, NAAc
static gint
sort_actions_list( GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, NactWindow *window )
{
- g_debug( "sort_actions_list" );
gchar *labela, *labelb;
+ gint ret;
gtk_tree_model_get( model, a, IACTIONS_LIST_LABEL_COLUMN, &labela, -1 );
gtk_tree_model_get( model, b, IACTIONS_LIST_LABEL_COLUMN, &labelb, -1 );
- gint ret = g_utf8_collate( labela, labelb );
+ ret = g_utf8_collate( labela, labelb );
g_free( labela );
g_free( labelb );
@@ -947,8 +995,9 @@ static gboolean
filter_visible( GtkTreeModel *model, GtkTreeIter *iter, gpointer data )
{
NAObject *object;
+ NAAction *action;
+
gtk_tree_model_get( model, iter, IACTIONS_LIST_NAOBJECT_COLUMN, &object, -1 );
- /*g_debug( "nact_main_window_filer_visible: model=%p, iter=%p, data=%p, object=%p", model, iter, data, object );*/
if( object ){
if( NA_IS_ACTION( object )){
@@ -956,7 +1005,7 @@ filter_visible( GtkTreeModel *model, GtkTreeIter *iter, gpointer data )
}
g_assert( NA_IS_ACTION_PROFILE( object ));
- NAAction *action = na_action_profile_get_action( NA_ACTION_PROFILE( object ));
+ action = na_action_profile_get_action( NA_ACTION_PROFILE( object ));
return( na_action_get_profiles_count( action ) > 1 );
}
@@ -979,11 +1028,12 @@ get_expanded_rows( NactWindow *window )
GtkTreeIter iter;
gboolean iterok = gtk_tree_model_get_iter_first( model, &iter );
NAObject *object;
+ GtkTreePath *path;
while( iterok ){
gtk_tree_model_get( model, &iter, IACTIONS_LIST_NAOBJECT_COLUMN, &object, -1 );
- GtkTreePath *path = gtk_tree_model_get_path( model, &iter );
+ path = gtk_tree_model_get_path( model, &iter );
if( gtk_tree_view_row_expanded( GTK_TREE_VIEW( treeview ), path )){
expanded = g_slist_prepend( expanded, object );
@@ -1006,15 +1056,16 @@ expand_rows( NactWindow *window, GSList *expanded )
GtkTreeIter iter;
gboolean iterok = gtk_tree_model_get_iter_first( model, &iter );
NAObject *object;
+ GSList *is;
+ GtkTreePath *path;
while( iterok ){
gtk_tree_model_get( model, &iter, IACTIONS_LIST_NAOBJECT_COLUMN, &object, -1 );
- GSList *is;
for( is = expanded ; is ; is = is->next ){
if( object == NA_OBJECT( is->data )){
- GtkTreePath *path = gtk_tree_model_get_path( model, &iter );
+ path = gtk_tree_model_get_path( model, &iter );
gtk_tree_view_expand_row( GTK_TREE_VIEW( treeview ), path, TRUE );
gtk_tree_path_free( path );
diff --git a/src/nact/nact-iadvanced-tab.c b/src/nact/nact-iadvanced-tab.c
index 6797353..3ab23d6 100644
--- a/src/nact/nact-iadvanced-tab.c
+++ b/src/nact/nact-iadvanced-tab.c
@@ -44,6 +44,7 @@
/* private interface data
*/
struct NactIAdvancedTabInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* column ordering
@@ -79,8 +80,6 @@ static void set_action_schemes( gchar *scheme, GtkTreeModel *model )
static GtkButton *get_add_button( NactWindow *window );
static GtkButton *get_remove_button( NactWindow *window );
-static void on_switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, NactWindow *window );
-
GType
nact_iadvanced_tab_get_type( void )
{
@@ -97,7 +96,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_iadvanced_tab_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NactIAdvancedTabInterface ),
@@ -111,7 +110,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIAdvancedTab", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NactIAdvancedTab", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -125,7 +126,7 @@ interface_base_init( NactIAdvancedTabInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NactIAdvancedTabInterfacePrivate, 1 );
@@ -143,7 +144,7 @@ interface_base_finalize( NactIAdvancedTabInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -155,7 +156,8 @@ void
nact_iadvanced_tab_initial_load( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iadvanced_tab_initial_load";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
create_schemes_selection_list( dialog );
}
@@ -164,15 +166,17 @@ void
nact_iadvanced_tab_runtime_init( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iadvanced_tab_runtime_init";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ GtkTreeView *scheme_widget;
+ GtkTreeViewColumn *column;
+ GList *renderers;
+ GtkButton *add_button, *remove_button;
- GtkWidget *notebook = base_window_get_widget( BASE_WINDOW( dialog ), "MainNotebook" );
- nact_window_signal_connect( dialog, G_OBJECT( notebook ), "switch-page", G_CALLBACK( on_switch_page ));
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
- GtkTreeView *scheme_widget = get_schemes_tree_view( dialog );
+ scheme_widget = get_schemes_tree_view( dialog );
- GtkTreeViewColumn *column = gtk_tree_view_get_column( scheme_widget, SCHEMES_CHECKBOX_COLUMN );
- GList *renderers = gtk_tree_view_column_get_cell_renderers( column );
+ column = gtk_tree_view_get_column( scheme_widget, SCHEMES_CHECKBOX_COLUMN );
+ renderers = gtk_tree_view_column_get_cell_renderers( column );
nact_window_signal_connect( dialog, G_OBJECT( renderers->data ), "toggled", G_CALLBACK( on_scheme_selection_toggled ));
column = gtk_tree_view_get_column( scheme_widget, SCHEMES_KEYWORD_COLUMN );
@@ -183,9 +187,9 @@ nact_iadvanced_tab_runtime_init( NactWindow *dialog )
renderers = gtk_tree_view_column_get_cell_renderers( column );
nact_window_signal_connect( dialog, G_OBJECT( renderers->data ), "edited", G_CALLBACK( on_scheme_desc_edited ));
- GtkButton *button = get_add_button( dialog );
- nact_window_signal_connect( dialog, G_OBJECT( button ), "clicked", G_CALLBACK( on_add_scheme_clicked ));
- GtkButton *remove_button = get_remove_button( dialog );
+ add_button = get_add_button( dialog );
+ nact_window_signal_connect( dialog, G_OBJECT( add_button ), "clicked", G_CALLBACK( on_add_scheme_clicked ));
+ remove_button = get_remove_button( dialog );
nact_window_signal_connect( dialog, G_OBJECT( remove_button ), "clicked", G_CALLBACK( on_remove_scheme_clicked ));
nact_window_signal_connect( dialog, G_OBJECT( gtk_tree_view_get_selection( scheme_widget )), "changed", G_CALLBACK( on_scheme_list_selection_changed ));
@@ -195,37 +199,44 @@ void
nact_iadvanced_tab_all_widgets_showed( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iadvanced_tab_all_widgets_showed";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
void
nact_iadvanced_tab_dispose( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iadvanced_tab_dispose";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
void
nact_iadvanced_tab_set_profile( NactWindow *dialog, NAActionProfile *profile )
{
static const gchar *thisfn = "nact_iadvanced_tab_set_profile";
- g_debug( "%s: dialog=%p, profile=%p", thisfn, dialog, profile );
+ GtkTreeModel *scheme_model;
+ GSList *schemes;
+ GtkTreeView *scheme_widget;
+ GtkButton *add, *remove;
+
+ g_debug( "%s: dialog=%p, profile=%p", thisfn, ( void * ) dialog, ( void * ) profile );
- GtkTreeModel *scheme_model = get_schemes_tree_model( dialog );
+ scheme_model = get_schemes_tree_model( dialog );
gtk_tree_model_foreach( scheme_model, ( GtkTreeModelForeachFunc ) reset_schemes_list, NULL );
if( profile ){
- GSList *schemes = na_action_profile_get_schemes( profile );
+ schemes = na_action_profile_get_schemes( profile );
g_slist_foreach( schemes, ( GFunc ) set_action_schemes, scheme_model );
}
- GtkTreeView *scheme_widget = get_schemes_tree_view( dialog );
+ scheme_widget = get_schemes_tree_view( dialog );
gtk_widget_set_sensitive( GTK_WIDGET( scheme_widget ), profile != NULL );
- GtkButton *add = get_add_button( dialog );
+ add = get_add_button( dialog );
gtk_widget_set_sensitive( GTK_WIDGET( add ), profile != NULL );
- GtkButton *remove = get_remove_button( dialog );
+ remove = get_remove_button( dialog );
gtk_widget_set_sensitive( GTK_WIDGET( remove ), profile != NULL );
}
@@ -237,8 +248,11 @@ GSList *
nact_iadvanced_tab_get_schemes( NactWindow *window )
{
GSList *list = NULL;
- GtkTreeModel* scheme_model = get_schemes_tree_model( window );
+ GtkTreeModel* scheme_model;
+
+ scheme_model = get_schemes_tree_model( window );
gtk_tree_model_foreach( scheme_model, ( GtkTreeModelForeachFunc ) get_action_schemes_list, &list );
+
return( list );
}
@@ -269,20 +283,25 @@ on_scheme_selection_toggled( GtkCellRendererToggle *renderer, gchar *path, gpoin
{
/*static const gchar *thisfn = "nact_iadvanced_tab_on_scheme_selection_toggled";*/
/*g_debug( "%s: renderer=%p, path=%s, user_data=%p", thisfn, renderer, path, user_data );*/
+
+ NactWindow *dialog;
+ NAActionProfile *edited;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreePath *tree_path;
+ gboolean state;
+ gchar *scheme;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
- NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
+ edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
if( edited ){
- GtkTreeModel *model = get_schemes_tree_model( dialog );
- GtkTreeIter iter;
+ model = get_schemes_tree_model( dialog );
- GtkTreePath *tree_path = gtk_tree_path_new_from_string( path );
+ tree_path = gtk_tree_path_new_from_string( path );
gtk_tree_model_get_iter( model, &iter, tree_path );
gtk_tree_path_free( tree_path );
-
- gboolean state;
- gchar *scheme;
gtk_tree_model_get( model, &iter, SCHEMES_CHECKBOX_COLUMN, &state, SCHEMES_KEYWORD_COLUMN, &scheme, -1 );
/* gtk_tree_model_get: returns the previous state
@@ -304,16 +323,19 @@ on_scheme_keyword_edited( GtkCellRendererText *renderer, const gchar *path, cons
/*static const gchar *thisfn = "nact_iadvanced_tab_on_scheme_keyword_edited";*/
/*g_debug( "%s: renderer=%p, path=%s, text=%s, user_data=%p", thisfn, renderer, path, text, user_data );*/
- g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
-
+ NactWindow *dialog;
gboolean state = FALSE;
gchar *old_text = NULL;
+ NAActionProfile *edited;
+
+ g_assert( NACT_IS_WINDOW( user_data ));
+ dialog = NACT_WINDOW( user_data );
+
scheme_cell_edited( dialog, path, text, SCHEMES_KEYWORD_COLUMN, &state, &old_text );
if( state ){
/*g_debug( "%s: old_scheme=%s", thisfn, old_text );*/
- NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
+ edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
na_action_profile_set_scheme( edited, old_text, FALSE );
na_action_profile_set_scheme( edited, text, TRUE );
}
@@ -328,8 +350,10 @@ on_scheme_desc_edited( GtkCellRendererText *renderer, const gchar *path, const g
/*static const gchar *thisfn = "nact_iadvanced_tab_on_scheme_desc_edited";
g_debug( "%s: renderer=%p, path=%s, text=%s, user_data=%p", thisfn, renderer, path, text, user_data );*/
+ NactWindow *dialog;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
scheme_cell_edited( dialog, path, text, SCHEMES_DESC_COLUMN, NULL, NULL );
}
@@ -340,10 +364,13 @@ on_scheme_list_selection_changed( GtkTreeSelection *selection, gpointer user_dat
/*static const gchar *thisfn = "nact_iadvanced_tab_on_scheme_list_selection_changed";
g_debug( "%s: selection=%p, user_data=%p", thisfn, selection, user_data );*/
+ NactWindow *dialog;
+ GtkWidget *button;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
- GtkWidget *button = GTK_WIDGET( get_remove_button( dialog ));
+ button = GTK_WIDGET( get_remove_button( dialog ));
if( gtk_tree_selection_count_selected_rows( selection )){
gtk_widget_set_sensitive( button, TRUE );
@@ -358,6 +385,7 @@ on_add_scheme_clicked( GtkButton *button, gpointer user_data )
{
GtkTreeModel *model = get_schemes_tree_model( NACT_WINDOW( user_data ));
GtkTreeIter row;
+
gtk_list_store_append( GTK_LIST_STORE( model ), &row );
gtk_list_store_set(
GTK_LIST_STORE( model ),
@@ -372,13 +400,10 @@ on_add_scheme_clicked( GtkButton *button, gpointer user_data )
static void
on_remove_scheme_clicked( GtkButton *button, gpointer user_data )
{
- g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
-
- GtkTreeView *listview = get_schemes_tree_view( dialog );
- GtkTreeSelection *selection = gtk_tree_view_get_selection( listview );
- GtkTreeModel *model = get_schemes_tree_model( dialog );
-
+ NactWindow *dialog;
+ GtkTreeView *listview;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
GList *selected_values_path = NULL;
GtkTreeIter iter;
GtkTreePath *path;
@@ -386,6 +411,13 @@ on_remove_scheme_clicked( GtkButton *button, gpointer user_data )
gboolean toggle_state;
gchar *scheme;
+ g_assert( NACT_IS_WINDOW( user_data ));
+ dialog = NACT_WINDOW( user_data );
+
+ listview = get_schemes_tree_view( dialog );
+ selection = gtk_tree_view_get_selection( listview );
+ model = get_schemes_tree_model( dialog );
+
selected_values_path = gtk_tree_selection_get_selected_rows( selection, &model );
for( il = selected_values_path ; il ; il = il->next ){
@@ -411,8 +443,9 @@ scheme_cell_edited( NactWindow *window, const gchar *path_string, const gchar *t
{
GtkTreeModel *model = get_schemes_tree_model( window );
GtkTreeIter iter;
+ GtkTreePath *path;
- GtkTreePath *path = gtk_tree_path_new_from_string( path_string );
+ path = gtk_tree_path_new_from_string( path_string );
gtk_tree_model_get_iter( model, &iter, path );
gtk_tree_path_free( path );
@@ -441,18 +474,26 @@ static void
create_schemes_selection_list( NactWindow *window )
{
static const char *thisfn = "nact_iadvanced_tab_create_schemes_selection_list";
- g_debug( "%s: window=%p", thisfn, window );
+ GtkWidget *listview;
+ GSList *schemes_list;
+ GtkListStore *model;
+ GSList *iter;
+ GtkTreeIter row;
+ gchar **tokens;
+ GtkCellRenderer *toggled_cell;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *text_cell;
+
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_IADVANCED_TAB( window ));
- GtkWidget *listview = GTK_WIDGET( get_schemes_tree_view( window ));
- GSList* schemes_list = get_schemes_default_list( window );
- GtkListStore *model = gtk_list_store_new( SCHEMES_N_COLUMN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING );
+ listview = GTK_WIDGET( get_schemes_tree_view( window ));
+ schemes_list = get_schemes_default_list( window );
+ model = gtk_list_store_new( SCHEMES_N_COLUMN, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING );
- GSList *iter;
- GtkTreeIter row;
for( iter = schemes_list ; iter ; iter = iter->next ){
- gchar **tokens = g_strsplit(( gchar * ) iter->data, "|", 2 );
+ tokens = g_strsplit(( gchar * ) iter->data, "|", 2 );
gtk_list_store_append( model, &row );
gtk_list_store_set( model, &row,
SCHEMES_CHECKBOX_COLUMN, FALSE,
@@ -467,8 +508,8 @@ create_schemes_selection_list( NactWindow *window )
gtk_tree_view_set_model( GTK_TREE_VIEW( listview ), GTK_TREE_MODEL( model ));
g_object_unref( model );
- GtkCellRenderer *toggled_cell = gtk_cell_renderer_toggle_new();
- GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes(
+ toggled_cell = gtk_cell_renderer_toggle_new();
+ column = gtk_tree_view_column_new_with_attributes(
"scheme-selected",
toggled_cell,
"active", SCHEMES_CHECKBOX_COLUMN,
@@ -476,7 +517,7 @@ create_schemes_selection_list( NactWindow *window )
gtk_tree_view_append_column( GTK_TREE_VIEW( listview ), column );
/*g_debug( "%s: toggled_cell=%p", thisfn, toggled_cell );*/
- GtkCellRenderer *text_cell = gtk_cell_renderer_text_new();
+ text_cell = gtk_cell_renderer_text_new();
g_object_set( G_OBJECT( text_cell ), "editable", TRUE, NULL );
column = gtk_tree_view_column_new_with_attributes(
"scheme-code",
@@ -594,21 +635,3 @@ get_remove_button( NactWindow *window )
{
return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "RemoveSchemeButton" )));
}
-
-/*
- * rationale: cf. nact-iaction-tab:on_swotch_page()
- */
-static void
-on_switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, NactWindow *window )
-{
- static const gchar *thisfn = "nact_iadvanced_tab_on_switch_page";
-
- if( page_num == ADVANCED_TAB ){
- g_debug( "%s: notebook=%p, page=%p, page_num=%d, window=%p", thisfn, notebook, page, page_num, window );
- GtkWidget *widget = GTK_WIDGET( g_object_get_data( G_OBJECT( window ), "nact-iadvanced-tab-last-focus" ));
- if( !widget ){
- widget = GTK_WIDGET( get_schemes_tree_view( window ));
- }
- gtk_widget_grab_focus( widget );
- }
-}
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index bf5f36d..09bd250 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -45,6 +45,7 @@
/* private interface data
*/
struct NactICommandTabInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* the GConf key used to read/write size and position of auxiliary dialogs
@@ -102,7 +103,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_icommand_tab_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NactICommandTabInterface ),
@@ -116,7 +117,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NactICommandTab", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NactICommandTab", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -130,7 +133,7 @@ interface_base_init( NactICommandTabInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NactICommandTabInterfacePrivate, 1 );
@@ -148,7 +151,7 @@ interface_base_finalize( NactICommandTabInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -160,28 +163,32 @@ void
nact_icommand_tab_initial_load( NactWindow *dialog )
{
static const gchar *thisfn = "nact_icommand_tab_initial_load";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
void
nact_icommand_tab_runtime_init( NactWindow *dialog )
{
static const gchar *thisfn = "nact_icommand_tab_runtime_init";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ GtkWidget *label_entry, *path_entry, *parameters_entry;
+ GtkButton *path_button, *legend_button;
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
- GtkWidget *label_entry = get_label_entry( dialog );
+ label_entry = get_label_entry( dialog );
nact_window_signal_connect( dialog, G_OBJECT( label_entry ), "changed", G_CALLBACK( on_label_changed ));
- GtkWidget *path_entry = get_path_entry( dialog );
+ path_entry = get_path_entry( dialog );
nact_window_signal_connect( dialog, G_OBJECT( path_entry ), "changed", G_CALLBACK( on_path_changed ));
- GtkButton *path_button = get_path_button( dialog );
+ path_button = get_path_button( dialog );
nact_window_signal_connect( dialog, G_OBJECT( path_button ), "clicked", G_CALLBACK( on_path_browse ));
- GtkWidget *parameters_entry = get_parameters_entry( dialog );
+ parameters_entry = get_parameters_entry( dialog );
nact_window_signal_connect( dialog, G_OBJECT( parameters_entry ), "changed", G_CALLBACK( on_parameters_changed ));
- GtkButton *legend_button = get_legend_button( dialog );
+ legend_button = get_legend_button( dialog );
nact_window_signal_connect( dialog, G_OBJECT( legend_button ), "clicked", G_CALLBACK( on_legend_clicked ));
}
@@ -192,14 +199,16 @@ void
nact_icommand_tab_all_widgets_showed( NactWindow *dialog )
{
static const gchar *thisfn = "nact_icommand_tab_all_widgets_showed";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
void
nact_icommand_tab_dispose( NactWindow *dialog )
{
static const gchar *thisfn = "nact_icommand_tab_dispose";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
hide_legend_dialog( dialog );
}
@@ -208,31 +217,35 @@ void
nact_icommand_tab_set_profile( NactWindow *dialog, const NAActionProfile *profile )
{
static const gchar *thisfn = "nact_icommand_tab_set_profile";
- g_debug( "%s: dialog=%p, profile=%p", thisfn, dialog, profile );
+ GtkWidget *label_entry, *path_entry, *parameters_entry;
+ gchar *label, *path, *parameters;
+ GtkButton *path_button, *legend_button;
+
+ g_debug( "%s: dialog=%p, profile=%p", thisfn, ( void * ) dialog, ( void * ) profile );
- GtkWidget *label_entry = get_label_entry( dialog );
- gchar *label = profile ? na_action_profile_get_label( profile ) : g_strdup( "" );
+ label_entry = get_label_entry( dialog );
+ label = profile ? na_action_profile_get_label( profile ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_entry ), label );
gtk_widget_set_sensitive( label_entry, profile != NULL );
check_for_label( dialog, GTK_ENTRY( label_entry ), label );
g_free( label );
- GtkWidget *path_entry = get_path_entry( dialog );
- gchar *path = profile ? na_action_profile_get_path( profile ) : g_strdup( "" );
+ path_entry = get_path_entry( dialog );
+ path = profile ? na_action_profile_get_path( profile ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( path_entry ), path );
gtk_widget_set_sensitive( path_entry, profile != NULL );
g_free( path );
- GtkWidget *parameters_entry = get_parameters_entry( dialog );
- gchar *parameters = profile ? na_action_profile_get_parameters( profile ) : g_strdup( "" );
+ parameters_entry = get_parameters_entry( dialog );
+ parameters = profile ? na_action_profile_get_parameters( profile ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( parameters_entry ), parameters );
gtk_widget_set_sensitive( parameters_entry, profile != NULL );
g_free( parameters );
- GtkButton *path_button = get_path_button( dialog );
+ path_button = get_path_button( dialog );
gtk_widget_set_sensitive( GTK_WIDGET( path_button ), profile != NULL );
- GtkButton *legend_button = get_legend_button( dialog );
+ legend_button = get_legend_button( dialog );
gtk_widget_set_sensitive( GTK_WIDGET( legend_button ), profile != NULL );
}
@@ -311,13 +324,17 @@ v_get_schemes( NactWindow *window )
static void
on_label_changed( GtkEntry *entry, gpointer user_data )
{
+ NactWindow *dialog;
+ NAActionProfile *edited;
+ const gchar *label;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
- NAActionProfile *edited = v_get_edited_profile( dialog );
+ edited = v_get_edited_profile( dialog );
if( edited ){
- const gchar *label = gtk_entry_get_text( entry );
+ label = gtk_entry_get_text( entry );
na_action_profile_set_label( edited, label );
v_field_modified( dialog );
check_for_label( dialog, entry, label );
@@ -327,10 +344,12 @@ on_label_changed( GtkEntry *entry, gpointer user_data )
static void
check_for_label( NactWindow *window, GtkEntry *entry, const gchar *label )
{
+ NAActionProfile *edited;
+
nact_statusbar_hide_status( NACT_MAIN_WINDOW( window ), PROP_ICOMMAND_TAB_STATUS_CONTEXT );
set_label_label( window, "black" );
- NAActionProfile *edited = v_get_edited_profile( window );
+ edited = v_get_edited_profile( window );
if( edited && g_utf8_strlen( label, -1 ) == 0 ){
/* i18n: status bar message when the profile label is empty */
@@ -357,10 +376,14 @@ get_label_entry( NactWindow *window )
static void
on_path_changed( GtkEntry *entry, gpointer user_data )
{
+ NactWindow *dialog;
+ NAActionProfile *edited;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
+
+ edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
- NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
if( edited ){
na_action_profile_set_path( edited, gtk_entry_get_text( entry ));
v_field_modified( dialog );
@@ -372,11 +395,16 @@ on_path_changed( GtkEntry *entry, gpointer user_data )
static void
on_path_browse( GtkButton *button, gpointer user_data )
{
- g_assert( NACT_IS_ICOMMAND_TAB( user_data ));
gboolean set_current_location = FALSE;
gchar *uri = NULL;
+ GtkWidget *dialog;
+ GtkWidget *path_entry;
+ const gchar *path;
+ gchar *filename;
- GtkWidget *dialog = gtk_file_chooser_dialog_new(
+ g_assert( NACT_IS_ICOMMAND_TAB( user_data ));
+
+ dialog = gtk_file_chooser_dialog_new(
_( "Choosing a command" ),
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -387,8 +415,8 @@ on_path_browse( GtkButton *button, gpointer user_data )
nact_iprefs_position_named_window( NACT_WINDOW( user_data ), GTK_WINDOW( dialog ), IPREFS_COMMAND_CHOOSER );
- GtkWidget *path_entry = get_path_entry( NACT_WINDOW( user_data ));
- const gchar *path = gtk_entry_get_text( GTK_ENTRY( path_entry ));
+ path_entry = get_path_entry( NACT_WINDOW( user_data ));
+ path = gtk_entry_get_text( GTK_ENTRY( path_entry ));
if( path && strlen( path )){
set_current_location = gtk_file_chooser_set_filename( GTK_FILE_CHOOSER( dialog ), path );
@@ -400,7 +428,7 @@ on_path_browse( GtkButton *button, gpointer user_data )
}
if( gtk_dialog_run( GTK_DIALOG( dialog )) == GTK_RESPONSE_ACCEPT ){
- gchar *filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ));
+ filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ));
gtk_entry_set_text( GTK_ENTRY( path_entry ), filename );
g_free (filename);
}
@@ -429,10 +457,14 @@ get_path_button( NactWindow *window )
static void
on_parameters_changed( GtkEntry *entry, gpointer user_data )
{
+ NactWindow *dialog;
+ NAActionProfile *edited;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
+
+ edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
- NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
if( edited ){
na_action_profile_set_parameters( edited, gtk_entry_get_text( entry ));
v_field_modified( dialog );
@@ -455,12 +487,11 @@ update_example_label( NactWindow *window )
static const gchar *original_label = N_( "<i><b><span size=\"small\">e.g., %s</span></b></i>" );
GtkWidget *example_widget = base_window_get_widget( BASE_WINDOW( window ), "CommandExampleLabel" );
- gchar *newlabel;
+ gchar *newlabel, *parameters;
if( v_get_edited_profile( window )){
- gchar *parameters = parse_parameters( window );
- /*g_debug( "%s: parameters=%s", thisfn, parameters );*/
+ parameters = parse_parameters( window );
/* convert special xml chars (&, <, >,...) to avoid warnings
* generated by Pango parser
@@ -517,6 +548,9 @@ parse_parameters( NactWindow *window )
gchar* ex_uri_list = NULL;
gchar* ex_scheme;
gchar* ex_host;
+ gboolean is_file, is_dir;
+ gboolean accept_multiple;
+ GSList *scheme_list;
const gchar* command = gtk_entry_get_text( GTK_ENTRY( get_path_entry( window )));
const gchar* param_template = gtk_entry_get_text( GTK_ENTRY( get_parameters_entry( window )));
@@ -529,11 +563,10 @@ parse_parameters( NactWindow *window )
g_string_append_printf( tmp_string, "%s ", command );
- gboolean is_file, is_dir;
v_get_isfiledir( window, &is_file, &is_dir );
- gboolean accept_multiple = v_get_multiple( window );
- GSList *scheme_list = v_get_schemes( window );
+ accept_multiple = v_get_multiple( window );
+ scheme_list = v_get_schemes( window );
separator = g_strdup_printf( " %s/", ex_path );
start = g_strdup_printf( "%s/", ex_path );
@@ -671,10 +704,13 @@ on_legend_clicked( GtkButton *button, gpointer user_data )
static void
show_legend_dialog( NactWindow *window )
{
- GtkWindow *legend_dialog = get_legend_dialog( window );
+ GtkWindow *legend_dialog;
+ GtkWindow *toplevel;
+
+ legend_dialog = get_legend_dialog( window );
gtk_window_set_deletable( legend_dialog, FALSE );
- GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
+ toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
gtk_window_set_transient_for( GTK_WINDOW( legend_dialog ), toplevel );
nact_iprefs_position_named_window( window, legend_dialog, IPREFS_LEGEND_DIALOG );
@@ -688,6 +724,7 @@ hide_legend_dialog( NactWindow *window )
{
GtkWindow *legend_dialog = get_legend_dialog( window );
gboolean is_visible = GPOINTER_TO_INT( g_object_get_data( G_OBJECT( legend_dialog ), LEGEND_DIALOG_IS_VISIBLE ));
+ GtkButton *legend_button;
if( is_visible ){
g_assert( GTK_IS_WINDOW( legend_dialog ));
@@ -697,7 +734,7 @@ hide_legend_dialog( NactWindow *window )
/* set the legend button state consistent for when the dialog is
* hidden by another mean (eg. close the edit profile dialog)
*/
- GtkButton *legend_button = get_legend_button( window );
+ legend_button = get_legend_button( window );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( legend_button ), FALSE );
g_object_set_data( G_OBJECT( legend_dialog ), LEGEND_DIALOG_IS_VISIBLE, GINT_TO_POINTER( FALSE ));
diff --git a/src/nact/nact-iconditions-tab.c b/src/nact/nact-iconditions-tab.c
index 9a24699..ffb1cac 100644
--- a/src/nact/nact-iconditions-tab.c
+++ b/src/nact/nact-iconditions-tab.c
@@ -44,6 +44,7 @@
/* private interface data
*/
struct NactIConditionsTabInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
static GType register_type( void );
@@ -83,7 +84,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_iconditions_tab_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NactIConditionsTabInterface ),
@@ -97,7 +98,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIConditionsTab", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NactIConditionsTab", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -111,7 +114,7 @@ interface_base_init( NactIConditionsTabInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NactIConditionsTabInterfacePrivate, 1 );
@@ -129,7 +132,7 @@ interface_base_finalize( NactIConditionsTabInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -141,32 +144,39 @@ void
nact_iconditions_tab_initial_load( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iconditions_tab_initial_load";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
void
nact_iconditions_tab_runtime_init( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iconditions_tab_runtime_init";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ GtkWidget *basenames_widget;
+ GtkButton *matchcase_button;
+ GtkWidget *mimetypes_widget;
+ GtkButton *isfile_button, *isdir_button, *both_button;
+ GtkButton *multiple_button;
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
- GtkWidget *basenames_widget = get_basenames_entry( dialog );
+ basenames_widget = get_basenames_entry( dialog );
nact_window_signal_connect( dialog, G_OBJECT( basenames_widget ), "changed", G_CALLBACK( on_basenames_changed ));
- GtkButton *matchcase_button = get_matchcase_button( dialog );
+ matchcase_button = get_matchcase_button( dialog );
nact_window_signal_connect( dialog, G_OBJECT( matchcase_button ), "toggled", G_CALLBACK( on_matchcase_toggled ));
- GtkWidget *mimetypes_widget = get_mimetypes_entry( dialog );
+ mimetypes_widget = get_mimetypes_entry( dialog );
nact_window_signal_connect( dialog, G_OBJECT( mimetypes_widget ), "changed", G_CALLBACK( on_mimetypes_changed ));
- GtkButton *isfile_button = get_isfile_button( dialog );
+ isfile_button = get_isfile_button( dialog );
nact_window_signal_connect( dialog, G_OBJECT( isfile_button ), "toggled", G_CALLBACK( on_isfiledir_toggled ));
- GtkButton *isdir_button = get_isdir_button( dialog );
+ isdir_button = get_isdir_button( dialog );
nact_window_signal_connect( dialog, G_OBJECT( isdir_button ), "toggled", G_CALLBACK( on_isfiledir_toggled ));
- GtkButton *both_button = get_both_button( dialog );
+ both_button = get_both_button( dialog );
nact_window_signal_connect( dialog, G_OBJECT( both_button ), "toggled", G_CALLBACK( on_isfiledir_toggled ));
- GtkButton *multiple_button = get_multiple_button( dialog );
+ multiple_button = get_multiple_button( dialog );
nact_window_signal_connect( dialog, G_OBJECT( multiple_button ), "toggled", G_CALLBACK( on_multiple_toggled ));
}
@@ -174,55 +184,67 @@ void
nact_iconditions_tab_all_widgets_showed( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iconditions_tab_all_widgets_showed";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
void
nact_iconditions_tab_dispose( NactWindow *dialog )
{
static const gchar *thisfn = "nact_iconditions_tab_dispose";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
void
nact_iconditions_tab_set_profile( NactWindow *dialog, NAActionProfile *profile )
{
static const gchar *thisfn = "nact_iconditions_tab_set_profile";
- g_debug( "%s: dialog=%p, profile=%p", thisfn, dialog, profile );
-
- GtkWidget *basenames_widget = get_basenames_entry( dialog );
- GSList *basenames = profile ? na_action_profile_get_basenames( profile ) : NULL;
- gchar *basenames_text = profile ? na_utils_string_list_to_text( basenames ) : g_strdup( "" );
+ GtkWidget *basenames_widget, *mimetypes_widget;
+ GSList *basenames, *mimetypes;
+ gchar *basenames_text, *mimetypes_text;
+ GtkButton *matchcase_button;
+ gboolean matchcase;
+ gboolean isfile, isdir;
+ GtkButton *files_button, *dir_button, *both_button;
+ GtkButton *multiple_button;
+ gboolean multiple;
+
+ g_debug( "%s: dialog=%p, profile=%p", thisfn, ( void * ) dialog, ( void * ) profile );
+
+ basenames_widget = get_basenames_entry( dialog );
+ basenames = profile ? na_action_profile_get_basenames( profile ) : NULL;
+ basenames_text = profile ? na_utils_string_list_to_text( basenames ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( basenames_widget ), basenames_text );
g_free( basenames_text );
na_utils_free_string_list( basenames );
gtk_widget_set_sensitive( basenames_widget, profile != NULL );
- GtkButton *matchcase_button = get_matchcase_button( dialog );
- gboolean matchcase = profile ? na_action_profile_get_matchcase( profile ) : FALSE;
+ matchcase_button = get_matchcase_button( dialog );
+ matchcase = profile ? na_action_profile_get_matchcase( profile ) : FALSE;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( matchcase_button ), matchcase );
gtk_widget_set_sensitive( GTK_WIDGET( matchcase_button ), profile != NULL );
- GtkWidget *mimetypes_widget = get_mimetypes_entry( dialog );
- GSList *mimetypes = profile ? na_action_profile_get_mimetypes( profile ) : NULL;
- gchar *mimetypes_text = profile ? na_utils_string_list_to_text( mimetypes ) : g_strdup( "" );
+ mimetypes_widget = get_mimetypes_entry( dialog );
+ mimetypes = profile ? na_action_profile_get_mimetypes( profile ) : NULL;
+ mimetypes_text = profile ? na_utils_string_list_to_text( mimetypes ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( mimetypes_widget ), mimetypes_text );
g_free( mimetypes_text );
na_utils_free_string_list( mimetypes );
gtk_widget_set_sensitive( mimetypes_widget, profile != NULL );
- gboolean isfile = profile ? na_action_profile_get_is_file( profile ) : FALSE;
- gboolean isdir = profile ? na_action_profile_get_is_dir( profile ) : FALSE;
+ isfile = profile ? na_action_profile_get_is_file( profile ) : FALSE;
+ isdir = profile ? na_action_profile_get_is_dir( profile ) : FALSE;
set_isfiledir( dialog, isfile, isdir );
- GtkButton *files_button = get_isfile_button( dialog );
+ files_button = get_isfile_button( dialog );
gtk_widget_set_sensitive( GTK_WIDGET( files_button ), profile != NULL );
- GtkButton *dir_button = get_isdir_button( dialog );
+ dir_button = get_isdir_button( dialog );
gtk_widget_set_sensitive( GTK_WIDGET( dir_button ), profile != NULL );
- GtkButton *both_button = get_both_button( dialog );
+ both_button = get_both_button( dialog );
gtk_widget_set_sensitive( GTK_WIDGET( both_button ), profile != NULL );
- GtkButton *multiple_button = get_multiple_button( dialog );
- gboolean multiple = profile ? na_action_profile_get_multiple( profile ) : FALSE;
+ multiple_button = get_multiple_button( dialog );
+ multiple = profile ? na_action_profile_get_multiple( profile ) : FALSE;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( multiple_button ), multiple );
gtk_widget_set_sensitive( GTK_WIDGET( multiple_button ), profile != NULL );
}
@@ -230,10 +252,12 @@ nact_iconditions_tab_set_profile( NactWindow *dialog, NAActionProfile *profile )
void
nact_iconditions_tab_get_isfiledir( NactWindow *window, gboolean *isfile, gboolean *isdir )
{
+ gboolean both;
+
g_assert( isfile );
g_assert( isdir );
- gboolean both = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( get_both_button( window )));
+ both = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( get_both_button( window )));
if( both ){
*isfile = TRUE;
*isdir = TRUE;
@@ -275,13 +299,19 @@ v_field_modified( NactWindow *window )
static void
on_basenames_changed( GtkEntry *entry, gpointer user_data )
{
+ NactWindow *dialog;
+ NAActionProfile *edited;
+ const gchar *text;
+ GSList *basenames;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
+
+ edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
- NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
if( edited ){
- const gchar *text = gtk_entry_get_text( entry );
- GSList *basenames = na_utils_text_to_string_list( text );
+ text = gtk_entry_get_text( entry );
+ basenames = na_utils_text_to_string_list( text );
na_action_profile_set_basenames( edited, basenames );
na_utils_free_string_list( basenames );
v_field_modified( dialog );
@@ -297,12 +327,17 @@ get_basenames_entry( NactWindow *window )
static void
on_matchcase_toggled( GtkToggleButton *button, gpointer user_data )
{
+ NactWindow *dialog;
+ NAActionProfile *edited;
+ gboolean matchcase;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
+
+ edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
- NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
if( edited ){
- gboolean matchcase = gtk_toggle_button_get_active( button );
+ matchcase = gtk_toggle_button_get_active( button );
na_action_profile_set_matchcase( edited, matchcase );
v_field_modified( dialog );
}
@@ -317,13 +352,19 @@ get_matchcase_button( NactWindow *window )
static void
on_mimetypes_changed( GtkEntry *entry, gpointer user_data )
{
+ NactWindow *dialog;
+ NAActionProfile *edited;
+ const gchar *text;
+ GSList *mimetypes;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
+
+ edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
- NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
if( edited ){
- const gchar *text = gtk_entry_get_text( entry );
- GSList *mimetypes = na_utils_text_to_string_list( text );
+ text = gtk_entry_get_text( entry );
+ mimetypes = na_utils_text_to_string_list( text );
na_action_profile_set_mimetypes( edited, mimetypes );
na_utils_free_string_list( mimetypes );
v_field_modified( dialog );
@@ -345,13 +386,16 @@ static void
on_isfiledir_toggled( GtkToggleButton *button, gpointer user_data )
{
/*static const gchar *thisfn = "nact_iconditions_tab_on_isfiledir_toggled";*/
+ NactWindow *dialog;
+ NAActionProfile *edited;
+ gboolean isfile, isdir;
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
+
+ edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
- NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
if( edited ){
- gboolean isfile, isdir;
nact_iconditions_tab_get_isfiledir( dialog, &isfile, &isdir );
na_action_profile_set_isfiledir( edited, isfile, isdir );
v_field_modified( dialog );
@@ -393,12 +437,17 @@ get_both_button( NactWindow *window )
static void
on_multiple_toggled( GtkToggleButton *button, gpointer user_data )
{
+ NactWindow *dialog;
+ NAActionProfile *edited;
+ gboolean multiple;
+
g_assert( NACT_IS_WINDOW( user_data ));
- NactWindow *dialog = NACT_WINDOW( user_data );
+ dialog = NACT_WINDOW( user_data );
+
+ edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
- NAActionProfile *edited = NA_ACTION_PROFILE( v_get_edited_profile( dialog ));
if( edited ){
- gboolean multiple = gtk_toggle_button_get_active( button );
+ multiple = gtk_toggle_button_get_active( button );
na_action_profile_set_multiple( edited, multiple );
v_field_modified( dialog );
}
diff --git a/src/nact/nact-imenubar.c b/src/nact/nact-imenubar.c
index 5def4c5..f9b5919 100644
--- a/src/nact/nact-imenubar.c
+++ b/src/nact/nact-imenubar.c
@@ -47,6 +47,7 @@
/* private interface data
*/
struct NactIMenubarInterfacePrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
#define PROP_IMENUBAR_STATUS_CONTEXT "nact-imenubar-status-context"
@@ -206,7 +207,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_imenubar_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NactIMenubarInterface ),
@@ -220,7 +221,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIMenubar", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NactIMenubar", &info, 0 );
g_type_interface_add_prerequisite( type, NACT_WINDOW_TYPE );
@@ -234,7 +237,7 @@ interface_base_init( NactIMenubarInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NactIMenubarInterfacePrivate, 1 );
@@ -249,7 +252,7 @@ interface_base_finalize( NactIMenubarInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -267,6 +270,14 @@ void
nact_imenubar_init( NactMainWindow *window )
{
static const gchar *thisfn = "nact_imenubar_init";
+ GtkActionGroup *action_group;
+ GtkUIManager *ui_manager;
+ GError *error = NULL;
+ guint merge_id;
+ GtkWindow *wnd;
+ GtkAccelGroup *accel_group;
+ GtkWidget *menubar, *vbox;
+ int i;
g_assert( NACT_IS_MAIN_WINDOW( window ));
g_assert( NACT_IS_IMENUBAR( window ));
@@ -278,27 +289,26 @@ nact_imenubar_init( NactMainWindow *window )
* - install accelerators in the main window
* - pack menu bar in the main window
*/
- GtkActionGroup *action_group = gtk_action_group_new( "MenubarActions" );
+ action_group = gtk_action_group_new( "MenubarActions" );
gtk_action_group_set_translation_domain( action_group, GETTEXT_PACKAGE );
gtk_action_group_add_actions( action_group, entries, G_N_ELEMENTS( entries ), window );
- GtkUIManager *ui_manager = gtk_ui_manager_new();
+ ui_manager = gtk_ui_manager_new();
gtk_ui_manager_insert_action_group( ui_manager, action_group, 0 );
g_object_unref( action_group );
- GError *error = NULL;
- guint merge_id = gtk_ui_manager_add_ui_from_file( ui_manager, PKGDATADIR "/nautilus-actions-config-tool.actions", &error );
+ merge_id = gtk_ui_manager_add_ui_from_file( ui_manager, PKGDATADIR "/nautilus-actions-config-tool.actions", &error );
if( merge_id == 0 || error ){
g_warning( "%s: error=%s", thisfn, error->message );
g_error_free( error );
}
- GtkWindow *wnd = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
- GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group( ui_manager );
+ wnd = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
+ accel_group = gtk_ui_manager_get_accel_group( ui_manager );
gtk_window_add_accel_group( wnd, accel_group );
- GtkWidget *menubar = gtk_ui_manager_get_widget( ui_manager, "/ui/MainMenubar" );
- GtkWidget *vbox = base_window_get_widget( BASE_WINDOW( window ), "MenubarVBox" );
+ menubar = gtk_ui_manager_get_widget( ui_manager, "/ui/MainMenubar" );
+ vbox = base_window_get_widget( BASE_WINDOW( window ), "MenubarVBox" );
gtk_box_pack_start( GTK_BOX( vbox ), menubar, FALSE, FALSE, 0 );
g_object_set_data( G_OBJECT( window ), "nact-imenubar-ui-manager", ui_manager );
@@ -306,7 +316,6 @@ nact_imenubar_init( NactMainWindow *window )
/* menu and accelerators are ok
* but tooltip are no more displayed
*/
- int i;
for( i = 0 ; i < G_N_ELEMENTS( menu_actions ) ; ++ i ){
gchar *path = g_build_path( "/", "ui", "MainMenubar", menu_actions[i].menu, menu_actions[i].action, NULL );
GtkAction *action = gtk_ui_manager_get_action( ui_manager, path );
@@ -341,8 +350,8 @@ void
nact_imenubar_on_delete_event( NactWindow *window )
{
static const gchar *thisfn = "nact_imenubar_on_delete_event";
- g_debug( "%s: window=%p", thisfn, window );
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_MAIN_WINDOW( window ));
g_assert( NACT_IS_IMENUBAR( window ));
@@ -352,16 +361,22 @@ nact_imenubar_on_delete_event( NactWindow *window )
static void
on_file_menu_selected( GtkMenuItem *item, NactWindow *window )
{
- GtkUIManager *ui_manager = GTK_UI_MANAGER( g_object_get_data( G_OBJECT( window ), "nact-imenubar-ui-manager" ));
+ GtkUIManager *ui_manager;
+ NAObject *object;
+ gboolean new_profile_enabled, save_enabled;
+ GtkAction *new_profile_action, *save_action;
+ gint modified;
+
+ ui_manager = GTK_UI_MANAGER( g_object_get_data( G_OBJECT( window ), "nact-imenubar-ui-manager" ));
- NAObject *object = v_get_selected( window );
- gboolean new_profile_enabled = NA_IS_ACTION( object ) || NA_IS_ACTION_PROFILE( object );
- GtkAction *new_profile_action = gtk_ui_manager_get_action( ui_manager, "/ui/MainMenubar/FileMenu/NewProfileItem" );
+ object = v_get_selected( window );
+ new_profile_enabled = NA_IS_ACTION( object ) || NA_IS_ACTION_PROFILE( object );
+ new_profile_action = gtk_ui_manager_get_action( ui_manager, "/ui/MainMenubar/FileMenu/NewProfileItem" );
gtk_action_set_sensitive( new_profile_action, new_profile_enabled );
- gint modified = v_count_modified_actions( window );
- gboolean save_enabled = ( modified > 0 );
- GtkAction *save_action = gtk_ui_manager_get_action( ui_manager, "/ui/MainMenubar/FileMenu/SaveItem" );
+ modified = v_count_modified_actions( window );
+ save_enabled = ( modified > 0 );
+ save_action = gtk_ui_manager_get_action( ui_manager, "/ui/MainMenubar/FileMenu/SaveItem" );
gtk_action_set_sensitive( save_action, save_enabled );
}
@@ -375,16 +390,21 @@ on_new_action_activated( GtkMenuItem *item, NactWindow *window )
static void
on_new_profile_activated( GtkMenuItem *item, NactWindow *window )
{
- NAObject *object = v_get_selected( window );
+ NAObject *object;
+ NAAction *action;
+ NAActionProfile *new_profile;
+ gchar *name;
+
+ object = v_get_selected( window );
g_assert( NA_IS_OBJECT( object ));
- NAAction *action = NA_IS_ACTION( object ) ?
+ action = NA_IS_ACTION( object ) ?
NA_ACTION( object ) : na_action_profile_get_action( NA_ACTION_PROFILE( object ));
- NAActionProfile *new_profile = na_action_profile_new();
- g_debug( "nact_imenubar_on_new_profile_activated: action=%p, profile=%p", action, new_profile );
+ new_profile = na_action_profile_new();
+ g_debug( "nact_imenubar_on_new_profile_activated: action=%p, profile=%p", ( void * ) action, ( void * ) new_profile );
- gchar *name = na_action_get_new_profile_name( action );
+ name = na_action_get_new_profile_name( action );
na_action_profile_set_name( new_profile, name );
g_free( name );
@@ -395,22 +415,27 @@ static void
on_save_activated( GtkMenuItem *item, NactWindow *window )
{
static const gchar *thisfn = "nact_imenubar_on_save_activated";
- g_debug( "%s: item=%p, window=%p", thisfn, item, window );
+ NactApplication *application;
+ NAPivot *pivot;
+ GSList *actions, *ia;
+ GType type = 0;
+ gchar *uuid = NULL;
+ gchar *label = NULL;
+ NAObject *current;
+ GSList *deleted;
+ NAAction *action;
+
+ g_debug( "%s: item=%p, window=%p", thisfn, ( void * ) item, ( void * ) window );
- NactApplication *application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- NAPivot *pivot = nact_application_get_pivot( application );
- GSList *actions = v_get_actions( window );
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
+ pivot = nact_application_get_pivot( application );
+ actions = v_get_actions( window );
g_debug( "%s: %d actions", thisfn, g_slist_length( actions ));
- GSList *ia;
/* keep the current selection
* to be able to restore it at the end of the operation
*/
- GType type = 0;
- gchar *uuid = NULL;
- gchar *label = NULL;
-
- NAObject *current = v_get_selected( window );
+ current = v_get_selected( window );
if( current ){
if( NA_IS_ACTION( current )){
uuid = na_action_get_uuid( NA_ACTION( current ));
@@ -419,7 +444,7 @@ on_save_activated( GtkMenuItem *item, NactWindow *window )
} else {
g_assert( NA_IS_ACTION_PROFILE( current ));
- NAAction *action = na_action_profile_get_action( NA_ACTION_PROFILE( current ));
+ action = na_action_profile_get_action( NA_ACTION_PROFILE( current ));
uuid = na_action_get_uuid( action );
label = na_action_profile_get_label( NA_ACTION_PROFILE( current ));
type = NA_ACTION_PROFILE_TYPE;
@@ -458,7 +483,7 @@ on_save_activated( GtkMenuItem *item, NactWindow *window )
/* delete the removed actions
* - remove the origin of pivot if any
*/
- GSList *deleted = v_get_deleted_actions( window );
+ deleted = v_get_deleted_actions( window );
for( ia = deleted ; ia ; ia = ia->next ){
NAAction *current = NA_ACTION( ia->data );
if( nact_window_delete_action( window, current )){
@@ -487,9 +512,11 @@ static void
on_quit_activated( GtkMenuItem *item, NactWindow *window )
{
static const gchar *thisfn = "nact_imenubar_on_quit_activated";
- g_debug( "%s: item=%p, window=%p", thisfn, item, window );
+ gint count;
- gint count = v_count_modified_actions( NACT_WINDOW( window ));
+ g_debug( "%s: item=%p, window=%p", thisfn, ( void * ) item, ( void * ) window );
+
+ count = v_count_modified_actions( NACT_WINDOW( window ));
if( !count || nact_window_warn_count_modified( NACT_WINDOW( window ), count )){
g_object_unref( window );
}
@@ -498,13 +525,15 @@ on_quit_activated( GtkMenuItem *item, NactWindow *window )
static void
add_action( NactWindow *window, NAAction *action )
{
+ gchar *uuid, *label;
+
na_object_check_edited_status( NA_OBJECT( action ));
v_add_action( window, action );
v_update_actions_list( window );
- gchar *uuid = na_action_get_uuid( action );
- gchar *label = na_action_get_label( action );
+ uuid = na_action_get_uuid( action );
+ label = na_action_get_label( action );
v_select_actions_list( window, NA_ACTION_TYPE, uuid, label );
g_free( label );
g_free( uuid );
@@ -515,6 +544,8 @@ add_action( NactWindow *window, NAAction *action )
static void
add_profile( NactWindow *window, NAAction *action, NAActionProfile *profile )
{
+ gchar *uuid, *label;
+
na_action_attach_profile( action, profile );
na_object_check_edited_status( NA_OBJECT( profile ));
@@ -522,8 +553,8 @@ add_profile( NactWindow *window, NAAction *action, NAActionProfile *profile )
v_update_actions_list( window );
- gchar *uuid = na_action_get_uuid( action );
- gchar *label = na_action_profile_get_label( profile );
+ uuid = na_action_get_uuid( action );
+ label = na_action_profile_get_label( profile );
v_select_actions_list( window, NA_ACTION_PROFILE_TYPE, uuid, label );
g_free( label );
g_free( uuid );
@@ -534,26 +565,32 @@ add_profile( NactWindow *window, NAAction *action, NAActionProfile *profile )
static void
on_edit_menu_selected( GtkMenuItem *item, NactWindow *window )
{
- GtkUIManager *ui_manager = GTK_UI_MANAGER( g_object_get_data( G_OBJECT( window ), "nact-imenubar-ui-manager" ));
-
- NAObject *object = v_get_selected( window );
+ GtkUIManager *ui_manager;
+ NAObject *object;
gboolean delete_enabled = FALSE;
+ gboolean duplicate_enabled;
+ GtkAction *delete_action, *duplicate_action;
+ NAAction *action;
+
+ ui_manager = GTK_UI_MANAGER( g_object_get_data( G_OBJECT( window ), "nact-imenubar-ui-manager" ));
+ object = v_get_selected( window );
+
if( object ){
if( NA_IS_ACTION( object )){
delete_enabled = TRUE;
} else {
g_assert( NA_IS_ACTION_PROFILE( object ));
- NAAction *action = na_action_profile_get_action( NA_ACTION_PROFILE( object ));
+ action = na_action_profile_get_action( NA_ACTION_PROFILE( object ));
delete_enabled = ( na_action_get_profiles_count( action ) > 1 );
}
}
- gboolean duplicate_enabled = delete_enabled;
+ duplicate_enabled = delete_enabled;
- GtkAction *delete_action = gtk_ui_manager_get_action( ui_manager, "/ui/MainMenubar/EditMenu/DeleteItem" );
+ delete_action = gtk_ui_manager_get_action( ui_manager, "/ui/MainMenubar/EditMenu/DeleteItem" );
gtk_action_set_sensitive( delete_action, delete_enabled );
- GtkAction *duplicate_action = gtk_ui_manager_get_action( ui_manager, "/ui/MainMenubar/EditMenu/DuplicateItem" );
+ duplicate_action = gtk_ui_manager_get_action( ui_manager, "/ui/MainMenubar/EditMenu/DuplicateItem" );
gtk_action_set_sensitive( duplicate_action, duplicate_enabled );
}
@@ -561,17 +598,20 @@ static void
on_duplicate_activated( GtkMenuItem *item, NactWindow *window )
{
static const gchar *thisfn = "nact_imenubar_on_duplicate_activated";
- g_debug( "%s: item=%p, window=%p", thisfn, item, window );
+ NAObject *object, *dup;
+ gchar *label, *dup_label;
+ NAAction *action;
- NAObject *object = v_get_selected( window );
+ g_debug( "%s: item=%p, window=%p", thisfn, ( void * ) item, ( void * ) window );
- NAObject *dup = na_object_duplicate( object );
+ object = v_get_selected( window );
+ dup = na_object_duplicate( object );
if( NA_IS_ACTION( object )){
- gchar *label = na_action_get_label( NA_ACTION( object ));
+ label = na_action_get_label( NA_ACTION( object ));
/* i18n: label of a duplicated action */
- gchar *dup_label = g_strdup_printf( _( "Copy of %s" ), label );
+ dup_label = g_strdup_printf( _( "Copy of %s" ), label );
na_action_set_label( NA_ACTION( dup ), dup_label );
na_action_set_new_uuid( NA_ACTION( dup ));
g_free( dup_label );
@@ -581,11 +621,11 @@ on_duplicate_activated( GtkMenuItem *item, NactWindow *window )
} else {
g_assert( NA_IS_ACTION_PROFILE( object ));
- NAAction *action = na_action_profile_get_action( NA_ACTION_PROFILE( object ));
+ action = na_action_profile_get_action( NA_ACTION_PROFILE( object ));
- gchar *label = na_action_profile_get_label( NA_ACTION_PROFILE( object ));
+ label = na_action_profile_get_label( NA_ACTION_PROFILE( object ));
/* i18n: label of a duplicated profile */
- gchar *dup_label = g_strdup_printf( _( "Copy of %s" ), label );
+ dup_label = g_strdup_printf( _( "Copy of %s" ), label );
na_action_profile_set_label( NA_ACTION_PROFILE( dup ), dup_label );
g_free( dup_label );
g_free( label );
@@ -598,11 +638,14 @@ static void
on_delete_activated( GtkMenuItem *item, NactWindow *window )
{
static const gchar *thisfn = "nact_imenubar_on_delete_activated";
- g_debug( "%s: item=%p, window=%p", thisfn, item, window );
-
- NAObject *object = v_get_selected( window );
+ NAObject *object;
gchar *uuid, *label;
GType type;
+ NAAction *action;
+
+ g_debug( "%s: item=%p, window=%p", thisfn, ( void * ) item, ( void * ) window );
+
+ object = v_get_selected( window );
if( NA_IS_ACTION( object )){
uuid = na_action_get_uuid( NA_ACTION( object ));
@@ -613,7 +656,7 @@ on_delete_activated( GtkMenuItem *item, NactWindow *window )
} else {
g_assert( NA_IS_ACTION_PROFILE( object ));
- NAAction *action = na_action_profile_get_action( NA_ACTION_PROFILE( object ));
+ action = na_action_profile_get_action( NA_ACTION_PROFILE( object ));
uuid = na_action_get_uuid( action );
label = na_action_profile_get_label( NA_ACTION_PROFILE( object ));
type = NA_ACTION_PROFILE_TYPE;
@@ -635,10 +678,10 @@ static void
on_reload_activated( GtkMenuItem *item, NactWindow *window )
{
static const gchar *thisfn = "nact_imenubar_on_reload_activated";
- g_debug( "%s: item=%p, window=%p", thisfn, item, window );
-
gboolean ok = TRUE;
+ g_debug( "%s: item=%p, window=%p", thisfn, ( void * ) item, ( void * ) window );
+
if( v_count_modified_actions( window )){
/* i18n: message before reloading the list of actions */
@@ -668,7 +711,9 @@ on_tools_menu_selected( GtkMenuItem *item, NactWindow *window )
GtkUIManager *ui_manager = GTK_UI_MANAGER( g_object_get_data( G_OBJECT( window ), "nact-imenubar-ui-manager" ));
gboolean export_enabled = v_count_actions( window );
+
GtkAction *export_action = gtk_ui_manager_get_action( ui_manager, "/ui/MainMenubar/ToolsMenu/ExportItem" );
+
gtk_action_set_sensitive( export_action, export_enabled );
}
@@ -686,7 +731,8 @@ static void
on_export_activated( GtkMenuItem *item, NactWindow *window )
{
static const gchar *thisfn = "nact_imenubar_on_export_activated";
- g_debug( "%s: item=%p, window=%p", thisfn, item, window );
+
+ g_debug( "%s: item=%p, window=%p", thisfn, ( void * ) item, ( void * ) window );
nact_assistant_export_run( NACT_WINDOW( window ));
}
@@ -712,9 +758,11 @@ static void
on_about_activated( GtkMenuItem *item, NactWindow *window )
{
static const gchar *thisfn = "nact_imenubar_on_about_activated";
- g_debug( "%s: item=%p, window=%p", thisfn, item, window );
+ GtkWindow *toplevel;
+
+ g_debug( "%s: item=%p, window=%p", thisfn, ( void * ) item, ( void * ) window );
- GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
+ toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
na_about_display( G_OBJECT( toplevel ));
}
@@ -737,7 +785,7 @@ static void
v_add_action( NactWindow *window, NAAction *action )
{
if( NACT_IMENUBAR_GET_INTERFACE( window )->add_action ){
- return( NACT_IMENUBAR_GET_INTERFACE( window )->add_action( window, action ));
+ NACT_IMENUBAR_GET_INTERFACE( window )->add_action( window, action );
}
}
@@ -745,7 +793,7 @@ static void
v_add_profile( NactWindow *window, NAActionProfile *profile )
{
if( NACT_IMENUBAR_GET_INTERFACE( window )->add_profile ){
- return( NACT_IMENUBAR_GET_INTERFACE( window )->add_profile( window, profile ));
+ NACT_IMENUBAR_GET_INTERFACE( window )->add_profile( window, profile );
}
}
@@ -753,7 +801,7 @@ static void
v_remove_action( NactWindow *window, NAAction *action )
{
if( NACT_IMENUBAR_GET_INTERFACE( window )->remove_action ){
- return( NACT_IMENUBAR_GET_INTERFACE( window )->remove_action( window, action ));
+ NACT_IMENUBAR_GET_INTERFACE( window )->remove_action( window, action );
}
}
@@ -779,7 +827,7 @@ static void
v_push_removed_action( NactWindow *window, NAAction *action )
{
if( NACT_IMENUBAR_GET_INTERFACE( window )->push_removed_action ){
- return( NACT_IMENUBAR_GET_INTERFACE( window )->push_removed_action( window, action ));
+ NACT_IMENUBAR_GET_INTERFACE( window )->push_removed_action( window, action );
}
}
@@ -807,7 +855,7 @@ static void
v_setup_dialog_title( NactWindow *window )
{
if( NACT_IMENUBAR_GET_INTERFACE( window )->setup_dialog_title ){
- return( NACT_IMENUBAR_GET_INTERFACE( window )->setup_dialog_title( window ));
+ NACT_IMENUBAR_GET_INTERFACE( window )->setup_dialog_title( window );
}
}
@@ -815,7 +863,7 @@ static void
v_update_actions_list( NactWindow *window )
{
if( NACT_IMENUBAR_GET_INTERFACE( window )->update_actions_list ){
- return( NACT_IMENUBAR_GET_INTERFACE( window )->update_actions_list( window ));
+ NACT_IMENUBAR_GET_INTERFACE( window )->update_actions_list( window );
}
}
@@ -823,7 +871,7 @@ static void
v_select_actions_list( NactWindow *window, GType type, const gchar *uuid, const gchar *label )
{
if( NACT_IMENUBAR_GET_INTERFACE( window )->select_actions_list ){
- return( NACT_IMENUBAR_GET_INTERFACE( window )->select_actions_list( window, type, uuid, label ));
+ NACT_IMENUBAR_GET_INTERFACE( window )->select_actions_list( window, type, uuid, label );
}
}
diff --git a/src/nact/nact-iprefs.c b/src/nact/nact-iprefs.c
index 923cf5e..a4043a0 100644
--- a/src/nact/nact-iprefs.c
+++ b/src/nact/nact-iprefs.c
@@ -84,7 +84,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_iprefs_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static const GTypeInfo info = {
sizeof( NactIPrefsInterface ),
@@ -98,7 +98,9 @@ register_type( void )
NULL
};
- GType type = g_type_register_static( G_TYPE_INTERFACE, "NactIPrefs", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_INTERFACE, "NactIPrefs", &info, 0 );
g_type_interface_add_prerequisite( type, G_TYPE_OBJECT );
@@ -112,7 +114,7 @@ interface_base_init( NactIPrefsInterface *klass )
static gboolean initialized = FALSE;
if( !initialized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
klass->private = g_new0( NactIPrefsInterfacePrivate, 1 );
@@ -131,7 +133,7 @@ interface_base_finalize( NactIPrefsInterface *klass )
static gboolean finalized = FALSE ;
if( !finalized ){
- g_debug( "%s: klass=%p", thisfn, klass );
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
g_free( klass->private );
@@ -149,9 +151,11 @@ interface_base_finalize( NactIPrefsInterface *klass )
void
nact_iprefs_position_window( NactWindow *window )
{
+ GtkWindow *toplevel;
gchar *key = v_get_iprefs_window_id( window );
+
if( key ){
- GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
+ toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
nact_iprefs_position_named_window( window, toplevel, key );
g_free( key );
}
@@ -168,11 +172,12 @@ void
nact_iprefs_position_named_window( NactWindow *window, GtkWindow *toplevel, const gchar *key )
{
static const gchar *thisfn = "nact_iprefs_position_named_window";
+ GSList *list;
+ gint x=0, y=0, width=0, height=0;
- GSList *list = read_key_listint( window, key );
+ list = read_key_listint( window, key );
if( list ){
- gint x=0, y=0, width=0, height=0;
listint_to_position( window, list, &x, &y, &width, &height );
g_debug( "%s: key=%s, x=%d, y=%d, width=%d, height=%d", thisfn, key, x, y, width, height );
free_listint( list );
@@ -192,9 +197,11 @@ nact_iprefs_position_named_window( NactWindow *window, GtkWindow *toplevel, cons
void
nact_iprefs_save_window_position( NactWindow *window )
{
+ GtkWindow *toplevel;
gchar *key = v_get_iprefs_window_id( window );
+
if( key ){
- GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
+ toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
nact_iprefs_save_named_window_position( window, toplevel, key );
g_free( key );
}
@@ -212,13 +219,14 @@ nact_iprefs_save_named_window_position( NactWindow *window, GtkWindow *toplevel,
{
static const gchar *thisfn = "nact_iprefs_save_named_window_position";
gint x, y, width, height;
+ GSList *list;
if( GTK_IS_WINDOW( toplevel )){
gtk_window_get_position( toplevel, &x, &y );
gtk_window_get_size( toplevel, &width, &height );
g_debug( "%s: key=%s, x=%d, y=%d, width=%d, height=%d", thisfn, key, x, y, width, height );
- GSList *list = position_to_listint( window, x, y, width, height );
+ list = position_to_listint( window, x, y, width, height );
write_key_listint( window, key, list );
free_listint( list );
}
@@ -322,9 +330,12 @@ read_key_listint( NactWindow *window, const gchar *key )
{
static const gchar *thisfn = "nact_iprefs_read_key_listint";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
+ gchar *path;
+ GSList *list;
+
+ path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
- GSList *list = gconf_client_get_list(
+ list = gconf_client_get_list(
NACT_IPREFS_GET_INTERFACE( window )->private->client, path, GCONF_VALUE_INT, &error );
if( error ){
@@ -342,7 +353,9 @@ write_key_listint( NactWindow *window, const gchar *key, GSList *list )
{
static const gchar *thisfn = "nact_iprefs_write_key_listint";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
+ gchar *path;
+
+ path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
gconf_client_set_list(
NACT_IPREFS_GET_INTERFACE( window )->private->client, path, GCONF_VALUE_INT, list, &error );
@@ -362,12 +375,13 @@ write_key_listint( NactWindow *window, const gchar *key, GSList *list )
static void
listint_to_position( NactWindow *window, GSList *list, gint *x, gint *y, gint *width, gint *height )
{
+ GSList *il;
+ int i;
+
g_assert( x );
g_assert( y );
g_assert( width );
g_assert( height );
- GSList *il;
- int i;
for( il=list, i=0 ; il ; il=il->next, i+=1 ){
switch( i ){
@@ -419,9 +433,12 @@ read_key_str( NactWindow *window, const gchar *key )
{
static const gchar *thisfn = "nact_iprefs_read_key_str";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
+ gchar *path;
+ gchar *text;
- gchar *text = gconf_client_get_string( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, &error );
+ path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
+
+ text = gconf_client_get_string( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, &error );
if( error ){
g_warning( "%s: key=%s, %s", thisfn, key, error->message );
@@ -438,7 +455,9 @@ save_key_str( NactWindow *window, const gchar *key, const gchar *text )
{
static const gchar *thisfn = "nact_iprefs_save_key_str";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
+ gchar *path;
+
+ path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
gconf_client_set_string( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, text, &error );
@@ -455,9 +474,12 @@ read_key_int( NactWindow *window, const gchar *name )
{
static const gchar *thisfn = "nact_iprefs_read_key_int";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
+ gchar *path;
+ gint value;
- gint value = gconf_client_get_int( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, &error );
+ path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
+
+ value = gconf_client_get_int( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, &error );
if( error ){
g_warning( "%s: name=%s, %s", thisfn, name, error->message );
@@ -473,7 +495,9 @@ write_key_int( NactWindow *window, const gchar *name, gint value )
{
static const gchar *thisfn = "nact_iprefs_write_key_int";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
+ gchar *path;
+
+ path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, name );
gconf_client_set_int( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, value, &error );
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index f6b3dd9..d937f05 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -54,6 +54,7 @@
/* private class data
*/
struct NactMainWindowClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -142,7 +143,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_main_window_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static GTypeInfo info = {
sizeof( NactMainWindowClass ),
@@ -155,69 +156,65 @@ register_type( void )
0,
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( NACT_WINDOW_TYPE, "NactMainWindow", &info, 0 );
- /* implement IActionsList interface
- */
static const GInterfaceInfo iactions_list_iface_info = {
( GInterfaceInitFunc ) iactions_list_iface_init,
NULL,
NULL
};
- g_type_add_interface_static( type, NACT_IACTIONS_LIST_TYPE, &iactions_list_iface_info );
- /* implement IActionTab interface
- */
static const GInterfaceInfo iaction_tab_iface_info = {
( GInterfaceInitFunc ) iaction_tab_iface_init,
NULL,
NULL
};
- g_type_add_interface_static( type, NACT_IACTION_TAB_TYPE, &iaction_tab_iface_info );
- /* implement ICommandTab interface
- */
static const GInterfaceInfo icommand_tab_iface_info = {
( GInterfaceInitFunc ) icommand_tab_iface_init,
NULL,
NULL
};
- g_type_add_interface_static( type, NACT_ICOMMAND_TAB_TYPE, &icommand_tab_iface_info );
- /* implement IConditionsTab interface
- */
static const GInterfaceInfo iconditions_tab_iface_info = {
( GInterfaceInitFunc ) iconditions_tab_iface_init,
NULL,
NULL
};
- g_type_add_interface_static( type, NACT_ICONDITIONS_TAB_TYPE, &iconditions_tab_iface_info );
- /* implement IAdvancedTab interface
- */
static const GInterfaceInfo iadvanced_tab_iface_info = {
( GInterfaceInitFunc ) iadvanced_tab_iface_init,
NULL,
NULL
};
- g_type_add_interface_static( type, NACT_IADVANCED_TAB_TYPE, &iadvanced_tab_iface_info );
- /* implement IMenubar interface
- */
static const GInterfaceInfo imenubar_iface_info = {
( GInterfaceInitFunc ) imenubar_iface_init,
NULL,
NULL
};
- g_type_add_interface_static( type, NACT_IMENUBAR_TYPE, &imenubar_iface_info );
- /* implement IPivotConsumer interface
- */
static const GInterfaceInfo pivot_consumer_iface_info = {
( GInterfaceInitFunc ) ipivot_consumer_iface_init,
NULL,
NULL
};
+
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( NACT_WINDOW_TYPE, "NactMainWindow", &info, 0 );
+
+ g_type_add_interface_static( type, NACT_IACTIONS_LIST_TYPE, &iactions_list_iface_info );
+
+ g_type_add_interface_static( type, NACT_IACTION_TAB_TYPE, &iaction_tab_iface_info );
+
+ g_type_add_interface_static( type, NACT_ICOMMAND_TAB_TYPE, &icommand_tab_iface_info );
+
+ g_type_add_interface_static( type, NACT_ICONDITIONS_TAB_TYPE, &iconditions_tab_iface_info );
+
+ g_type_add_interface_static( type, NACT_IADVANCED_TAB_TYPE, &iadvanced_tab_iface_info );
+
+ g_type_add_interface_static( type, NACT_IMENUBAR_TYPE, &imenubar_iface_info );
+
g_type_add_interface_static( type, NA_IPIVOT_CONSUMER_TYPE, &pivot_consumer_iface_info );
return( type );
@@ -227,23 +224,27 @@ static void
class_init( NactMainWindowClass *klass )
{
static const gchar *thisfn = "nact_main_window_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ BaseWindowClass *base_class;
+ NactWindowClass *nact_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
klass->private = g_new0( NactMainWindowClassPrivate, 1 );
- BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
+ base_class = BASE_WINDOW_CLASS( klass );
base_class->get_toplevel_name = get_toplevel_name;
base_class->initial_load_toplevel = on_initial_load_toplevel;
base_class->runtime_init_toplevel = on_runtime_init_toplevel;
base_class->delete_event = on_delete_event;
- NactWindowClass *nact_class = NACT_WINDOW_CLASS( klass );
+ nact_class = NACT_WINDOW_CLASS( klass );
nact_class->get_iprefs_window_id = get_iprefs_window_id;
}
@@ -251,7 +252,8 @@ static void
iactions_list_iface_init( NactIActionsListInterface *iface )
{
static const gchar *thisfn = "nact_main_window_iactions_list_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->get_actions = get_actions;
iface->on_selection_changed = on_actions_list_selection_changed;
@@ -268,7 +270,8 @@ static void
iaction_tab_iface_init( NactIActionTabInterface *iface )
{
static const gchar *thisfn = "nact_main_window_iaction_tab_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->get_selected = nact_iactions_list_get_selected_object;
iface->get_edited_action = get_edited_action;
@@ -279,7 +282,8 @@ static void
icommand_tab_iface_init( NactICommandTabInterface *iface )
{
static const gchar *thisfn = "nact_main_window_icommand_tab_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->get_edited_profile = get_edited_profile;
iface->field_modified = on_modified_field;
@@ -292,7 +296,8 @@ static void
iconditions_tab_iface_init( NactIConditionsTabInterface *iface )
{
static const gchar *thisfn = "nact_main_window_iconditions_tab_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->get_edited_profile = get_edited_profile;
iface->field_modified = on_modified_field;
@@ -302,7 +307,8 @@ static void
iadvanced_tab_iface_init( NactIAdvancedTabInterface *iface )
{
static const gchar *thisfn = "nact_main_window_iadvanced_tab_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->get_edited_profile = get_edited_profile;
iface->field_modified = on_modified_field;
@@ -312,7 +318,8 @@ static void
imenubar_iface_init( NactIMenubarInterface *iface )
{
static const gchar *thisfn = "nact_main_window_imenubar_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->add_action = add_action;
iface->add_profile = add_profile;
@@ -334,7 +341,8 @@ static void
ipivot_consumer_iface_init( NAIPivotConsumerInterface *iface )
{
static const gchar *thisfn = "nact_main_window_ipivot_consumer_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->on_actions_changed = on_actions_changed;
}
@@ -343,10 +351,12 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "nact_main_window_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NactMainWindow *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NACT_IS_MAIN_WINDOW( instance ));
- NactMainWindow *self = NACT_MAIN_WINDOW( instance );
+ self = NACT_MAIN_WINDOW( instance );
self->private = g_new0( NactMainWindowPrivate, 1 );
@@ -357,17 +367,20 @@ static void
instance_dispose( GObject *window )
{
static const gchar *thisfn = "nact_main_window_instance_dispose";
- g_debug( "%s: window=%p", thisfn, window );
+ NactMainWindow *self;
+ GtkWidget *pane;
+ gint pos;
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_MAIN_WINDOW( window ));
- NactMainWindow *self = NACT_MAIN_WINDOW( window );
+ self = NACT_MAIN_WINDOW( window );
if( !self->private->dispose_has_run ){
self->private->dispose_has_run = TRUE;
- GtkWidget *pane = base_window_get_widget( BASE_WINDOW( window ), "MainPaned" );
- gint pos = gtk_paned_get_position( GTK_PANED( pane ));
+ pane = base_window_get_widget( BASE_WINDOW( window ), "MainPaned" );
+ pos = gtk_paned_get_position( GTK_PANED( pane ));
nact_iprefs_set_int( NACT_WINDOW( window ), "main-paned", pos );
self->private->actions = free_actions( self->private->actions );
@@ -387,10 +400,12 @@ static void
instance_finalize( GObject *window )
{
static const gchar *thisfn = "nact_main_window_instance_finalize";
- g_debug( "%s: window=%p", thisfn, window );
+ NactMainWindow *self;
+
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_MAIN_WINDOW( window ));
- NactMainWindow *self = ( NactMainWindow * ) window;
+ self = ( NactMainWindow * ) window;
g_free( self->private );
@@ -427,6 +442,7 @@ gboolean
nact_main_window_action_exists( const NactMainWindow *window, const gchar *uuid )
{
GSList *ia;
+
for( ia = window->private->actions ; ia ; ia = ia->next ){
NAAction *action = NA_ACTION( ia->data );
gchar *action_uuid = na_action_get_uuid( action );
@@ -436,6 +452,7 @@ nact_main_window_action_exists( const NactMainWindow *window, const gchar *uuid
return( TRUE );
}
}
+
return( FALSE );
}
@@ -445,9 +462,11 @@ nact_main_window_action_exists( const NactMainWindow *window, const gchar *uuid
GtkStatusbar *
nact_main_window_get_statusbar( const NactMainWindow *window )
{
+ GtkWidget *statusbar;
+
g_assert( NACT_IS_MAIN_WINDOW( window ));
- GtkWidget *statusbar = base_window_get_widget( BASE_WINDOW( window ), "StatusBar" );
+ statusbar = base_window_get_widget( BASE_WINDOW( window ), "StatusBar" );
return( GTK_STATUSBAR( statusbar ));
}
@@ -481,15 +500,18 @@ static void
on_initial_load_toplevel( BaseWindow *window )
{
static const gchar *thisfn = "nact_main_window_on_initial_load_toplevel";
+ NactMainWindow *wnd;
+ gint pos;
+ GtkWidget *pane;
/* call parent class at the very beginning */
if( BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel ){
BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel( window );
}
- g_debug( "%s: window=%p", thisfn, window );
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_MAIN_WINDOW( window ));
- NactMainWindow *wnd = NACT_MAIN_WINDOW( window );
+ wnd = NACT_MAIN_WINDOW( window );
nact_imenubar_init( wnd );
@@ -511,9 +533,9 @@ on_initial_load_toplevel( BaseWindow *window )
g_assert( NACT_IS_IADVANCED_TAB( window ));
nact_iadvanced_tab_initial_load( NACT_WINDOW( window ));
- gint pos = nact_iprefs_get_int( NACT_WINDOW( window ), "main-paned" );
+ pos = nact_iprefs_get_int( NACT_WINDOW( window ), "main-paned" );
if( pos ){
- GtkWidget *pane = base_window_get_widget( window, "MainPaned" );
+ pane = base_window_get_widget( window, "MainPaned" );
gtk_paned_set_position( GTK_PANED( pane ), pos );
}
}
@@ -522,6 +544,10 @@ static void
on_runtime_init_toplevel( BaseWindow *window )
{
static const gchar *thisfn = "nact_main_window_on_runtime_init_toplevel";
+ NactMainWindow *wnd;
+ NactApplication *application;
+ NAPivot *pivot;
+ GSList *ia;
/* call parent class at the very beginning */
if( BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel ){
@@ -529,10 +555,11 @@ on_runtime_init_toplevel( BaseWindow *window )
}
g_assert( NACT_IS_MAIN_WINDOW( window ));
- NactMainWindow *wnd = NACT_MAIN_WINDOW( window );
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
+ wnd = NACT_MAIN_WINDOW( window );
- NactApplication *application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( wnd )));
- NAPivot *pivot = nact_application_get_pivot( application );
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( wnd )));
+ pivot = nact_application_get_pivot( application );
na_pivot_set_automatic_reload( pivot, FALSE );
wnd->private->actions = na_pivot_get_duplicate_actions( pivot );
wnd->private->initial_count = g_slist_length( wnd->private->actions );
@@ -540,15 +567,10 @@ on_runtime_init_toplevel( BaseWindow *window )
/* initialize the current edition status as a loaded action may be
* invalid (without having been modified)
*/
- GSList *ia;
for( ia = wnd->private->actions ; ia ; ia = ia->next ){
na_object_check_edited_status( NA_OBJECT( ia->data ));
}
- g_debug( "%s: window=%p", thisfn, window );
- g_assert( NACT_IS_MAIN_WINDOW( window ));
- /*NactMainWindow *wnd = NACT_MAIN_WINDOW( window );*/
-
g_assert( NACT_IS_IACTIONS_LIST( window ));
nact_iactions_list_runtime_init( NACT_WINDOW( window ));
@@ -574,6 +596,7 @@ on_runtime_init_toplevel( BaseWindow *window )
static void
setup_dialog_title( NactWindow *window )
{
+ GtkWindow *toplevel;
BaseApplication *appli = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
gchar *title = base_application_get_application_name( appli );
@@ -591,7 +614,7 @@ setup_dialog_title( NactWindow *window )
title = tmp;
}
- GtkWindow *toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
+ toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( window ));
gtk_window_set_title( toplevel, title );
g_free( title );
@@ -604,13 +627,16 @@ 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 );
+ NactMainWindow *window;
+ NAObject *object;
+
+ g_debug( "%s: selection=%p, user_data=%p", thisfn, ( void * ) selection, ( void * ) user_data );
g_assert( NACT_IS_MAIN_WINDOW( user_data ));
- NactMainWindow *window = NACT_MAIN_WINDOW( user_data );
+ window = NACT_MAIN_WINDOW( user_data );
- NAObject *object = nact_iactions_list_get_selected_object( NACT_WINDOW( window ));
- g_debug( "%s: object=%p", thisfn, object );
+ object = nact_iactions_list_get_selected_object( NACT_WINDOW( window ));
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
if( object ){
if( NA_IS_ACTION( object )){
@@ -656,7 +682,7 @@ on_actions_list_enter_key_pressed( GtkWidget *widget, GdkEventKey *event, gpoint
static void
set_current_action( NactMainWindow *window )
{
- g_debug( "set_current_action: current=%p", window->private->edited_action );
+ g_debug( "set_current_action: current=%p", ( void * ) window->private->edited_action );
nact_iaction_tab_set_action( NACT_WINDOW( window ), window->private->edited_action );
@@ -808,162 +834,6 @@ push_removed_action( NactWindow *window, NAAction *action )
wnd->private->deleted = g_slist_append( wnd->private->deleted, ( gpointer ) action );
}
-/*
- * creating a new action
- * pwi 2009-05-19
- * I don't want the profiles feature spread wide while I'm not convinced
- * that it is useful and actually used.
- * so the new action is silently created with a default profile name
- */
-/*static void
-on_new_button_clicked( GtkButton *button, gpointer user_data )
-{
- static const gchar *thisfn = "nact_main_window_on_new_button_clicked";
- g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
-
- g_assert( NACT_IS_MAIN_WINDOW( user_data ));
- NactWindow *wndmain = NACT_WINDOW( user_data );
-
- nact_action_conditions_editor_run_editor( wndmain, NULL );
-
- nact_iactions_list_set_focus( wndmain );
-}*/
-
-/*
- * editing an existing action
- * pwi 2009-05-19
- * I don't want the profiles feature spread wide while I'm not convinced
- * that it is useful and actually used.
- * so :
- * - if there is only one profile, the user will be directed to a dialog
- * box which includes all needed fields, but without any profile notion
- * - if there are more than one profile, one can assume that the user has
- * found a use to the profiles, and let him edit them
- */
-/*static void
-on_edit_button_clicked( GtkButton *button, gpointer user_data )
-{
- static const gchar *thisfn = "nact_main_window_on_edit_button_clicked";
- g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
-
- g_assert( NACT_IS_MAIN_WINDOW( user_data ));
- NactWindow *wndmain = NACT_WINDOW( user_data );
-
- NAAction *action = NA_ACTION( nact_iactions_list_get_selected_action( wndmain ));
- g_assert( action );
- g_assert( NA_IS_ACTION( action ));
-
- if( na_action_get_profiles_count( action ) > 1 ){
- nact_action_profiles_editor_run_editor( wndmain, action );
- } else {
- nact_action_conditions_editor_run_editor( wndmain, action );
- }
-
- nact_iactions_list_set_focus( wndmain );
-}*/
-
-/*static void
-on_duplicate_button_clicked( GtkButton *button, gpointer user_data )
-{
- static const gchar *thisfn = "nact_main_window_on_duplicate_button_clicked";
- g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
-
- g_assert( NACT_IS_MAIN_WINDOW( user_data ));
- NactWindow *wndmain = NACT_WINDOW( user_data );
-
- NAAction *action = NA_ACTION( nact_iactions_list_get_selected_action( wndmain ));
- if( action ){
-
- NAAction *duplicate = na_action_duplicate( action );
- na_action_set_new_uuid( duplicate );
- gchar *label = na_action_get_label( action );
- gchar *label2 = g_strdup_printf( _( "Copy of %s"), label );
- na_action_set_label( duplicate, label2 );
- g_free( label2 );
-
- gchar *msg = NULL;
- NAPivot *pivot = NA_PIVOT( nact_window_get_pivot( wndmain ));
- if( na_pivot_write_action( pivot, G_OBJECT( duplicate ), &msg ) != NA_IIO_PROVIDER_WRITE_OK ){
-
- gchar *first = g_strdup_printf( _( "Unable to duplicate \"%s\" action." ), label );
- base_window_error_dlg( BASE_WINDOW( wndmain ), GTK_MESSAGE_ERROR, first, msg );
- g_free( first );
- g_free( msg );
-
- } else {
- do_set_current_action( NACT_WINDOW( wndmain ), duplicate );
- }
-
- g_object_unref( duplicate );
- g_free( label );
-
- } else {
- g_assert_not_reached();
- }
-
- nact_iactions_list_set_focus( wndmain );
-}*/
-
-/*static void
-on_delete_button_clicked( GtkButton *button, gpointer user_data )
-{
- static const gchar *thisfn = "nact_main_window_on_delete_button_clicked";
- g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
-
- g_assert( NACT_IS_MAIN_WINDOW( user_data ));
- NactWindow *wndmain = NACT_WINDOW( user_data );
-
- NAAction *action = NA_ACTION( nact_iactions_list_get_selected_action( wndmain ));
- if( action ){
-
- gchar *label = na_action_get_label( action );
- gchar *sure = g_strdup_printf( _( "Are you sure you want to delete \"%s\" action ?" ), label );
- if( base_window_yesno_dlg( BASE_WINDOW( wndmain ), GTK_MESSAGE_WARNING, sure, NULL )){
-
- gchar *msg = NULL;
- NAPivot *pivot = NA_PIVOT( nact_window_get_pivot( wndmain ));
- if( na_pivot_delete_action( pivot, G_OBJECT( action ), &msg ) != NA_IIO_PROVIDER_WRITE_OK ){
-
- gchar *first = g_strdup_printf( _( "Unable to delete \"%s\" action." ), label );
- base_window_error_dlg( BASE_WINDOW( wndmain ), GTK_MESSAGE_ERROR, first, msg );
- g_free( first );
- g_free( msg );
- }
- }
- g_free( sure );
- g_free( label );
-
- } else {
- g_assert_not_reached();
- }
-
- nact_iactions_list_set_focus( wndmain );
-}*/
-
-/*static gboolean
-on_dialog_response( GtkDialog *dialog, gint response_id, BaseWindow *window )
-{
- static const gchar *thisfn = "nact_main_window_on_dialog_response";
- g_debug( "%s: dialog=%p, response_id=%d, window=%p", thisfn, dialog, response_id, window );
- g_assert( NACT_IS_MAIN_WINDOW( window ));
-*/
- /*GtkWidget *paste_button = nact_get_glade_widget_from ("PasteProfileButton", GLADE_EDIT_DIALOG_WIDGET);*/
-
- /*switch( response_id ){
- case GTK_RESPONSE_NONE:
- case GTK_RESPONSE_DELETE_EVENT:
- case GTK_RESPONSE_CLOSE:*/
- /* Free any profile in the clipboard */
- /*nautilus_actions_config_action_profile_free (g_object_steal_data (G_OBJECT (paste_button), "profile"));*/
-
- /*g_object_unref( window );
- return( TRUE );
- break;
- }
-
- return( FALSE );
-}*/
-
static void
update_actions_list( NactWindow *window )
{
@@ -974,9 +844,11 @@ static gboolean
on_delete_event( BaseWindow *window, GtkWindow *toplevel, GdkEvent *event )
{
static const gchar *thisfn = "nact_main_window_on_delete_event";
- g_debug( "%s: window=%p, toplevel=%p, event=%p", thisfn, window, toplevel, event );
+ g_debug( "%s: window=%p, toplevel=%p, event=%p",
+ thisfn, ( void * ) window, ( void * ) toplevel, ( void * ) event );
g_assert( NACT_IS_MAIN_WINDOW( window ));
+
nact_imenubar_on_delete_event( NACT_WINDOW( window ));
return( TRUE );
@@ -999,14 +871,14 @@ count_actions( NactWindow *window )
static gint
count_modified_actions( NactWindow *window )
{
+ GSList *ia;
+ gint count = 0;
+
if( g_slist_length( NACT_MAIN_WINDOW( window )->private->actions ) == 0 &&
NACT_MAIN_WINDOW( window )->private->initial_count == 0 ){
return( 0 );
}
- GSList *ia;
- gint count = 0;
-
for( ia = NACT_MAIN_WINDOW( window )->private->deleted ; ia ; ia = ia->next ){
if( na_object_get_origin( NA_OBJECT( ia->data )) != NULL ){
count += 1;
@@ -1026,11 +898,14 @@ static void
reload_actions( NactWindow *window )
{
NactMainWindow *self = NACT_MAIN_WINDOW( window );
+ NactApplication *application;
+ NAPivot *pivot;
+
self->private->actions = free_actions( self->private->actions );
self->private->deleted = free_actions( self->private->deleted );
- NactApplication *application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
- NAPivot *pivot = nact_application_get_pivot( application );
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( window )));
+ pivot = nact_application_get_pivot( application );
na_pivot_reload_actions( pivot );
self->private->actions = na_pivot_get_duplicate_actions( pivot );
self->private->initial_count = g_slist_length( self->private->actions );
@@ -1040,8 +915,6 @@ reload_actions( NactWindow *window )
if( self->private->initial_count ){
nact_iactions_list_select_first( window );
}
- /*self->private->edited_action = NULL;
- set_current_action( NACT_MAIN_WINDOW( window ));*/
}
static GSList *
@@ -1068,15 +941,20 @@ static void
on_actions_changed( NAIPivotConsumer *instance, gpointer user_data )
{
static const gchar *thisfn = "nact_main_window_on_actions_changed";
- g_debug( "%s: instance=%p, user_data=%p", thisfn, instance, user_data );
+ NactMainWindow *self;
+ NactApplication *application;
+ NAPivot *pivot;
+ gchar *first, *second;
+ gboolean ok;
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
g_assert( NACT_IS_MAIN_WINDOW( instance ));
- NactMainWindow *self = NACT_MAIN_WINDOW( instance );
+ self = NACT_MAIN_WINDOW( instance );
- NactApplication *application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( instance )));
- NAPivot *pivot = nact_application_get_pivot( application );
+ application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( instance )));
+ pivot = nact_application_get_pivot( application );
- gchar *first = g_strdup(_( "One or more actions have been modified in the filesystem.\n"
+ first = g_strdup(_( "One or more actions have been modified in the filesystem.\n"
"You could keep to work with your current list of actions, "
"or you may want to reload a fresh one." ));
@@ -1088,9 +966,9 @@ on_actions_changed( NAIPivotConsumer *instance, gpointer user_data )
first = tmp;
}
- gchar *second = g_strdup( _( "Do you want to reload a fresh list of actions ?" ));
+ second = g_strdup( _( "Do you want to reload a fresh list of actions ?" ));
- gboolean ok = base_window_yesno_dlg( BASE_WINDOW( instance ), GTK_MESSAGE_QUESTION, first, second );
+ ok = base_window_yesno_dlg( BASE_WINDOW( instance ), GTK_MESSAGE_QUESTION, first, second );
g_free( second );
g_free( first );
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index 82f567b..5b04776 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -43,6 +43,7 @@
/* private class data
*/
struct NactPreferencesEditorClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -92,7 +93,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_preferences_editor_register_type";
- g_debug( "%s", thisfn );
+ GType type;
static GTypeInfo info = {
sizeof( NactPreferencesEditorClass ),
@@ -106,16 +107,16 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( NACT_WINDOW_TYPE, "NactPreferencesEditor", &info, 0 );
-
- /* implement IPrefs interface
- */
static const GInterfaceInfo prefs_iface_info = {
( GInterfaceInitFunc ) iprefs_iface_init,
NULL,
NULL
};
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( NACT_WINDOW_TYPE, "NactPreferencesEditor", &info, 0 );
+
g_type_add_interface_static( type, NA_IPREFS_TYPE, &prefs_iface_info );
return( type );
@@ -125,24 +126,28 @@ static void
class_init( NactPreferencesEditorClass *klass )
{
static const gchar *thisfn = "nact_preferences_editor_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ BaseWindowClass *base_class;
+ NactWindowClass *nact_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
klass->private = g_new0( NactPreferencesEditorClassPrivate, 1 );
- BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
+ base_class = BASE_WINDOW_CLASS( klass );
base_class->initial_load_toplevel = on_initial_load_dialog;
base_class->runtime_init_toplevel = on_runtime_init_dialog;
base_class->all_widgets_showed = on_all_widgets_showed;
base_class->dialog_response = on_dialog_response;
base_class->get_toplevel_name = do_get_dialog_name;
- NactWindowClass *nact_class = NACT_WINDOW_CLASS( klass );
+ nact_class = NACT_WINDOW_CLASS( klass );
nact_class->get_iprefs_window_id = do_get_iprefs_window_id;
}
@@ -150,17 +155,20 @@ static void
iprefs_iface_init( NAIPrefsInterface *iface )
{
static const gchar *thisfn = "nact_preferences_editor_iprefs_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
}
static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "nact_preferences_editor_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NactPreferencesEditor *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NACT_IS_PREFERENCES_EDITOR( instance ));
- NactPreferencesEditor *self = NACT_PREFERENCES_EDITOR( instance );
+ self = NACT_PREFERENCES_EDITOR( instance );
self->private = g_new0( NactPreferencesEditorPrivate, 1 );
@@ -171,10 +179,12 @@ static void
instance_dispose( GObject *dialog )
{
static const gchar *thisfn = "nact_preferences_editor_instance_dispose";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ NactPreferencesEditor *self;
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
g_assert( NACT_IS_PREFERENCES_EDITOR( dialog ));
- NactPreferencesEditor *self = NACT_PREFERENCES_EDITOR( dialog );
+ self = NACT_PREFERENCES_EDITOR( dialog );
if( !self->private->dispose_has_run ){
@@ -189,10 +199,12 @@ static void
instance_finalize( GObject *dialog )
{
static const gchar *thisfn = "nact_preferences_editor_instance_finalize";
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ NactPreferencesEditor *self;
+
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
g_assert( NACT_IS_PREFERENCES_EDITOR( dialog ));
- NactPreferencesEditor *self = ( NactPreferencesEditor * ) dialog;
+ self = ( NactPreferencesEditor * ) dialog;
g_free( self->private );
@@ -224,14 +236,16 @@ void
nact_preferences_editor_run( NactWindow *parent )
{
static const gchar *thisfn = "nact_preferences_editor_run";
- g_debug( "%s: parent=%p", thisfn, parent );
+ BaseApplication *application;
+ NactPreferencesEditor *editor;
+ g_debug( "%s: parent=%p", thisfn, ( void * ) parent );
g_assert( NACT_IS_WINDOW( parent ));
- BaseApplication *application = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( parent )));
+ application = BASE_APPLICATION( base_window_get_application( BASE_WINDOW( parent )));
g_assert( NACT_IS_APPLICATION( application ));
- NactPreferencesEditor *editor = preferences_editor_new( application );
+ editor = preferences_editor_new( application );
editor->private->parent = parent;
base_window_run( BASE_WINDOW( editor ));
@@ -253,18 +267,21 @@ static void
on_initial_load_dialog( BaseWindow *dialog )
{
static const gchar *thisfn = "nact_preferences_editor_on_initial_load_dialog";
+ NactPreferencesEditor *editor;
+ GtkWindow *toplevel;
+ GtkWindow *parent_toplevel;
/* call parent class at the very beginning */
if( BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel ){
BASE_WINDOW_CLASS( st_parent_class )->initial_load_toplevel( dialog );
}
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
g_assert( NACT_IS_PREFERENCES_EDITOR( dialog ));
- NactPreferencesEditor *editor = NACT_PREFERENCES_EDITOR( dialog );
+ editor = NACT_PREFERENCES_EDITOR( dialog );
- GtkWindow *toplevel = base_window_get_toplevel_dialog( dialog );
- GtkWindow *parent_toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( editor->private->parent ));
+ toplevel = base_window_get_toplevel_dialog( dialog );
+ parent_toplevel = base_window_get_toplevel_dialog( BASE_WINDOW( editor->private->parent ));
gtk_window_set_transient_for( toplevel, parent_toplevel );
}
@@ -272,18 +289,21 @@ static void
on_runtime_init_dialog( BaseWindow *dialog )
{
static const gchar *thisfn = "nact_preferences_editor_on_runtime_init_dialog";
+ NactPreferencesEditor *editor;
+ gboolean as_submenu;
+ GtkWidget *button;
/* call parent class at the very beginning */
if( BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel ){
BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel( dialog );
}
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
g_assert( NACT_IS_PREFERENCES_EDITOR( dialog ));
- NactPreferencesEditor *editor = NACT_PREFERENCES_EDITOR( dialog );
+ editor = NACT_PREFERENCES_EDITOR( dialog );
- gboolean as_submenu = na_iprefs_get_bool( NA_IPREFS( editor ), PREFS_DISPLAY_AS_SUBMENU );
- GtkWidget *button = base_window_get_widget( dialog, "AsSubmenuButton" );
+ as_submenu = na_iprefs_get_bool( NA_IPREFS( editor ), PREFS_DISPLAY_AS_SUBMENU );
+ button = base_window_get_widget( dialog, "AsSubmenuButton" );
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( button ), as_submenu );
nact_window_signal_connect_by_name( NACT_WINDOW( editor ), "AsSubmenuButton", "toggled", G_CALLBACK( on_submenu_toggled ));
@@ -304,7 +324,7 @@ on_all_widgets_showed( BaseWindow *dialog )
BASE_WINDOW_CLASS( st_parent_class )->all_widgets_showed( dialog );
}
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
g_assert( NACT_IS_PREFERENCES_EDITOR( dialog ));
}
@@ -383,10 +403,11 @@ static gboolean
on_dialog_response( GtkDialog *dialog, gint code, BaseWindow *window )
{
static const gchar *thisfn = "nact_preferences_editor_on_dialog_response";
- g_debug( "%s: dialog=%p, code=%d, window=%p", thisfn, dialog, code, window );
+ NactPreferencesEditor *editor;
+ g_debug( "%s: dialog=%p, code=%d, window=%p", thisfn, ( void * ) dialog, code, ( void * ) window );
g_assert( NACT_IS_PREFERENCES_EDITOR( window ));
- NactPreferencesEditor *editor = NACT_PREFERENCES_EDITOR( window );
+ editor = NACT_PREFERENCES_EDITOR( window );
/*gboolean is_modified = is_edited_modified( editor );*/
diff --git a/src/nact/nact-window.c b/src/nact/nact-window.c
index 08d4ffa..392c59a 100644
--- a/src/nact/nact-window.c
+++ b/src/nact/nact-window.c
@@ -44,6 +44,7 @@
/* private class data
*/
struct NactWindowClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -92,9 +93,7 @@ static GType
register_type( void )
{
static const gchar *thisfn = "nact_window_register_type";
- g_debug( "%s", thisfn );
-
- g_type_init();
+ GType type;
static GTypeInfo info = {
sizeof( NactWindowClass ),
@@ -108,16 +107,18 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( BASE_WINDOW_TYPE, "NactWindow", &info, 0 );
-
- /* implement IPrefs interface
- */
static const GInterfaceInfo prefs_iface_info = {
( GInterfaceInitFunc ) iprefs_iface_init,
NULL,
NULL
};
+ g_debug( "%s", thisfn );
+
+ g_type_init();
+
+ type = g_type_register_static( BASE_WINDOW_TYPE, "NactWindow", &info, 0 );
+
g_type_add_interface_static( type, NACT_IPREFS_TYPE, &prefs_iface_info );
return( type );
@@ -127,17 +128,20 @@ static void
class_init( NactWindowClass *klass )
{
static const gchar *thisfn = "nact_window_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+ BaseWindowClass *base_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
klass->private = g_new0( NactWindowClassPrivate, 1 );
- BaseWindowClass *base_class = BASE_WINDOW_CLASS( klass );
+ base_class = BASE_WINDOW_CLASS( klass );
base_class->runtime_init_toplevel = on_runtime_init_toplevel;
base_class->all_widgets_showed = on_all_widgets_showed;
@@ -148,7 +152,8 @@ static void
iprefs_iface_init( NactIPrefsInterface *iface )
{
static const gchar *thisfn = "nact_window_iprefs_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->get_iprefs_window_id = v_get_iprefs_window_id;
}
@@ -157,10 +162,12 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "nact_window_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NactWindow *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NACT_IS_WINDOW( instance ));
- NactWindow *self = NACT_WINDOW( instance );
+ self = NACT_WINDOW( instance );
self->private = g_new0( NactWindowPrivate, 1 );
@@ -172,10 +179,13 @@ static void
instance_dispose( GObject *window )
{
static const gchar *thisfn = "nact_window_instance_dispose";
- g_debug( "%s: window=%p", thisfn, window );
+ NactWindow *self;
+ GSList *is;
+
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_WINDOW( window ));
- NactWindow *self = NACT_WINDOW( window );
+ self = NACT_WINDOW( window );
if( !self->private->dispose_has_run ){
@@ -183,7 +193,6 @@ instance_dispose( GObject *window )
nact_iprefs_save_window_position( NACT_WINDOW( window ));
- GSList *is;
for( is = self->private->signals ; is ; is = is->next ){
NactWindowRecordedSignal *str = ( NactWindowRecordedSignal * ) is->data;
g_signal_handler_disconnect( str->instance, str->handler_id );
@@ -203,10 +212,12 @@ static void
instance_finalize( GObject *window )
{
static const gchar *thisfn = "nact_window_instance_finalize";
- g_debug( "%s: window=%p", thisfn, window );
+ NactWindow *self;
+
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_WINDOW( window ));
- NactWindow *self = ( NactWindow * ) window;
+ self = ( NactWindow * ) window;
g_free( self->private );
@@ -223,30 +234,18 @@ NAPivot *
nact_window_get_pivot( NactWindow *window )
{
NactApplication *application;
+ NAPivot *pivot;
+
g_object_get( G_OBJECT( window ), PROP_WINDOW_APPLICATION_STR, &application, NULL );
g_return_val_if_fail( NACT_IS_APPLICATION( application ), NULL );
- NAPivot *pivot = nact_application_get_pivot( application );
+ pivot = nact_application_get_pivot( application );
g_return_val_if_fail( NA_IS_PIVOT( pivot ), NULL );
return( pivot );
}
/**
- * Set the current action.
- *
- * This is called by one of the editors to advertize the main window
- * that the newly selected action has changed.
- */
-/*void
-nact_window_set_current_action( NactWindow *window, const NAAction *action )
-{
- if( NACT_WINDOW_GET_CLASS( window )->set_current_action ){
- NACT_WINDOW_GET_CLASS( window )->set_current_action( window, action );
- }
-}*/
-
-/**
* Saves a modified action to the I/O storage subsystem.
*
* @window: this NactWindow object.
@@ -257,15 +256,18 @@ gboolean
nact_window_save_action( NactWindow *window, NAAction *action )
{
static const gchar *thisfn = "nact_window_save_action";
- g_debug( "%s: window=%p, action=%p", thisfn, window, action );
+ NAPivot *pivot;
+ gchar *msg = NULL;
+ guint ret;
- NAPivot *pivot = nact_window_get_pivot( window );
+ g_debug( "%s: window=%p, action=%p", thisfn, ( void * ) window, ( void * ) action );
+
+ pivot = nact_window_get_pivot( window );
g_assert( NA_IS_PIVOT( pivot ));
na_object_dump( NA_OBJECT( action ));
- gchar *msg = NULL;
- guint ret = na_pivot_write_action( pivot, action, &msg );
+ ret = na_pivot_write_action( pivot, action, &msg );
if( msg ){
base_window_error_dlg(
BASE_WINDOW( window ),
@@ -287,15 +289,18 @@ gboolean
nact_window_delete_action( NactWindow *window, NAAction *action )
{
static const gchar *thisfn = "nact_window_delete_action";
- g_debug( "%s: window=%p, action=%p", thisfn, window, action );
+ NAPivot *pivot;
+ gchar *msg = NULL;
+ guint ret;
+
+ g_debug( "%s: window=%p, action=%p", thisfn, ( void * ) window, ( void * ) action );
- NAPivot *pivot = nact_window_get_pivot( window );
+ pivot = nact_window_get_pivot( window );
g_assert( NA_IS_PIVOT( pivot ));
na_object_dump( NA_OBJECT( action ));
- gchar *msg = NULL;
- guint ret = na_pivot_delete_action( pivot, action, &msg );
+ ret = na_pivot_delete_action( pivot, action, &msg );
if( msg ){
base_window_error_dlg(
BASE_WINDOW( window ),
@@ -323,16 +328,19 @@ nact_window_warn_count_modified( NactWindow *window, gint count )
{
gchar *first;
gchar *second;
+ gboolean ok;
+
if( count == 1 ){
first = g_strdup_printf( _( "One action has been modified." ));
second = g_strdup( _( "Are you sure you want to quit without saving it ?" ));
+
} else {
/*first = g_strdup_printf( _( "%d actions have been modified." ), count );*/
first = g_strdup_printf( _( "Actions have been modified." ));
second = g_strdup( _( "Are you sure you want to quit without saving them ?" ));
}
- gboolean ok = base_window_yesno_dlg( BASE_WINDOW( window ), GTK_MESSAGE_QUESTION, first, second );
+ ok = base_window_yesno_dlg( BASE_WINDOW( window ), GTK_MESSAGE_QUESTION, first, second );
g_free( second );
g_free( first );
@@ -356,7 +364,7 @@ nact_window_signal_connect( NactWindow *window, GObject *instance, const gchar *
window->private->signals = g_slist_prepend( window->private->signals, str );
if( st_debug_signal_connect ){
- g_debug( "%s: connecting signal handler %p:%lu", thisfn, instance, handler_id );
+ g_debug( "%s: connecting signal handler %p:%lu", thisfn, ( void * ) instance, handler_id );
}
}
@@ -391,7 +399,7 @@ on_runtime_init_toplevel( BaseWindow *window )
BASE_WINDOW_CLASS( st_parent_class )->runtime_init_toplevel( window );
}
- g_debug( "%s: window=%p", thisfn, window );
+ g_debug( "%s: window=%p", thisfn, ( void * ) window );
g_assert( NACT_IS_WINDOW( window ));
nact_iprefs_position_window( NACT_WINDOW( window ));
@@ -407,5 +415,5 @@ on_all_widgets_showed( BaseWindow *dialog )
BASE_WINDOW_CLASS( st_parent_class )->all_widgets_showed( dialog );
}
- g_debug( "%s: dialog=%p", thisfn, dialog );
+ g_debug( "%s: dialog=%p", thisfn, ( void * ) dialog );
}
diff --git a/src/nact/nact-xml-reader.c b/src/nact/nact-xml-reader.c
index 98d3bc5..246656c 100644
--- a/src/nact/nact-xml-reader.c
+++ b/src/nact/nact-xml-reader.c
@@ -50,6 +50,7 @@
/* private class data
*/
struct NactXMLReaderClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -171,6 +172,9 @@ nact_xml_reader_get_type( void )
static GType
register_type( void )
{
+ static const gchar *thisfn = "nact_xml_reader_register_type";
+ GType type;
+
static GTypeInfo info = {
sizeof( NactXMLReaderClass ),
NULL,
@@ -183,7 +187,9 @@ register_type( void )
( GInstanceInitFunc ) instance_init
};
- GType type = g_type_register_static( G_TYPE_OBJECT, "NactXMLReader", &info, 0 );
+ g_debug( "%s", thisfn );
+
+ type = g_type_register_static( G_TYPE_OBJECT, "NactXMLReader", &info, 0 );
return( type );
}
@@ -192,11 +198,13 @@ static void
class_init( NactXMLReaderClass *klass )
{
static const gchar *thisfn = "nact_xml_reader_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *object_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class = G_OBJECT_CLASS( klass );
object_class->dispose = instance_dispose;
object_class->finalize = instance_finalize;
@@ -207,10 +215,11 @@ static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "nact_xml_reader_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NactXMLReader *self;
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NACT_IS_XML_READER( instance ));
- NactXMLReader *self = NACT_XML_READER( instance );
+ self = NACT_XML_READER( instance );
self->private = g_new0( NactXMLReaderPrivate, 1 );
@@ -227,8 +236,12 @@ instance_init( GTypeInstance *instance, gpointer klass )
static void
instance_dispose( GObject *object )
{
+ static const gchar *thisfn = "nact_xml_reader_instance_dispose";
+ NactXMLReader *self;
+
g_assert( NACT_IS_XML_READER( object ));
- NactXMLReader *self = NACT_XML_READER( object );
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
+ self = NACT_XML_READER( object );
if( !self->private->dispose_has_run ){
@@ -247,8 +260,12 @@ instance_dispose( GObject *object )
static void
instance_finalize( GObject *object )
{
+ static const gchar *thisfn = "nact_xml_reader_instance_finalize";
+ NactXMLReader *self;
+
g_assert( NACT_IS_XML_READER( object ));
- NactXMLReader *self = NACT_XML_READER( object );
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
+ self = NACT_XML_READER( object );
na_utils_free_string_list( self->private->messages );
free_reader_values( self );
@@ -274,15 +291,18 @@ NAAction *
nact_xml_reader_import( NactWindow *window, const gchar *uri, GSList **msg )
{
static const gchar *thisfn = "nact_xml_reader_import";
- g_debug( "%s: window=%p, uri=%s, msg=%p", thisfn, window, uri, msg );
-
NAAction *action = NULL;
- NactXMLReader *reader = gconf_reader_new();
+ NactXMLReader *reader;
+ xmlDoc *doc;
+
+ g_debug( "%s: window=%p, uri=%s, msg=%p", thisfn, ( void * ) window, uri, ( void * ) msg );
+
+ reader = gconf_reader_new();
reader->private->window = window;
g_assert( NACT_IS_ASSISTANT( window ));
- xmlDoc *doc = xmlParseFile( uri );
+ doc = xmlParseFile( uri );
if( !doc ){
xmlErrorPtr error = xmlGetLastError();
@@ -326,11 +346,11 @@ static void
gconf_reader_parse_schema_root( NactXMLReader *reader, xmlNode *root )
{
static const gchar *thisfn = "gconf_reader_parse_schema_root";
- g_debug( "%s: reader=%p, root=%p", thisfn, reader, root );
-
xmlNodePtr iter;
gboolean found = FALSE;
+ g_debug( "%s: reader=%p, root=%p", thisfn, ( void * ) reader, ( void * ) root );
+
for( iter = root->children ; iter ; iter = iter->next ){
if( iter->type != XML_ELEMENT_NODE ){
@@ -363,9 +383,10 @@ static void
gconf_reader_parse_schemalist( NactXMLReader *reader, xmlNode *schema )
{
static const gchar *thisfn = "gconf_reader_parse_schemalist";
- g_debug( "%s: reader=%p, schema=%p", thisfn, reader, schema );
-
xmlNode *iter;
+ gboolean ok = TRUE;
+
+ g_debug( "%s: reader=%p, schema=%p", thisfn, ( void * ) reader, ( void * ) schema );
reader->private->action = na_action_new();
reader->private->uuid_set = FALSE;
@@ -388,8 +409,6 @@ gconf_reader_parse_schemalist( NactXMLReader *reader, xmlNode *schema )
}
}
- gboolean ok = TRUE;
-
if( !reader->private->uuid_set ){
add_message( reader, ERR_UUID_NOT_FOUND );
ok = FALSE;
@@ -435,12 +454,14 @@ static gboolean
gconf_reader_parse_schema( NactXMLReader *reader, xmlNode *schema )
{
static const gchar *thisfn = "gconf_reader_parse_schema";
- g_debug( "%s: reader=%p, schema=%p", thisfn, reader, schema );
-
xmlNode *iter;
gboolean ret = TRUE;
gboolean applyto = FALSE;
gboolean pre_v1_11 = FALSE;
+ gboolean locale_found = FALSE;
+ gboolean default_found = FALSE;
+
+ g_debug( "%s: reader=%p, schema=%p", thisfn, ( void * ) reader, ( void * ) schema );
free_reader_values( reader );
@@ -519,9 +540,6 @@ gconf_reader_parse_schema( NactXMLReader *reader, xmlNode *schema )
/* check for and parse locale+default or locale depending of the
* previously found 'applyto' node
*/
- gboolean locale_found = FALSE;
- gboolean default_found = FALSE;
-
for( iter = schema->children ; iter ; iter = iter->next ){
if( iter->type != XML_ELEMENT_NODE ){
@@ -574,15 +592,17 @@ static gboolean
gconf_reader_parse_applyto( NactXMLReader *reader, xmlNode *node )
{
static const gchar *thisfn = "gconf_reader_parse_applyto";
- g_debug( "%s: reader=%p, node=%p", thisfn, reader, node );
-
gboolean ret = TRUE;
-
- xmlChar *text = xmlNodeGetContent( node );
- gchar *uuid = get_uuid_from_key( reader, ( const gchar * ) text, node->line );
+ xmlChar *text;
+ gchar *uuid;
gchar *profile = NULL;
gchar *entry = NULL;
+ g_debug( "%s: reader=%p, node=%p", thisfn, ( void * ) reader, ( void * ) node );
+
+ text = xmlNodeGetContent( node );
+ uuid = get_uuid_from_key( reader, ( const gchar * ) text, node->line );
+
if( !uuid ){
ret = FALSE;
}
@@ -640,12 +660,12 @@ static gboolean
gconf_reader_check_for_entry( NactXMLReader *reader, xmlNode *node, const char *entry )
{
static const gchar *thisfn = "gconf_reader_check_for_entry";
- g_debug( "%s: reader=%p, node=%p, entry=%s", thisfn, reader, node, entry );
-
gboolean ret = TRUE;
gboolean found = FALSE;
int i;
+ g_debug( "%s: reader=%p, node=%p, entry=%s", thisfn, ( void * ) reader, ( void * ) node, entry );
+
for( i=0 ; reader_str[i].entry ; ++i ){
if( !strcmp( reader_str[i].entry, entry )){
@@ -683,12 +703,12 @@ static gboolean
gconf_reader_parse_locale( NactXMLReader *reader, xmlNode *locale )
{
static const gchar *thisfn = "gconf_reader_parse_locale";
- g_debug( "%s: reader=%p, locale=%p", thisfn, reader, locale );
-
gboolean ret = TRUE;
xmlNode *iter;
gboolean default_found = FALSE;
+ g_debug( "%s: reader=%p, locale=%p", thisfn, ( void * ) reader, ( void * ) locale );
+
for( iter = locale->children ; iter ; iter = iter->next ){
if( iter->type != XML_ELEMENT_NODE ){
@@ -726,13 +746,16 @@ gconf_reader_parse_locale( NactXMLReader *reader, xmlNode *locale )
static void
gconf_reader_parse_default( NactXMLReader *reader, xmlNode *node )
{
+ xmlChar *text;
+ gchar *value;
+
if( reader->private->value ){
add_message( reader, ERR_VALUE_ALREADY_SET, reader->private->value, node->line );
return;
}
- xmlChar *text = xmlNodeGetContent( node );
- gchar *value = g_strdup(( const gchar * ) text );
+ text = xmlNodeGetContent( node );
+ value = g_strdup(( const gchar * ) text );
if( reader->private->list_waited ){
reader->private->list_value = na_utils_schema_to_gslist( value );
@@ -754,10 +777,11 @@ get_profile_name_from_schema_key( const gchar *key, const gchar *uuid )
{
gchar *prefix = g_strdup_printf( "%s/%s/%s", NA_GCONF_CONFIG_PATH, uuid, ACTION_PROFILE_PREFIX );
gchar *profile_name = NULL;
+ gchar *pos;
if( g_str_has_prefix( key, prefix )){
profile_name = g_strdup( key + strlen( prefix ));
- gchar *pos = g_strrstr( profile_name, "/" );
+ pos = g_strrstr( profile_name, "/" );
if( pos != NULL ){
*pos = '\0';
}
@@ -771,11 +795,11 @@ static void
gconf_reader_parse_dump_root( NactXMLReader *reader, xmlNode *root )
{
static const gchar *thisfn = "gconf_reader_parse_dump_root";
- g_debug( "%s: reader=%p, root=%p", thisfn, reader, root );
-
xmlNodePtr iter;
gboolean found = FALSE;
+ g_debug( "%s: reader=%p, root=%p", thisfn, ( void * ) reader, ( void * ) root );
+
for( iter = root->children ; iter ; iter = iter->next ){
if( iter->type != XML_ELEMENT_NODE ){
@@ -806,12 +830,15 @@ static void
gconf_reader_parse_entrylist( NactXMLReader *reader, xmlNode *entrylist )
{
static const gchar *thisfn = "gconf_reader_parse_entrylist";
- g_debug( "%s: reader=%p, entrylist=%p", thisfn, reader, entrylist );
+ xmlChar *path;
+ gchar *uuid, *label;
+
+ g_debug( "%s: reader=%p, entrylist=%p", thisfn, ( void * ) reader, ( void * ) entrylist );
reader->private->action = na_action_new();
- xmlChar *path = xmlGetProp( entrylist, ( const xmlChar * ) NACT_GCONF_DUMP_ENTRYLIST_BASE );
- gchar *uuid = na_utils_path_to_key(( const gchar * ) path );
- g_debug( "%s: uuid=%s", thisfn, uuid );
+ path = xmlGetProp( entrylist, ( const xmlChar * ) NACT_GCONF_DUMP_ENTRYLIST_BASE );
+ uuid = na_utils_path_to_key(( const gchar * ) path );
+ /*g_debug( "%s: uuid=%s", thisfn, uuid );*/
if( is_uuid_valid( uuid )){
if( action_exists( reader, uuid )){
@@ -848,7 +875,7 @@ gconf_reader_parse_entrylist( NactXMLReader *reader, xmlNode *entrylist )
}
}
- gchar *label = na_action_get_label( reader->private->action );
+ label = na_action_get_label( reader->private->action );
if( !label || !g_utf8_strlen( label, -1 )){
add_message( reader, ERR_ACTION_LABEL_NOT_FOUND );
}
@@ -863,10 +890,13 @@ static gboolean
gconf_reader_parse_entry( NactXMLReader *reader, xmlNode *entry )
{
static const gchar *thisfn = "gconf_reader_parse_entry";
- g_debug( "%s: reader=%p, entry=%p", thisfn, reader, entry );
-
xmlNode *iter;
gboolean ret = TRUE;
+ gboolean key_found = FALSE;
+ gboolean value_found = FALSE;
+
+ g_debug( "%s: reader=%p, entry=%p", thisfn, ( void * ) reader, ( void * ) entry );
+
free_reader_values( reader );
/* check for the children of the 'entry' node
@@ -891,7 +921,6 @@ gconf_reader_parse_entry( NactXMLReader *reader, xmlNode *entry )
/* check for one and only one 'key' node
*/
- gboolean key_found = FALSE;
for( iter = entry->children ; iter ; iter = iter->next ){
if( iter->type != XML_ELEMENT_NODE ){
@@ -909,18 +938,19 @@ gconf_reader_parse_entry( NactXMLReader *reader, xmlNode *entry )
}
}
}
+
if( !key_found ){
g_assert( ret );
add_message( reader, ERR_NODE_NOT_FOUND, NACT_GCONF_DUMP_KEY );
ret = FALSE;
}
+
if( !ret ){
return( ret );
}
/* check for one and only one 'value' node
*/
- gboolean value_found = FALSE;
for( iter = entry->children ; iter ; iter = iter->next ){
if( iter->type != XML_ELEMENT_NODE ){
@@ -938,11 +968,13 @@ gconf_reader_parse_entry( NactXMLReader *reader, xmlNode *entry )
}
}
}
+
if( !value_found ){
g_assert( ret );
add_message( reader, ERR_NO_VALUE_FOUND );
ret = FALSE;
}
+
if( ret ){
apply_values( reader );
}
@@ -954,14 +986,15 @@ static gboolean
gconf_reader_parse_dump_key( NactXMLReader *reader, xmlNode *node )
{
static const gchar *thisfn = "gconf_reader_parse_dump_key";
- g_debug( "%s: reader=%p, node=%p", thisfn, reader, node );
-
gboolean ret = TRUE;
-
- xmlChar *text = xmlNodeGetContent( node );
+ xmlChar *text;
gchar *profile = NULL;
gchar *entry = NULL;
+ g_debug( "%s: reader=%p, node=%p", thisfn, ( void * ) reader, ( void * ) node );
+
+ text = xmlNodeGetContent( node );
+
if( ret ){
profile = get_profile_name_from_dump_key(( const gchar * ) text );
@@ -1044,11 +1077,15 @@ get_profile_name_from_dump_key( const gchar *key )
gchar *profile_name = NULL;
gchar **split = g_strsplit( key, "/", -1 );
guint count = g_strv_length( split );
+
g_assert( count );
+
if( count > 1 ){
profile_name = g_strdup( split[0] );
}
+
g_strfreev( split );
+
return( profile_name );
}
@@ -1056,7 +1093,9 @@ static void
apply_values( NactXMLReader *reader )
{
static const gchar *thisfn = "gconf_reader_apply_values";
- g_debug( "%s: reader=%p, entry=%s, value=%s", thisfn, reader, reader->private->entry, reader->private->value );
+
+ g_debug( "%s: reader=%p, entry=%s, value=%s",
+ thisfn, ( void * ) reader, reader->private->entry, reader->private->value );
if( reader->private->entry && strlen( reader->private->entry )){
if( !strcmp( reader->private->entry, ACTION_VERSION_ENTRY )){
@@ -1113,11 +1152,13 @@ apply_values( NactXMLReader *reader )
static void
add_message( NactXMLReader *reader, const gchar *format, ... )
{
+ va_list va;
+ gchar *tmp;
+
g_debug( "nact_xml_reader_add_message: format=%s", format );
- va_list va;
va_start( va, format );
- gchar *tmp = g_strdup_vprintf( format, va );
+ tmp = g_strdup_vprintf( format, va );
va_end( va );
reader->private->messages = g_slist_append( reader->private->messages, tmp );
}
@@ -1140,14 +1181,16 @@ strxcmp( const xmlChar *a, const char *b )
static gchar *
get_uuid_from_key( NactXMLReader *reader, const gchar *key, guint line )
{
+ gchar *uuid, *pos;
+
if( !g_str_has_prefix( key, NA_GCONF_CONFIG_PATH )){
add_message( reader,
ERR_INVALID_KEY_PREFIX, NA_GCONF_CONFIG_PATH, key, line );
return( NULL );
}
- gchar *uuid = g_strdup( key + strlen( NA_GCONF_CONFIG_PATH "/" ));
- gchar *pos = g_strstr_len( uuid, strlen( uuid ), "/" );
+ uuid = g_strdup( key + strlen( NA_GCONF_CONFIG_PATH "/" ));
+ pos = g_strstr_len( uuid, strlen( uuid ), "/" );
if( pos != NULL ){
*pos = '\0';
}
diff --git a/src/plugin/nautilus-actions.c b/src/plugin/nautilus-actions.c
index 5e3c088..0fcdaa4 100644
--- a/src/plugin/nautilus-actions.c
+++ b/src/plugin/nautilus-actions.c
@@ -50,6 +50,7 @@
/* private class data
*/
struct NautilusActionsClassPrivate {
+ void *empty; /* so that gcc -pedantic is happy */
};
/* private instance data
@@ -89,9 +90,6 @@ void
nautilus_actions_register_type( GTypeModule *module )
{
static const gchar *thisfn = "nautilus_actions_register_type";
- g_debug( "%s: module=%p", thisfn, module );
-
- g_assert( st_actions_type == 0 );
static const GTypeInfo info = {
sizeof( NautilusActionsClass ),
@@ -105,36 +103,33 @@ nautilus_actions_register_type( GTypeModule *module )
( GInstanceInitFunc ) instance_init,
};
- st_actions_type = g_type_module_register_type( module, G_TYPE_OBJECT, "NautilusActions", &info, 0 );
-
- /* implements NautilusMenuItem interface
- */
static const GInterfaceInfo menu_provider_iface_info = {
( GInterfaceInitFunc ) menu_provider_iface_init,
NULL,
NULL
};
- g_type_module_add_interface( module, st_actions_type, NAUTILUS_TYPE_MENU_PROVIDER, &menu_provider_iface_info );
-
- /* implement IPivotConsumer interface
- */
static const GInterfaceInfo pivot_consumer_iface_info = {
( GInterfaceInitFunc ) pivot_consumer_iface_init,
NULL,
NULL
};
- g_type_module_add_interface( module, st_actions_type, NA_IPIVOT_CONSUMER_TYPE, &pivot_consumer_iface_info );
-
- /* implement IPrefs interface
- */
static const GInterfaceInfo prefs_iface_info = {
( GInterfaceInitFunc ) prefs_iface_init,
NULL,
NULL
};
+ g_debug( "%s: module=%p", thisfn, ( void * ) module );
+ g_assert( st_actions_type == 0 );
+
+ st_actions_type = g_type_module_register_type( module, G_TYPE_OBJECT, "NautilusActions", &info, 0 );
+
+ g_type_module_add_interface( module, st_actions_type, NAUTILUS_TYPE_MENU_PROVIDER, &menu_provider_iface_info );
+
+ g_type_module_add_interface( module, st_actions_type, NA_IPIVOT_CONSUMER_TYPE, &pivot_consumer_iface_info );
+
g_type_module_add_interface( module, st_actions_type, NA_IPREFS_TYPE, &prefs_iface_info );
}
@@ -142,11 +137,13 @@ static void
class_init( NautilusActionsClass *klass )
{
static const gchar *thisfn = "nautilus_actions_class_init";
- g_debug( "%s: klass=%p", thisfn, klass );
+ GObjectClass *gobject_class;
+
+ g_debug( "%s: klass=%p", thisfn, ( void * ) klass );
st_parent_class = g_type_class_peek_parent( klass );
- GObjectClass *gobject_class = G_OBJECT_CLASS( klass );
+ gobject_class = G_OBJECT_CLASS( klass );
gobject_class->dispose = instance_dispose;
gobject_class->finalize = instance_finalize;
@@ -157,7 +154,8 @@ static void
menu_provider_iface_init( NautilusMenuProviderIface *iface )
{
static const gchar *thisfn = "nautilus_actions_menu_provider_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->get_file_items = get_file_items;
iface->get_background_items = get_background_items;
@@ -167,7 +165,8 @@ static void
pivot_consumer_iface_init( NAIPivotConsumerInterface *iface )
{
static const gchar *thisfn = "nautilus_actions_pivot_consumer_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
iface->on_actions_changed = actions_changed_handler;
}
@@ -176,17 +175,20 @@ static void
prefs_iface_init( NAIPrefsInterface *iface )
{
static const gchar *thisfn = "nautilus_actions_prefs_iface_init";
- g_debug( "%s: iface=%p", thisfn, iface );
+
+ g_debug( "%s: iface=%p", thisfn, ( void * ) iface );
}
static void
instance_init( GTypeInstance *instance, gpointer klass )
{
static const gchar *thisfn = "nautilus_actions_instance_init";
- g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+ NautilusActions *self;
+
+ g_debug( "%s: instance=%p, klass=%p", thisfn, ( void * ) instance, ( void * ) klass );
g_assert( NAUTILUS_IS_ACTIONS( instance ));
- NautilusActions *self = NAUTILUS_ACTIONS( instance );
+ self = NAUTILUS_ACTIONS( instance );
self->private = g_new0( NautilusActionsPrivate, 1 );
self->private->dispose_has_run = FALSE;
@@ -199,10 +201,11 @@ static void
instance_dispose( GObject *object )
{
static const gchar *thisfn = "nautilus_actions_instance_dispose";
- g_debug( "%s: object=%p", thisfn, object );
+ NautilusActions *self;
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
g_assert( NAUTILUS_IS_ACTIONS( object ));
- NautilusActions *self = NAUTILUS_ACTIONS( object );
+ self = NAUTILUS_ACTIONS( object );
if( !self->private->dispose_has_run ){
self->private->dispose_has_run = TRUE;
@@ -218,10 +221,11 @@ static void
instance_finalize( GObject *object )
{
static const gchar *thisfn = "nautilus_actions_instance_finalize";
- g_debug( "%s: object=%p", thisfn, object );
+ NautilusActions *self;
+ g_debug( "%s: object=%p", thisfn, ( void * ) object );
g_assert( NAUTILUS_IS_ACTIONS( object ));
- NautilusActions* self = NAUTILUS_ACTIONS( object );
+ self = NAUTILUS_ACTIONS( object );
g_free( self->private );
@@ -258,7 +262,8 @@ get_background_items( NautilusMenuProvider *provider, GtkWidget *window, Nautilu
#ifdef NA_MAINTAINER_MODE
static const gchar *thisfn = "nautilus_actions_get_background_items";
gchar *uri = nautilus_file_info_get_uri( current_folder );
- g_debug( "%s: provider=%p, window=%p, current_folder=%p (%s)", thisfn, provider, window, current_folder, uri );
+ g_debug( "%s: provider=%p, window=%p, current_folder=%p (%s)",
+ thisfn, ( void * ) provider, ( void * ) window, ( void * ) current_folder, uri );
g_free( uri );
#endif
return(( GList * ) NULL );
@@ -268,8 +273,7 @@ static GList *
get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files )
{
static const gchar *thisfn = "nautilus_actions_get_file_items";
- g_debug( "%s: provider=%p, window=%p, files=%p, count=%d", thisfn, provider, window, files, g_list_length( files ));
-
+ NautilusActions *self;
GList *items = NULL;
GSList* profiles;
GSList *ia, *ip;
@@ -277,16 +281,20 @@ get_file_items( NautilusMenuProvider *provider, GtkWidget *window, GList *files
NautilusMenuItem *item;
GSList *actions = NULL;
gchar *label, *uuid;
+ gboolean have_submenu;
+
+ g_debug( "%s: provider=%p, window=%p, files=%p, count=%d",
+ thisfn, ( void * ) provider, ( void * ) window, ( void * ) files, g_list_length( files ));
g_return_val_if_fail( NAUTILUS_IS_ACTIONS( provider ), NULL );
- NautilusActions *self = NAUTILUS_ACTIONS( provider );
+ self = NAUTILUS_ACTIONS( provider );
/* no need to go further if there is no files in the list */
if( !g_list_length( files )){
return(( GList * ) NULL );
}
- gboolean have_submenu = na_iprefs_get_bool( NA_IPREFS( self ), PREFS_DISPLAY_AS_SUBMENU );
+ have_submenu = na_iprefs_get_bool( NA_IPREFS( self ), PREFS_DISPLAY_AS_SUBMENU );
if( !self->private->dispose_has_run ){
actions = na_pivot_get_actions( self->private->pivot );
@@ -351,17 +359,19 @@ static NautilusMenuItem *
create_menu_item( NAAction *action, NAActionProfile *profile, GList *files )
{
static const gchar *thisfn = "nautilus_actions_create_menu_item";
- g_debug( "%s", thisfn );
-
NautilusMenuItem *item;
+ gchar *uuid, *name, *label, *tooltip, *icon_name;
+ NAActionProfile *dup4menu;
- gchar *uuid = na_action_get_uuid( action );
- gchar *name = g_strdup_printf( "NautilusActions::%s", uuid );
- gchar *label = na_action_get_label( action );
- gchar *tooltip = na_action_get_tooltip( action );
- gchar* icon_name = na_action_get_verified_icon_name( action );
+ g_debug( "%s", thisfn );
+
+ uuid = na_action_get_uuid( action );
+ name = g_strdup_printf( "NautilusActions::%s", uuid );
+ label = na_action_get_label( action );
+ tooltip = na_action_get_tooltip( action );
+ icon_name = na_action_get_verified_icon_name( action );
- NAActionProfile *dup4menu = NA_ACTION_PROFILE( na_object_duplicate( NA_OBJECT( profile )));
+ dup4menu = NA_ACTION_PROFILE( na_object_duplicate( NA_OBJECT( profile )));
item = nautilus_menu_item_new( name, label, tooltip, icon_name );
@@ -438,12 +448,12 @@ static void
execute_action( NautilusMenuItem *item, NAActionProfile *profile )
{
static const gchar *thisfn = "nautilus_actions_execute_action";
- g_debug( "%s: item=%p, profile=%p", thisfn, item, profile );
-
GList *files;
GString *cmd;
gchar *param, *path;
+ g_debug( "%s: item=%p, profile=%p", thisfn, ( void * ) item, ( void * ) profile );
+
files = ( GList* ) g_object_get_data( G_OBJECT( item ), "files" );
path = na_action_profile_get_path( profile );
@@ -468,10 +478,11 @@ static void
actions_changed_handler( NAIPivotConsumer *instance, gpointer user_data )
{
static const gchar *thisfn = "nautilus_actions_actions_changed_handler";
- g_debug( "%s: instance=%p, user_data=%p", thisfn, instance, user_data );
+ NautilusActions *self;
+ g_debug( "%s: instance=%p, user_data=%p", thisfn, ( void * ) instance, ( void * ) user_data );
g_assert( NAUTILUS_IS_ACTIONS( instance ));
- NautilusActions *self = NAUTILUS_ACTIONS( instance );
+ self = NAUTILUS_ACTIONS( instance );
if( !self->private->dispose_has_run ){
diff --git a/src/plugin/nautilus-module.c b/src/plugin/nautilus-module.c
index eb34bfc..e73abe5 100644
--- a/src/plugin/nautilus-module.c
+++ b/src/plugin/nautilus-module.c
@@ -57,6 +57,8 @@ static void na_log_handler( const gchar *log_domain, GLogLevelFlags log_level, c
void
nautilus_module_initialize( GTypeModule *module )
{
+ static const gchar *thisfn = "nautilus_module_initialize";
+
syslog( LOG_USER | LOG_INFO, "%s initializing...", PACKAGE_STRING );
if( !st_log_handler ){
@@ -65,8 +67,7 @@ nautilus_module_initialize( GTypeModule *module )
g_log_set_handler( NA_LOGDOMAIN_COMMON, G_LOG_LEVEL_DEBUG, na_log_handler, NULL );
}
- static const gchar *thisfn = "nautilus_module_initialize";
- g_debug( "%s: module=%p", thisfn, module );
+ g_debug( "%s: module=%p", thisfn, ( void * ) module );
nautilus_actions_register_type( module );
}
@@ -75,13 +76,12 @@ void
nautilus_module_list_types( const GType **types, int *num_types )
{
static const gchar *thisfn = "nautilus_module_list_types";
- g_debug( "%s: types=%p, num_types=%p", thisfn, types, num_types );
-
static GType type_list[1];
+ g_debug( "%s: types=%p, num_types=%p", thisfn, ( void * ) types, ( void * ) num_types );
+
type_list[0] = NAUTILUS_ACTIONS_TYPE;
*types = type_list;
-
*num_types = 1;
}
@@ -89,6 +89,7 @@ void
nautilus_module_shutdown( void )
{
static const gchar *thisfn = "nautilus_module_shutdown";
+
g_debug( "%s", thisfn );
/* remove the log handler
diff --git a/src/test/test-parse-uris.c b/src/test/test-parse-uris.c
index 6a4b5d2..848c41b 100644
--- a/src/test/test-parse-uris.c
+++ b/src/test/test-parse-uris.c
@@ -50,10 +50,11 @@ static const gchar *uris[] = {
int
main( int argc, char** argv )
{
+ int i;
+
g_type_init();
g_printf( _( "URIs parsing test.\n\n" ));
- int i;
for( i = 0 ; uris[i] ; ++i ){
NAGnomeVFSURI *vfs = g_new0( NAGnomeVFSURI, 1 );
na_gnome_vfs_uri_parse( vfs, uris[i] );
diff --git a/src/utils/nautilus-actions-new.c b/src/utils/nautilus-actions-new.c
index 630ed9c..7ea70b9 100644
--- a/src/utils/nautilus-actions-new.c
+++ b/src/utils/nautilus-actions-new.c
@@ -92,21 +92,25 @@ static void exit_with_usage( void );
int
main( int argc, char** argv )
{
- g_type_init();
-
int status = EXIT_SUCCESS;
+ GOptionContext *context;
+ GError *error = NULL;
+ NAAction *action;
+ gchar *msg = NULL;
+ gchar *help;
- GOptionContext *context = init_options();
+ g_type_init();
+
+ context = init_options();
if( argc == 1 ){
g_set_prgname( argv[0] );
- gchar *help = g_option_context_get_help( context, FALSE, NULL );
+ help = g_option_context_get_help( context, FALSE, NULL );
g_print( "\n%s", help );
g_free( help );
exit( status );
}
- GError *error = NULL;
if( !g_option_context_parse( context, &argc, &argv, &error )){
g_printerr( _("Syntax error: %s\n" ), error->message );
g_error_free (error);
@@ -123,8 +127,7 @@ main( int argc, char** argv )
exit_with_usage();
}
- NAAction *action = get_action_from_cmdline();
- gchar *msg = NULL;
+ action = get_action_from_cmdline();
if( output_gconf ){
if( write_to_gconf( action, &msg )){
@@ -159,7 +162,11 @@ main( int argc, char** argv )
static GOptionContext *
init_options( void )
{
- GOptionContext *context = g_option_context_new( _( "Define a new action.\n\n"
+ GOptionContext *context;
+ gchar* description;
+ GOptionGroup *output_group;
+
+ context = g_option_context_new( _( "Define a new action.\n\n"
" The created action defaults to be written to stdout.\n"
" It can also be written to an output folder, in a file later suitable for an import in NACT.\n"
" Or you may choose to directly write the action into your GConf configuration." ));
@@ -175,7 +182,7 @@ init_options( void )
g_option_context_add_main_entries( context, entries, NULL );
#endif
- gchar* description = g_strdup_printf( "%s.\n%s", PACKAGE_STRING,
+ description = g_strdup_printf( "%s.\n%s", PACKAGE_STRING,
_( "Bug reports are welcomed at http://bugzilla.gnome.org,"
" or you may prefer to mail to <maintainer nautilus-actions org>.\n" ));
@@ -183,7 +190,7 @@ init_options( void )
g_free( description );
- GOptionGroup *output_group = g_option_group_new(
+ output_group = g_option_group_new(
"output", _( "Output of the program" ), _( "Choose where the program creates the action" ), NULL, NULL );
g_option_group_add_entries( output_group, output_entries );
@@ -201,6 +208,10 @@ get_action_from_cmdline( void )
{
NAAction *action = na_action_new_with_profile();
NAActionProfile *profile = NA_ACTION_PROFILE( na_action_get_profiles( action )->data );
+ int i = 0;
+ GSList *basenames = NULL;
+ GSList *mimetypes = NULL;
+ GSList *schemes = NULL;
na_action_set_label( action, label );
na_action_set_tooltip( action, tooltip );
@@ -210,8 +221,6 @@ get_action_from_cmdline( void )
na_action_profile_set_path( profile, command );
na_action_profile_set_parameters( profile, parameters );
- int i = 0;
- GSList *basenames = NULL;
while( basenames_array != NULL && basenames_array[i] != NULL ){
basenames = g_slist_append( basenames, g_strdup( basenames_array[i] ));
i++;
@@ -223,7 +232,6 @@ get_action_from_cmdline( void )
na_action_profile_set_matchcase( profile, matchcase );
i = 0;
- GSList *mimetypes = NULL;
while( mimetypes_array != NULL && mimetypes_array[i] != NULL ){
mimetypes = g_slist_append( mimetypes, g_strdup( mimetypes_array[i] ));
i++;
@@ -240,7 +248,6 @@ get_action_from_cmdline( void )
na_action_profile_set_multiple( profile, accept_multiple );
i = 0;
- GSList *schemes = NULL;
while( schemes_array != NULL && schemes_array[i] != NULL ){
schemes = g_slist_append( schemes, g_strdup( schemes_array[i] ));
i++;
@@ -259,11 +266,14 @@ get_action_from_cmdline( void )
static gboolean
write_to_gconf( NAAction *action, gchar **msg )
{
- NAGConf *gconf = na_gconf_new( NULL );
+ NAGConf *gconf;
+ guint ret;
+
+ gconf = na_gconf_new( NULL );
na_action_set_provider( action, NA_IIO_PROVIDER( gconf ));
- guint ret = na_iio_provider_write_action( NULL, action, msg );
+ ret = na_iio_provider_write_action( NULL, action, msg );
return( ret == NA_IIO_PROVIDER_WRITE_OK );
}
diff --git a/src/utils/nautilus-actions-schemas.c b/src/utils/nautilus-actions-schemas.c
index 39dce2a..2ecc79d 100644
--- a/src/utils/nautilus-actions-schemas.c
+++ b/src/utils/nautilus-actions-schemas.c
@@ -62,21 +62,24 @@ static void exit_with_usage( void );
int
main( int argc, char** argv )
{
- g_type_init();
-
int status = EXIT_SUCCESS;
+ GOptionContext *context;
+ gchar *help;
+ GError *error = NULL;
+ gchar *msg = NULL;
+
+ g_type_init();
- GOptionContext *context = init_options();
+ context = init_options();
if( argc == 1 ){
g_set_prgname( argv[0] );
- gchar *help = g_option_context_get_help( context, FALSE, NULL );
+ help = g_option_context_get_help( context, FALSE, NULL );
g_print( "\n%s", help );
g_free( help );
exit( status );
}
- GError *error = NULL;
if( !g_option_context_parse( context, &argc, &argv, &error )){
g_printerr( _("Syntax error: %s\n" ), error->message );
g_error_free (error);
@@ -88,8 +91,6 @@ main( int argc, char** argv )
exit_with_usage();
}*/
- gchar *msg = NULL;
-
/*if( output_gconf ){
if( write_to_gconf( &msg )){
g_print( _( "Nautilus Actions schema succesfully written to GConf.\n" ));
@@ -120,7 +121,10 @@ main( int argc, char** argv )
static GOptionContext *
init_options( void )
{
- GOptionContext *context = g_option_context_new( _( "Output the Nautilus Actions GConf schema on stdout." ));
+ GOptionContext *context;
+ gchar *description;
+
+ context = g_option_context_new( _( "Output the Nautilus Actions GConf schema on stdout." ));
/*" The schema can be written to stdout.\n"
" It can also be written to an output file, in a file later suitable for an installation via gconftool-2.\n"
" Or you may choose to directly write the schema into the GConf configuration." ));*/
@@ -136,7 +140,7 @@ init_options( void )
g_option_context_add_main_entries( context, entries, NULL );
#endif
- gchar* description = g_strdup_printf( "%s.\n%s", PACKAGE_STRING,
+ description = g_strdup_printf( "%s.\n%s", PACKAGE_STRING,
_( "Bug reports are welcomed at http://bugzilla.gnome.org,"
" or you may prefer to mail to <maintainer nautilus-actions org>.\n" ));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]