[Goodies-commits] r6059 - xfburn/trunk/xfburn
David Mohr
squisher at xfce.org
Tue Nov 11 04:26:19 CET 2008
Author: squisher
Date: 2008-11-11 03:26:19 +0000 (Tue, 11 Nov 2008)
New Revision: 6059
Modified:
xfburn/trunk/xfburn/xfburn-file-browser.c
xfburn/trunk/xfburn/xfburn-main.c
xfburn/trunk/xfburn/xfburn-main.h
Log:
Preparing code for setting the browser start directory
Modified: xfburn/trunk/xfburn/xfburn-file-browser.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-file-browser.c 2008-11-11 03:12:19 UTC (rev 6058)
+++ xfburn/trunk/xfburn/xfburn-file-browser.c 2008-11-11 03:26:19 UTC (rev 6059)
@@ -32,6 +32,7 @@
#include "xfburn-file-browser.h"
#include "xfburn-fs-browser.h"
#include "xfburn-directory-browser.h"
+#include "xfburn-main.h"
#define XFBURN_FILE_BROWSER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), XFBURN_TYPE_FILE_BROWSER, XfburnFileBrowserPrivate))
Modified: xfburn/trunk/xfburn/xfburn-main.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-main.c 2008-11-11 03:12:19 UTC (rev 6058)
+++ xfburn/trunk/xfburn/xfburn-main.c 2008-11-11 03:26:19 UTC (rev 6059)
@@ -57,6 +57,10 @@
static gboolean parse_option (const gchar *option_name, const gchar *value,
gpointer data, GError **error);
+/* globals */
+static int window_counter = 0;
+
+
/* command line parameters */
static gchar *image_filename = NULL;
static gboolean show_version = FALSE;
@@ -66,6 +70,7 @@
static gboolean add_audio_composition = FALSE;
static gboolean blank = FALSE;
static gchar *transcoder_selection = NULL;
+static gchar *initial_dir = NULL;
static GOptionEntry optionentries[] = {
{ "burn-image", 'i', G_OPTION_FLAG_OPTIONAL_ARG /* || G_OPTION_FLAG_FILENAME */, G_OPTION_ARG_CALLBACK, &parse_option,
@@ -78,6 +83,10 @@
"Start an audio composition. Optionally followed by files/directories to be added to the composition.", NULL },
{ "transcoder", 't', 0, G_OPTION_ARG_STRING, &transcoder_selection,
"Select the transcoder. Run with --transcoder=list to see the available ones.", NULL },
+/* not yet implemented
+ { "directory", 'D', G_OPTION_FLAG_OPTIONAL_ARG , G_OPTION_ARG_CALLBACK, &parse_option,
+ "Open the burn image dialog. The filename of the image can optionally be specified as a parameter", NULL },
+*/
{ "version", 'V', G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_NONE, &show_version,
"Display program version and exit", NULL },
{ "main", 'm', G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_NONE, &show_main,
@@ -85,31 +94,8 @@
{ NULL, ' ', 0, 0, NULL, NULL, NULL }
};
-static gboolean parse_option (const gchar *option_name, const gchar *value,
- gpointer data, GError **error)
-{
- if (strcmp (option_name, "-i") == 0 || strcmp (option_name, "--burn-image") == 0) {
- if (value == NULL)
- image_filename = "";
- else
- image_filename = g_strdup(value);
- } else if (strcmp (option_name, "-d") == 0 || strcmp (option_name, "--data-composition") == 0) {
- add_data_composition = TRUE;
- } else if (strcmp (option_name, "-a") == 0 || strcmp (option_name, "--audio-composition") == 0) {
- add_audio_composition = TRUE;
- } else if (strcmp (option_name, "-b") == 0 || strcmp (option_name, "--blank") == 0) {
- blank = TRUE;
- } else {
- g_set_error (error, 0, G_OPTION_ERROR_FAILED, "Invalid command line option. Please report, this is a bug.");
- return FALSE;
- }
- return TRUE;
-}
-
-/* globals */
-static int window_counter = 0;
-
+/* public functions */
void
xfburn_main_enter_window ()
{
@@ -137,7 +123,46 @@
window_counter = -42;
}
+const gchar *
+xfburn_main_get_initial_dir ()
+{
+ if (initial_dir)
+ return initial_dir;
+ else
+ return xfce_get_homedir ();
+}
+
+/* private functions */
+
+static gboolean parse_option (const gchar *option_name, const gchar *value,
+ gpointer data, GError **error)
+{
+ if (strcmp (option_name, "-i") == 0 || strcmp (option_name, "--burn-image") == 0) {
+ if (value == NULL)
+ image_filename = "";
+ else
+ image_filename = g_strdup(value);
+ } else if (strcmp (option_name, "-d") == 0 || strcmp (option_name, "--data-composition") == 0) {
+ add_data_composition = TRUE;
+ } else if (strcmp (option_name, "-a") == 0 || strcmp (option_name, "--audio-composition") == 0) {
+ add_audio_composition = TRUE;
+ } else if (strcmp (option_name, "-b") == 0 || strcmp (option_name, "--blank") == 0) {
+ blank = TRUE;
+ } else if (strcmp (option_name, "-D") == 0 || strcmp (option_name, "--directory") == 0) {
+ if (value == NULL)
+ initial_dir = g_get_current_dir ();
+ else
+ initial_dir = g_strdup(value);
+ } else {
+ g_set_error (error, 0, G_OPTION_ERROR_FAILED, "Invalid command line option. Please report, this is a bug.");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
void
print_available_transcoders ()
{
Modified: xfburn/trunk/xfburn/xfburn-main.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-main.h 2008-11-11 03:12:19 UTC (rev 6058)
+++ xfburn/trunk/xfburn/xfburn-main.h 2008-11-11 03:26:19 UTC (rev 6059)
@@ -28,6 +28,7 @@
void xfburn_main_leave_window ();
void xfburn_main_enter_window ();
+const gchar *xfburn_main_get_initial_dir ();
G_END_DECLS
#endif /* __XFBURN_MAIN_H__ */
More information about the Goodies-commits
mailing list