[nautilus-actions] Add --version command-line argument to nautilus-actions-schemas
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Add --version command-line argument to nautilus-actions-schemas
- Date: Tue, 27 Oct 2009 23:11:29 +0000 (UTC)
commit 5b76df78db63062b2e83168f40206d61474947ac
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Oct 27 21:55:53 2009 +0100
Add --version command-line argument to nautilus-actions-schemas
ChangeLog | 8 ++++++++
src/common/na-utils.c | 31 +++++++++++++++++++++++++++++++
src/common/na-utils.h | 5 +++++
src/utils/nautilus-actions-new.c | 27 +--------------------------
src/utils/nautilus-actions-schemas.c | 19 +++++++++++++++++++
5 files changed, 64 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3fd0cfc..ab931ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2009-10-27 Pierre Wieser <pwieser trychlos org>
+ * src/common/na-utils.c:
+ * src/common/na-utils.c (na_utils_print_version):
+ New function.
+
+ * src/utils/nautilus-actions-new.c:
+ * src/utils/nautilus-actions-schemas.c:
+ Make use of na_utils_print_version() new function.
+
* src/runtime/na-iabout.c:
* src/runtime/na-iabout.h (na_iabout_get_copyright):
New function.
diff --git a/src/common/na-utils.c b/src/common/na-utils.c
index 71d8abe..381ec2e 100644
--- a/src/common/na-utils.c
+++ b/src/common/na-utils.c
@@ -36,6 +36,8 @@
#include <glib-object.h>
#include <string.h>
+#include <runtime/na-iabout.h>
+
#include "na-utils.h"
static GSList *text_to_string_list( const gchar *text, const gchar *separator, const gchar *default_value );
@@ -445,3 +447,32 @@ na_utils_exist_file( const gchar *uri )
return( exists );
}
+
+/**
+ * na_utils_print_version:
+ *
+ * Prints the current version of the program to stdout. This function
+ * is to be used by console programs.
+ */
+/*
+ * nautilus-actions-new (Nautilus-Actions) v 2.29.1
+ * Copyright (C) 2005-2007 Frederic Ruaudel
+ * Copyright (C) 2009 Pierre Wieser
+ * Nautilus-Actions is free software, licensed under GPLv2 or later.
+ */
+void
+na_utils_print_version( void )
+{
+ gchar *copyright;
+
+ g_print( "\n" );
+ g_print( "%s (%s) v %s\n", g_get_prgname(), PACKAGE_NAME, PACKAGE_VERSION );
+ copyright = na_iabout_get_copyright( TRUE );
+ g_print( "%s\n", copyright );
+ g_free( copyright );
+
+ g_print( "%s is free software, and is provided without any warranty. You may\n", PACKAGE_NAME );
+ g_print( "redistribute copies of %s under the terms of the GNU General Public\n", PACKAGE_NAME );
+ g_print( "License (see COPYING).\n" );
+ g_print( "\n" );
+}
diff --git a/src/common/na-utils.h b/src/common/na-utils.h
index 6e3402a..44f5436 100644
--- a/src/common/na-utils.h
+++ b/src/common/na-utils.h
@@ -67,6 +67,11 @@ gchar *na_utils_remove_last_level_from_path( const gchar *path );
gboolean na_utils_is_writable_dir( const gchar *uri );
gboolean na_utils_exist_file( const gchar *uri );
+/*
+ * misc
+ */
+void na_utils_print_version( void );
+
G_END_DECLS
#endif /* __NA_COMMON_UTILS_H__ */
diff --git a/src/utils/nautilus-actions-new.c b/src/utils/nautilus-actions-new.c
index edd4e8b..ed6f4b2 100644
--- a/src/utils/nautilus-actions-new.c
+++ b/src/utils/nautilus-actions-new.c
@@ -36,7 +36,6 @@
#include <glib/gi18n.h>
#include <stdlib.h>
-#include <runtime/na-iabout.h>
#include <runtime/na-gconf-provider.h>
#include <runtime/na-iio-provider.h>
@@ -112,7 +111,6 @@ static GOptionEntry misc_entries[] = {
static GOptionContext *init_options( void );
static NAObjectAction *get_action_from_cmdline( void );
-static void print_version( void );
static gboolean write_to_gconf( NAObjectAction *action, GSList **msg );
static void exit_with_usage( void );
@@ -146,7 +144,7 @@ main( int argc, char** argv )
}
if( version ){
- print_version();
+ na_utils_print_version();
exit( status );
}
@@ -303,29 +301,6 @@ get_action_from_cmdline( void )
}
/*
- * nautilus-actions-new (Nautilus-Actions) v 2.29.1
- * Copyright (C) 2005-2007 Frederic Ruaudel
- * Copyright (C) 2009 Pierre Wieser
- * Nautilus-Actions is free software, licensed under GPLv2 or later.
- */
-static void
-print_version( void )
-{
- gchar *copyright;
-
- g_print( "\n" );
- g_print( "%s (%s) v %s\n", g_get_prgname(), PACKAGE_NAME, PACKAGE_VERSION );
- copyright = na_iabout_get_copyright( TRUE );
- g_print( "%s\n", copyright );
- g_free( copyright );
-
- g_print( "%s is free software, and is provided without any warranty. You may\n", PACKAGE_NAME );
- g_print( "redistribute copies of %s under the terms of the GNU General Public\n", PACKAGE_NAME );
- g_print( "License (see COPYING).\n" );
- g_print( "\n" );
-}
-
-/*
* initialize GConf as an I/O provider
* then writes the action
*/
diff --git a/src/utils/nautilus-actions-schemas.c b/src/utils/nautilus-actions-schemas.c
index a10a712..2b5b6db 100644
--- a/src/utils/nautilus-actions-schemas.c
+++ b/src/utils/nautilus-actions-schemas.c
@@ -46,6 +46,7 @@
/*static gchar *output_fname = NULL;
static gboolean output_gconf = FALSE;*/
static gboolean output_stdout = FALSE;
+static gboolean version = FALSE;
static GOptionEntry entries[] = {
@@ -55,6 +56,13 @@ static GOptionEntry entries[] = {
{ NULL }
};
+static GOptionEntry misc_entries[] = {
+
+ { "version" , 'v', 0, G_OPTION_ARG_NONE , &version,
+ N_("Output the version number"), NULL },
+ { NULL }
+};
+
static GOptionContext *init_options( void );
/*static gboolean write_to_gconf( gchar **msg );
static gboolean write_schema( GConfClient *gconf, const gchar *prefix, GConfValueType type, const gchar *entry, const gchar *dshort, const gchar *dlong, const gchar *default_value, gchar **msg );*/
@@ -88,6 +96,11 @@ main( int argc, char** argv )
exit_with_usage();
}
+ if( version ){
+ na_utils_print_version();
+ exit( status );
+ }
+
/*if( output_gconf && output_fname ){
g_printerr( _( "Error: only one output option may be specified." ));
exit_with_usage();
@@ -127,6 +140,7 @@ init_options( void )
{
GOptionContext *context;
gchar *description;
+ GOptionGroup *misc_group;
context = g_option_context_new( _( "Output the Nautilus Actions GConf schema on stdout." ));
/*" The schema can be written to stdout.\n"
@@ -152,6 +166,11 @@ init_options( void )
g_free( description );
+ misc_group = g_option_group_new(
+ "misc", _( "Miscellaneous options" ), _( "Miscellaneous options" ), NULL, NULL );
+ g_option_group_add_entries( misc_group, misc_entries );
+ g_option_context_add_group( context, misc_group );
+
return( context );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]