aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-11-27 01:58:50 +0800
committerChristian Persch <chpe@src.gnome.org>2003-11-27 01:58:50 +0800
commited7795be783b4f49314834b9c71813ce37f17280 (patch)
treeb00e0f526fe87bca28205ba05376e02f4a56843b /src
parenta80d75f2179aba2078b0d042fec4c24b4e01f729 (diff)
downloadgsoc2013-epiphany-ed7795be783b4f49314834b9c71813ce37f17280.tar
gsoc2013-epiphany-ed7795be783b4f49314834b9c71813ce37f17280.tar.gz
gsoc2013-epiphany-ed7795be783b4f49314834b9c71813ce37f17280.tar.bz2
gsoc2013-epiphany-ed7795be783b4f49314834b9c71813ce37f17280.tar.lz
gsoc2013-epiphany-ed7795be783b4f49314834b9c71813ce37f17280.tar.xz
gsoc2013-epiphany-ed7795be783b4f49314834b9c71813ce37f17280.tar.zst
gsoc2013-epiphany-ed7795be783b4f49314834b9c71813ce37f17280.zip
Make PDM dialogue a singleton.
2003-11-26 Christian Persch <chpe@cvs.gnome.org> * src/ephy-shell.c: (ephy_shell_init), (ephy_shell_finalize), (ephy_shell_get_history_window), (ephy_shell_get_pdm_dialog): * src/ephy-shell.h: * src/pdm-dialog.c: (pdm_dialog_response_cb): * src/pdm-dialog.h: * src/window-commands.c: (window_cmd_edit_personal_data): Make PDM dialogue a singleton.
Diffstat (limited to 'src')
-rw-r--r--src/ephy-shell.c23
-rw-r--r--src/ephy-shell.h2
-rwxr-xr-xsrc/pdm-dialog.c8
-rw-r--r--src/pdm-dialog.h8
-rw-r--r--src/window-commands.c12
5 files changed, 34 insertions, 19 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index a0d14b4f6..a759d0133 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -32,6 +32,7 @@
#include "ephy-bookmarks-import.h"
#include "ephy-bookmarks-editor.h"
#include "ephy-history-window.h"
+#include "pdm-dialog.h"
#include "ephy-debug.h"
#include "ephy-extensions-manager.h"
#include "toolbar.h"
@@ -71,6 +72,7 @@ struct EphyShellPrivate
EphyExtensionsManager *extensions_manager;
GtkWidget *bme;
GtkWidget *history_window;
+ GObject *pdm_dialog;
GList *del_on_exit;
guint server_timeout;
};
@@ -205,6 +207,7 @@ ephy_shell_init (EphyShell *gs)
gs->priv->bookmarks = NULL;
gs->priv->bme = NULL;
gs->priv->history_window = NULL;
+ gs->priv->pdm_dialog = NULL;
gs->priv->toolbars_model = NULL;
gs->priv->fs_toolbars_model = NULL;
gs->priv->extensions_manager = NULL;
@@ -494,6 +497,12 @@ ephy_shell_finalize (GObject *object)
gtk_widget_destroy (GTK_WIDGET (gs->priv->history_window));
}
+ LOG ("Unref PDM Dialog")
+ if (gs->priv->pdm_dialog)
+ {
+ g_object_unref (gs->priv->pdm_dialog);
+ }
+
LOG ("Unref bookmarks")
if (gs->priv->bookmarks)
{
@@ -787,6 +796,20 @@ ephy_shell_get_history_window (EphyShell *gs)
return gs->priv->history_window;
}
+GObject *
+ephy_shell_get_pdm_dialog (EphyShell *shell)
+{
+ if (shell->priv->pdm_dialog == NULL)
+ {
+ shell->priv->pdm_dialog = g_object_new (EPHY_TYPE_PDM_DIALOG, NULL);
+
+ g_object_add_weak_pointer (shell->priv->pdm_dialog,
+ (gpointer *) &shell->priv->pdm_dialog);
+ }
+
+ return shell->priv->pdm_dialog;
+}
+
void
ephy_shell_delete_on_exit (EphyShell *gs, const char *path)
{
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index d086beb4d..219942f41 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -135,6 +135,8 @@ GtkWidget *ephy_shell_get_bookmarks_editor (EphyShell *gs);
GtkWidget *ephy_shell_get_history_window (EphyShell *gs);
+GObject *ephy_shell_get_pdm_dialog (EphyShell *shell);
+
void ephy_shell_delete_on_exit (EphyShell *gs,
const char *path);
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index 137da4837..d1534de15 100755
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -1000,11 +1000,3 @@ pdm_dialog_response_cb (GtkDialog *widget,
break;
}
}
-
-EphyDialog *
-pdm_dialog_new (GtkWidget *window)
-{
- return EPHY_DIALOG (g_object_new (EPHY_TYPE_PDM_DIALOG,
- "ParentWindow", window,
- NULL));
-}
diff --git a/src/pdm-dialog.h b/src/pdm-dialog.h
index d476c714c..9dd7a3183 100644
--- a/src/pdm-dialog.h
+++ b/src/pdm-dialog.h
@@ -34,9 +34,9 @@ G_BEGIN_DECLS
#define EPHY_IS_PDM_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_PDM_DIALOG))
#define EPHY_PDM_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_PDM_DIALOG, PdmDialogClass))
-typedef struct PdmDialog PdmDialog;
-typedef struct PdmDialogClass PdmDialogClass;
-typedef struct PdmDialogPrivate PdmDialogPrivate;
+typedef struct PdmDialog PdmDialog;
+typedef struct PdmDialogClass PdmDialogClass;
+typedef struct PdmDialogPrivate PdmDialogPrivate;
struct PdmDialog
{
@@ -53,8 +53,6 @@ struct PdmDialogClass
GType pdm_dialog_get_type (void);
-EphyDialog *pdm_dialog_new (GtkWidget *window);
-
G_END_DECLS
#endif
diff --git a/src/window-commands.c b/src/window-commands.c
index f545747fb..b86db7377 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001, 2002 Marco Pesenti Gritti
+ * Copyright (C) 2000-2003 Marco Pesenti Gritti
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@
#include "print-dialog.h"
#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
-#include "pdm-dialog.h"
+#include "ephy-dialog.h"
#include "ephy-bookmarks-editor.h"
#include "ephy-history-window.h"
#include "ephy-new-bookmark.h"
@@ -46,16 +46,16 @@
#include "egg-editable-toolbar.h"
#include "egg-toolbar-editor.h"
-#include <glib.h>
#include <string.h>
+#include <glib.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
-#include <glib/gi18n.h>
-#include <libgnomeui/gnome-about.h>
#include <libgnomeui/gnome-stock-icons.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <gtk/gtkeditable.h>
#include <gtk/gtktoggleaction.h>
+#include <libgnomeui/gnome-about.h>
+#include <glib/gi18n.h>
enum
{
@@ -796,7 +796,7 @@ window_cmd_edit_personal_data (GtkAction *action,
{
EphyDialog *dialog;
- dialog = pdm_dialog_new (GTK_WIDGET(window));
+ dialog = EPHY_DIALOG (ephy_shell_get_pdm_dialog (ephy_shell));
ephy_dialog_show (dialog);
}