[easytag/wip/application-window: 51/54] Remove global INIT_DIRECTORY variable
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag/wip/application-window: 51/54] Remove global INIT_DIRECTORY variable
- Date: Thu, 4 Sep 2014 17:37:48 +0000 (UTC)
commit 12ae122577bc1267382c33c9c0296b7b82be4dea
Author: David King <amigadave amigadave com>
Date: Wed Sep 3 18:01:41 2014 +0100
Remove global INIT_DIRECTORY variable
Replace a global variable with a private variable in EtApplication.
src/application.c | 20 ++++++++++++++++----
src/easytag.h | 2 --
src/main.c | 3 ---
3 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/src/application.c b/src/application.c
index a20788f..e88074b 100644
--- a/src/application.c
+++ b/src/application.c
@@ -37,6 +37,7 @@ G_DEFINE_TYPE (EtApplication, et_application, GTK_TYPE_APPLICATION)
struct _EtApplicationPrivate
{
guint idle_handler;
+ gchar *init_directory;
};
static const GOptionEntry entries[] =
@@ -113,10 +114,10 @@ on_idle_init (EtApplication *self)
NULL);
}
- if (INIT_DIRECTORY)
+ if (priv->init_directory)
{
et_application_window_select_dir (ET_APPLICATION_WINDOW (MainWindow),
- INIT_DIRECTORY);
+ priv->init_directory);
}
else
{
@@ -389,6 +390,7 @@ et_application_open (GApplication *self,
gint n_files,
const gchar *hint)
{
+ EtApplicationPrivate *priv;
GList *windows;
gboolean activated;
GFile *arg;
@@ -399,6 +401,8 @@ et_application_open (GApplication *self,
gchar *path;
gchar *path_utf8;
+ priv = et_application_get_instance_private (ET_APPLICATION (self));
+
windows = gtk_application_get_windows (GTK_APPLICATION (self));
activated = windows ? TRUE : FALSE;
@@ -444,7 +448,7 @@ et_application_open (GApplication *self,
}
else
{
- INIT_DIRECTORY = path;
+ priv->init_directory = path;
}
g_free (path_utf8);
@@ -471,7 +475,7 @@ et_application_open (GApplication *self,
}
else
{
- INIT_DIRECTORY = g_file_get_path (parent);
+ priv->init_directory = g_file_get_path (parent);
}
g_object_unref (parent);
@@ -562,6 +566,14 @@ et_application_dispose (GObject *object)
static void
et_application_finalize (GObject *object)
{
+ EtApplication *self;
+ EtApplicationPrivate *priv;
+
+ self = ET_APPLICATION (object);
+ priv = et_application_get_instance_private (self);
+
+ g_free (priv->init_directory);
+
G_OBJECT_CLASS (et_application_parent_class)->finalize (object);
}
diff --git a/src/easytag.h b/src/easytag.h
index 0cfe83d..4f0936d 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -41,8 +41,6 @@ gboolean Main_Stop_Button_Pressed;
GtkWidget *MainWindow;
-gchar *INIT_DIRECTORY;
-
#ifndef errno
extern int errno;
#endif
diff --git a/src/main.c b/src/main.c
index 6a7632e..486210a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,7 +21,6 @@
#include <glib/gi18n.h>
#include "application.h"
-#include "easytag.h"
int
main (int argc, char *argv[])
@@ -35,8 +34,6 @@ main (int argc, char *argv[])
bind_textdomain_codeset (PACKAGE_TARNAME, "UTF-8");
#endif /* ENABLE_NLS */
- INIT_DIRECTORY = NULL;
-
#if !GLIB_CHECK_VERSION (2, 35, 1)
g_type_init ();
#endif /* !GLIB_CHECK_VERSION (2, 35, 1) */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]