aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ephy-nautilus-view.c16
-rw-r--r--src/ephy-nautilus-view.h37
-rw-r--r--src/ephy-shell.c294
-rw-r--r--src/ephy-shell.h47
-rw-r--r--src/ephy-window.c52
-rw-r--r--src/ephy-window.h6
-rw-r--r--src/language-editor.c4
-rw-r--r--src/language-editor.h2
-rwxr-xr-xsrc/pdm-dialog.c15
-rw-r--r--src/prefs-dialog.c41
-rw-r--r--src/window-commands.c29
-rw-r--r--src/window-commands.h16
12 files changed, 270 insertions, 289 deletions
diff --git a/src/ephy-nautilus-view.c b/src/ephy-nautilus-view.c
index 84351e0eb..191e9fccb 100644
--- a/src/ephy-nautilus-view.c
+++ b/src/ephy-nautilus-view.c
@@ -20,8 +20,10 @@
* $Id$
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
-#include <config.h>
#include <libgnome/gnome-macros.h>
#include <bonobo/bonobo-zoomable.h>
#include <bonobo/bonobo-ui-util.h>
@@ -264,15 +266,10 @@ ephy_nautilus_view_instance_init (EphyNautilusView *view)
bonobo_ui_component_add_verb_list_with_data (p->popup_ui, ephy_popup_verbs, p->popup);
}
-/**
- * Returns a new EphyNautilusView as a BonoboObject
- **/
BonoboObject *
-ephy_nautilus_view_new_component (EphyShell *gs)
+ephy_nautilus_view_new_component (EphyShell *shell)
{
- EphyNautilusView *view;
- view = EPHY_NAUTILUS_VIEW (g_object_new (EPHY_TYPE_NAUTILUS_VIEW, NULL));
- return BONOBO_OBJECT (view);
+ return BONOBO_OBJECT (g_object_new (EPHY_TYPE_NAUTILUS_VIEW, NULL));
}
static void
@@ -545,11 +542,10 @@ gnv_cmd_file_print (BonoboUIComponent *uic,
EphyDialog *dialog;
EphyNautilusViewPrivate *p = view->priv;
- dialog = print_dialog_new (p->embed, NULL);
+ dialog = ephy_print_dialog_new (NULL, p->embed, FALSE);
ephy_dialog_set_modal (dialog, TRUE);
ephy_dialog_show (dialog);
-
}
static void
diff --git a/src/ephy-nautilus-view.h b/src/ephy-nautilus-view.h
index 0a9fa5637..c8139b931 100644
--- a/src/ephy-nautilus-view.h
+++ b/src/ephy-nautilus-view.h
@@ -33,9 +33,9 @@ G_BEGIN_DECLS
#define EPHY_IS_NAUTILUS_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_NAUTILUS_VIEW))
#define EPHY_NAUTILUS_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_NAUTILUS_VIEW, EphyNautilusViewClass))
-typedef struct EphyNautilusView EphyNautilusView;
-typedef struct EphyNautilusViewClass EphyNautilusViewClass;
-typedef struct EphyNautilusViewPrivate EphyNautilusViewPrivate;
+typedef struct EphyNautilusView EphyNautilusView;
+typedef struct EphyNautilusViewClass EphyNautilusViewClass;
+typedef struct EphyNautilusViewPrivate EphyNautilusViewPrivate;
struct EphyNautilusView
{
@@ -50,36 +50,9 @@ struct EphyNautilusViewClass
NautilusViewClass parent_class;
};
+GType ephy_nautilus_view_get_type (void);
-GType ephy_nautilus_view_get_type (void);
-BonoboObject * ephy_nautilus_view_new_component (EphyShell *gs);
-
-/* old public methods, probably all of them are going to be killed */
-
-void
-ephy_nautilus_view_set_title (EphyNautilusView *view,
- const gchar *title);
-void
-ephy_nautilus_view_set_location (EphyNautilusView *view,
- const gchar *uri);
-void
-ephy_nautilus_view_set_statusbar (EphyNautilusView *view,
- const gchar *message);
-void
-ephy_nautilus_view_report_load_underway (EphyNautilusView *view);
-
-void
-ephy_nautilus_view_report_load_complete (EphyNautilusView *view);
-
-void
-ephy_nautilus_view_report_load_progress (EphyNautilusView *view,
- double value);
-void
-ephy_nautilus_view_report_zoom (EphyNautilusView *view,
- gint level);
-
-void ephy_nautilus_view_open_in_new_window (EphyNautilusView *view,
- const gchar *url);
+BonoboObject *ephy_nautilus_view_new_component (EphyShell *shell);
G_END_DECLS
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index abe7fb5bc..12a23dbc8 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -41,6 +41,7 @@
#include "downloader-view.h"
#include "ephy-toolbars-model.h"
#include "ephy-automation.h"
+#include "print-dialog.h"
#include <string.h>
#include <bonobo/bonobo-main.h>
@@ -75,20 +76,18 @@ struct EphyShellPrivate
GtkWidget *history_window;
GObject *pdm_dialog;
GObject *prefs_dialog;
+ GObject *print_setup_dialog;
GList *del_on_exit;
guint server_timeout;
};
-static void
-ephy_shell_class_init (EphyShellClass *klass);
-static void
-ephy_shell_init (EphyShell *gs);
-static void
-ephy_shell_finalize (GObject *object);
+EphyShell *ephy_shell = NULL;
-static GObjectClass *parent_class = NULL;
+static void ephy_shell_class_init (EphyShellClass *klass);
+static void ephy_shell_init (EphyShell *shell);
+static void ephy_shell_finalize (GObject *object);
-EphyShell *ephy_shell;
+static GObjectClass *parent_class = NULL;
GQuark
ephy_shell_error_quark (void)
@@ -106,63 +105,47 @@ ephy_shell_error_quark (void)
GType
ephy_shell_get_type (void)
{
- static GType ephy_shell_type = 0;
-
- if (ephy_shell_type == 0)
- {
- static const GTypeInfo our_info =
- {
- sizeof (EphyShellClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ephy_shell_class_init,
- NULL,
- NULL, /* class_data */
- sizeof (EphyShell),
- 0, /* n_preallocs */
- (GInstanceInitFunc) ephy_shell_init
- };
-
- ephy_shell_type = g_type_register_static (EPHY_TYPE_EMBED_SHELL,
- "EphyShell",
- &our_info, 0);
- }
-
- return ephy_shell_type;
+ static GType type = 0;
+ if (type == 0)
+ {
+ static const GTypeInfo our_info =
+ {
+ sizeof (EphyShellClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ephy_shell_class_init,
+ NULL,
+ NULL, /* class_data */
+ sizeof (EphyShell),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ephy_shell_init
+ };
+
+ type = g_type_register_static (EPHY_TYPE_EMBED_SHELL,
+ "EphyShell",
+ &our_info, 0);
+ }
+
+ return type;
}
static void
ephy_shell_class_init (EphyShellClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
+ parent_class = g_type_class_peek_parent (klass);
- object_class->finalize = ephy_shell_finalize;
+ object_class->finalize = ephy_shell_finalize;
g_type_class_add_private (object_class, sizeof(EphyShellPrivate));
}
-#ifdef ENABLE_NAUTILUS_VIEW
-
-static BonoboObject *
-ephy_nautilus_view_new (EphyShell *gs)
-{
- EphyNautilusView *view;
-
- view = EPHY_NAUTILUS_VIEW
- (ephy_nautilus_view_new_component (gs));
-
- return BONOBO_OBJECT (view);
-}
-
-#endif
-
static BonoboObject *
ephy_automation_factory_cb (BonoboGenericFactory *this_factory,
const char *iid,
- EphyShell *es)
+ EphyShell *shell)
{
if (strcmp (iid, AUTOMATION_IID) == 0)
{
@@ -171,7 +154,7 @@ ephy_automation_factory_cb (BonoboGenericFactory *this_factory,
#ifdef ENABLE_NAUTILUS_VIEW
else if (strcmp (iid, EPHY_NAUTILUS_VIEW_IID) == 0)
{
- return ephy_nautilus_view_new (es);
+ return BONOBO_OBJECT (ephy_nautilus_view_new_component (shell));
}
#endif
@@ -180,9 +163,8 @@ ephy_automation_factory_cb (BonoboGenericFactory *this_factory,
return NULL;
}
-
static BonoboGenericFactory *
-ephy_automation_factory_new (EphyShell *es)
+ephy_automation_factory_new (EphyShell *shell)
{
BonoboGenericFactory *factory;
GClosure *factory_closure;
@@ -190,7 +172,7 @@ ephy_automation_factory_new (EphyShell *es)
factory = g_object_new (bonobo_generic_factory_get_type (), NULL);
factory_closure = g_cclosure_new
- (G_CALLBACK (ephy_automation_factory_cb), es, NULL);
+ (G_CALLBACK (ephy_automation_factory_cb), shell, NULL);
bonobo_generic_factory_construct_noreg
(factory, AUTOMATION_FACTORY_IID, factory_closure);
@@ -199,28 +181,31 @@ ephy_automation_factory_new (EphyShell *es)
}
static void
-ephy_shell_init (EphyShell *gs)
+ephy_shell_init (EphyShell *shell)
{
EphyShell **ptr = &ephy_shell;
- gs->priv = EPHY_SHELL_GET_PRIVATE (gs);
+ shell->priv = EPHY_SHELL_GET_PRIVATE (shell);
- gs->priv->session = NULL;
- 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;
- gs->priv->server_timeout = 0;
+ shell->priv->session = NULL;
+ shell->priv->bookmarks = NULL;
+ shell->priv->bme = NULL;
+ shell->priv->history_window = NULL;
+ shell->priv->pdm_dialog = NULL;
+ shell->priv->print_setup_dialog = NULL;
+ shell->priv->toolbars_model = NULL;
+ shell->priv->fs_toolbars_model = NULL;
+ shell->priv->extensions_manager = NULL;
+ shell->priv->server_timeout = 0;
- ephy_shell = gs;
+ /* globally accessible singleton */
+ g_assert (ephy_shell == NULL);
+ ephy_shell = shell;
g_object_add_weak_pointer (G_OBJECT(ephy_shell),
(gpointer *)ptr);
/* Instantiate the automation factory */
- gs->priv->automation_factory = ephy_automation_factory_new (gs);
+ shell->priv->automation_factory = ephy_automation_factory_new (shell);
}
static char *
@@ -271,9 +256,9 @@ open_urls (GNOME_EphyAutomation automation,
}
static gboolean
-server_timeout (EphyShell *gs)
+server_timeout (EphyShell *shell)
{
- g_object_unref (gs);
+ g_object_unref (shell);
return FALSE;
}
@@ -343,7 +328,7 @@ gnome_session_init (EphyShell *shell)
}
gboolean
-ephy_shell_startup (EphyShell *gs,
+ephy_shell_startup (EphyShell *shell,
EphyShellStartupFlags flags,
const char **args,
const char *string_arg,
@@ -358,7 +343,7 @@ ephy_shell_startup (EphyShell *gs,
CORBA_exception_init (&ev);
result = bonobo_activation_register_active_server
- (AUTOMATION_FACTORY_IID, BONOBO_OBJREF (gs->priv->automation_factory), NULL);
+ (AUTOMATION_FACTORY_IID, BONOBO_OBJREF (shell->priv->automation_factory), NULL);
switch (result)
{
@@ -386,15 +371,15 @@ ephy_shell_startup (EphyShell *gs,
if (flags & EPHY_SHELL_STARTUP_SERVER)
{
- g_object_ref (gs);
- gs->priv->server_timeout = g_timeout_add
- (SERVER_TIMEOUT, (GSourceFunc)server_timeout, gs);
+ g_object_ref (shell);
+ shell->priv->server_timeout = g_timeout_add
+ (SERVER_TIMEOUT, (GSourceFunc)server_timeout, shell);
}
else if (result == Bonobo_ACTIVATION_REG_SUCCESS ||
- result == Bonobo_ACTIVATION_REG_ALREADY_ACTIVE)
+ result == Bonobo_ACTIVATION_REG_ALREADY_ACTIVE)
{
automation = bonobo_activation_activate_from_id (AUTOMATION_IID,
- 0, NULL, &ev);
+ 0, NULL, &ev);
if (CORBA_Object_is_nil (automation, &ev))
{
g_set_error (error, EPHY_SHELL_ERROR,
@@ -437,7 +422,7 @@ ephy_shell_startup (EphyShell *gs,
bonobo_object_release_unref (automation, &ev);
}
- gnome_session_init (gs);
+ gnome_session_init (shell);
}
CORBA_exception_free (&ev);
@@ -458,73 +443,79 @@ delete_files (GList *l)
static void
ephy_shell_finalize (GObject *object)
{
- EphyShell *gs = EPHY_SHELL (object);
+ EphyShell *shell = EPHY_SHELL (object);
g_assert (ephy_shell == NULL);
- if (gs->priv->server_timeout > 0)
+ if (shell->priv->server_timeout > 0)
{
- g_source_remove (gs->priv->server_timeout);
+ g_source_remove (shell->priv->server_timeout);
}
/* this will unload the extensions */
LOG ("Unref extension manager")
- g_object_unref (gs->priv->extensions_manager);
+ g_object_unref (shell->priv->extensions_manager);
- delete_files (gs->priv->del_on_exit);
- g_list_foreach (gs->priv->del_on_exit, (GFunc)g_free, NULL);
- g_list_free (gs->priv->del_on_exit);
+ delete_files (shell->priv->del_on_exit);
+ g_list_foreach (shell->priv->del_on_exit, (GFunc)g_free, NULL);
+ g_list_free (shell->priv->del_on_exit);
LOG ("Unref toolbars model")
- if (gs->priv->toolbars_model)
+ if (shell->priv->toolbars_model)
{
- g_object_unref (G_OBJECT (gs->priv->toolbars_model));
+ g_object_unref (G_OBJECT (shell->priv->toolbars_model));
}
LOG ("Unref fullscreen toolbars model")
- if (gs->priv->fs_toolbars_model)
+ if (shell->priv->fs_toolbars_model)
{
- g_object_unref (G_OBJECT (gs->priv->fs_toolbars_model));
+ g_object_unref (G_OBJECT (shell->priv->fs_toolbars_model));
}
LOG ("Unref Bookmarks Editor");
- if (gs->priv->bme)
+ if (shell->priv->bme)
{
- gtk_widget_destroy (GTK_WIDGET (gs->priv->bme));
+ gtk_widget_destroy (GTK_WIDGET (shell->priv->bme));
}
LOG ("Unref History Window");
- if (gs->priv->history_window)
+ if (shell->priv->history_window)
{
- gtk_widget_destroy (GTK_WIDGET (gs->priv->history_window));
+ gtk_widget_destroy (GTK_WIDGET (shell->priv->history_window));
}
LOG ("Unref PDM Dialog")
- if (gs->priv->pdm_dialog)
+ if (shell->priv->pdm_dialog)
{
- g_object_unref (gs->priv->pdm_dialog);
+ g_object_unref (shell->priv->pdm_dialog);
}
LOG ("Unref prefs dialog")
- if (gs->priv->prefs_dialog)
+ if (shell->priv->prefs_dialog)
+ {
+ g_object_unref (shell->priv->prefs_dialog);
+ }
+
+ LOG ("Unref print setup dialog")
+ if (shell->priv->print_setup_dialog)
{
- g_object_unref (gs->priv->prefs_dialog);
+ g_object_unref (shell->priv->print_setup_dialog);
}
LOG ("Unref bookmarks")
- if (gs->priv->bookmarks)
+ if (shell->priv->bookmarks)
{
- g_object_unref (gs->priv->bookmarks);
+ g_object_unref (shell->priv->bookmarks);
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
- if (gs->priv->automation_factory)
+ if (shell->priv->automation_factory)
{
bonobo_activation_unregister_active_server
- (AUTOMATION_FACTORY_IID, BONOBO_OBJREF (gs->priv->automation_factory));
+ (AUTOMATION_FACTORY_IID, BONOBO_OBJREF (shell->priv->automation_factory));
- bonobo_object_unref (gs->priv->automation_factory);
+ bonobo_object_unref (shell->priv->automation_factory);
}
LOG ("Ephy shell finalized")
@@ -607,7 +598,7 @@ ephy_shell_new_tab (EphyShell *shell,
}
grouped = ((flags & EPHY_NEW_TAB_OPEN_PAGE ||
- flags & EPHY_NEW_TAB_APPEND_GROUPED)) &&
+ flags & EPHY_NEW_TAB_APPEND_GROUPED)) &&
!(flags & EPHY_NEW_TAB_APPEND_LAST);
if ((flags & EPHY_NEW_TAB_APPEND_AFTER) && previous_embed != NULL)
@@ -647,81 +638,81 @@ ephy_shell_new_tab (EphyShell *shell,
gtk_window_fullscreen (GTK_WINDOW (window));
}
- return tab;
+ return tab;
}
/**
* ephy_shell_get_session:
- * @gs: a #EphyShell
+ * @shell: the #EphyShell
*
* Returns current session.
*
* Return value: the current session.
**/
GObject *
-ephy_shell_get_session (EphyShell *gs)
+ephy_shell_get_session (EphyShell *shell)
{
- g_return_val_if_fail (EPHY_IS_SHELL (gs), NULL);
+ g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
- if (gs->priv->session == NULL)
+ if (shell->priv->session == NULL)
{
EphyExtensionsManager *manager;
manager = EPHY_EXTENSIONS_MANAGER
- (ephy_shell_get_extensions_manager (gs));
+ (ephy_shell_get_extensions_manager (shell));
/* Instantiate internal extensions */
- gs->priv->session =
+ shell->priv->session =
EPHY_SESSION (ephy_extensions_manager_add
(manager, EPHY_TYPE_SESSION));
}
- return G_OBJECT (gs->priv->session);
+ return G_OBJECT (shell->priv->session);
}
EphyBookmarks *
-ephy_shell_get_bookmarks (EphyShell *gs)
+ephy_shell_get_bookmarks (EphyShell *shell)
{
- if (gs->priv->bookmarks == NULL)
+ if (shell->priv->bookmarks == NULL)
{
- gs->priv->bookmarks = ephy_bookmarks_new ();
+ shell->priv->bookmarks = ephy_bookmarks_new ();
}
- return gs->priv->bookmarks;
+ return shell->priv->bookmarks;
}
GObject *
-ephy_shell_get_toolbars_model (EphyShell *gs, gboolean fullscreen)
+ephy_shell_get_toolbars_model (EphyShell *shell, gboolean fullscreen)
{
if (fullscreen)
{
- if (gs->priv->fs_toolbars_model == NULL)
+ if (shell->priv->fs_toolbars_model == NULL)
{
const char *xml;
- gs->priv->fs_toolbars_model = egg_toolbars_model_new ();
+ shell->priv->fs_toolbars_model = egg_toolbars_model_new ();
xml = ephy_file ("epiphany-fs-toolbar.xml");
- egg_toolbars_model_load (gs->priv->fs_toolbars_model, xml);
+ egg_toolbars_model_load (shell->priv->fs_toolbars_model, xml);
}
- return G_OBJECT (gs->priv->fs_toolbars_model);
+ return G_OBJECT (shell->priv->fs_toolbars_model);
}
else
{
- if (gs->priv->toolbars_model == NULL)
+ if (shell->priv->toolbars_model == NULL)
{
EphyBookmarks *bookmarks;
- bookmarks = ephy_shell_get_bookmarks (gs);
+ bookmarks = ephy_shell_get_bookmarks (shell);
- gs->priv->toolbars_model = ephy_toolbars_model_new (bookmarks);
+ shell->priv->toolbars_model = ephy_toolbars_model_new (bookmarks);
g_object_set (bookmarks, "toolbars_model",
- gs->priv->toolbars_model, NULL);
+ shell->priv->toolbars_model, NULL);
}
- return G_OBJECT (gs->priv->toolbars_model);
+ return G_OBJECT (shell->priv->toolbars_model);
}
}
@@ -764,44 +755,44 @@ toolwindow_hide_cb (GtkWidget *widget, EphyShell *es)
}
GtkWidget *
-ephy_shell_get_bookmarks_editor (EphyShell *gs)
+ephy_shell_get_bookmarks_editor (EphyShell *shell)
{
EphyBookmarks *bookmarks;
- if (gs->priv->bme == NULL)
+ if (shell->priv->bme == NULL)
{
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
g_assert (bookmarks != NULL);
- gs->priv->bme = ephy_bookmarks_editor_new (bookmarks);
+ shell->priv->bme = ephy_bookmarks_editor_new (bookmarks);
- g_signal_connect (gs->priv->bme, "show",
- G_CALLBACK (toolwindow_show_cb), gs);
- g_signal_connect (gs->priv->bme, "hide",
- G_CALLBACK (toolwindow_hide_cb), gs);
+ g_signal_connect (shell->priv->bme, "show",
+ G_CALLBACK (toolwindow_show_cb), shell);
+ g_signal_connect (shell->priv->bme, "hide",
+ G_CALLBACK (toolwindow_hide_cb), shell);
}
- return gs->priv->bme;
+ return shell->priv->bme;
}
GtkWidget *
-ephy_shell_get_history_window (EphyShell *gs)
+ephy_shell_get_history_window (EphyShell *shell)
{
EphyHistory *history;
- if (gs->priv->history_window == NULL)
+ if (shell->priv->history_window == NULL)
{
history = ephy_embed_shell_get_global_history
(EPHY_EMBED_SHELL (ephy_shell));
g_assert (history != NULL);
- gs->priv->history_window = ephy_history_window_new (history);
+ shell->priv->history_window = ephy_history_window_new (history);
- g_signal_connect (gs->priv->history_window, "show",
- G_CALLBACK (toolwindow_show_cb), gs);
- g_signal_connect (gs->priv->history_window, "hide",
- G_CALLBACK (toolwindow_hide_cb), gs);
+ g_signal_connect (shell->priv->history_window, "show",
+ G_CALLBACK (toolwindow_show_cb), shell);
+ g_signal_connect (shell->priv->history_window, "hide",
+ G_CALLBACK (toolwindow_hide_cb), shell);
}
- return gs->priv->history_window;
+ return shell->priv->history_window;
}
GObject *
@@ -832,10 +823,23 @@ ephy_shell_get_prefs_dialog (EphyShell *shell)
return shell->priv->prefs_dialog;
}
-void
-ephy_shell_delete_on_exit (EphyShell *gs, const char *path)
+GObject *
+ephy_shell_get_print_setup_dialog (EphyShell *shell)
{
- gs->priv->del_on_exit = g_list_append (gs->priv->del_on_exit,
- g_strdup (path));
+ if (shell->priv->print_setup_dialog == NULL)
+ {
+ shell->priv->print_setup_dialog = G_OBJECT (ephy_print_setup_dialog_new ());
+
+ g_object_add_weak_pointer (shell->priv->print_setup_dialog,
+ (gpointer *) &shell->priv->print_setup_dialog);
+ }
+
+ return shell->priv->print_setup_dialog;
}
+void
+ephy_shell_delete_on_exit (EphyShell *shell, const char *path)
+{
+ shell->priv->del_on_exit = g_list_append (shell->priv->del_on_exit,
+ g_strdup (path));
+}
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index c114d415f..a93d318c7 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -38,12 +38,7 @@ G_BEGIN_DECLS
#define EPHY_IS_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EPHY_TYPE_SHELL))
#define EPHY_SHELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EPHY_TYPE_SHELL, EphyShellClass))
-/* FIXME: huh? */
-#ifndef EPHY_SHELL_TYPE_DEF
typedef struct EphyShell EphyShell;
-#define EPHY_SHELL_TYPE_DEF
-#endif
-
typedef struct EphyShellClass EphyShellClass;
typedef struct EphyShellPrivate EphyShellPrivate;
@@ -60,14 +55,14 @@ typedef enum
typedef enum
{
- EPHY_SHELL_STARTUP_TABS = 1 << 0,
- EPHY_SHELL_STARTUP_EXISTING_WINDOW = 1 << 2,
- EPHY_SHELL_STARTUP_FULLSCREEN = 1 << 3,
- EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR = 1 << 4,
- EPHY_SHELL_STARTUP_SESSION = 1 << 5,
- EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS = 1 << 6,
- EPHY_SHELL_STARTUP_ADD_BOOKMARK = 1 << 7,
- EPHY_SHELL_STARTUP_SERVER = 1 << 8
+ EPHY_SHELL_STARTUP_TABS = 1 << 0,
+ EPHY_SHELL_STARTUP_EXISTING_WINDOW = 1 << 2,
+ EPHY_SHELL_STARTUP_FULLSCREEN = 1 << 3,
+ EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR = 1 << 4,
+ EPHY_SHELL_STARTUP_SESSION = 1 << 5,
+ EPHY_SHELL_STARTUP_IMPORT_BOOKMARKS = 1 << 6,
+ EPHY_SHELL_STARTUP_ADD_BOOKMARK = 1 << 7,
+ EPHY_SHELL_STARTUP_SERVER = 1 << 8
} EphyShellStartupFlags;
typedef enum
@@ -102,44 +97,46 @@ struct EphyShellClass
EphyEmbedShellClass parent_class;
};
-GQuark ephy_shell_error_quark (void);
-
GType ephy_shell_get_type (void);
+GQuark ephy_shell_error_quark (void);
+
EphyShell *ephy_shell_new (void);
-gboolean ephy_shell_startup (EphyShell *gs,
+gboolean ephy_shell_startup (EphyShell *shell,
EphyShellStartupFlags flags,
const char **args,
const char *string_arg,
GError **error);
-EphyWindow *ephy_shell_get_active_window (EphyShell *gs);
+EphyWindow *ephy_shell_get_active_window (EphyShell *shell);
-EphyTab *ephy_shell_new_tab (EphyShell *shell,
+EphyTab *ephy_shell_new_tab (EphyShell *shell,
EphyWindow *parent_window,
EphyTab *previous_tab,
const char *url,
EphyNewTabFlags flags);
-GObject *ephy_shell_get_session (EphyShell *gs);
+GObject *ephy_shell_get_session (EphyShell *shell);
-EphyBookmarks *ephy_shell_get_bookmarks (EphyShell *gs);
+EphyBookmarks *ephy_shell_get_bookmarks (EphyShell *shell);
-GObject *ephy_shell_get_toolbars_model (EphyShell *gs,
+GObject *ephy_shell_get_toolbars_model (EphyShell *shell,
gboolean fullscreen);
-GObject *ephy_shell_get_extensions_manager (EphyShell *es);
+GObject *ephy_shell_get_extensions_manager (EphyShell *shell);
-GtkWidget *ephy_shell_get_bookmarks_editor (EphyShell *gs);
+GtkWidget *ephy_shell_get_bookmarks_editor (EphyShell *shell);
-GtkWidget *ephy_shell_get_history_window (EphyShell *gs);
+GtkWidget *ephy_shell_get_history_window (EphyShell *shell);
GObject *ephy_shell_get_pdm_dialog (EphyShell *shell);
GObject *ephy_shell_get_prefs_dialog (EphyShell *shell);
-void ephy_shell_delete_on_exit (EphyShell *gs,
+GObject *ephy_shell_get_print_setup_dialog (EphyShell *shell);
+
+void ephy_shell_delete_on_exit (EphyShell *shell,
const char *path);
G_END_DECLS
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 7d02e98af..073a20e4e 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -58,19 +58,14 @@
#include <gtk/gtkuimanager.h>
#include <gtk/gtktoggleaction.h>
-static void
-ephy_window_class_init (EphyWindowClass *klass);
-static void
-ephy_window_init (EphyWindow *gs);
-static void
-ephy_window_finalize (GObject *object);
-static void
-ephy_window_show (GtkWidget *widget);
-static void
-ephy_window_notebook_switch_page_cb (GtkNotebook *notebook,
- GtkNotebookPage *page,
- guint page_num,
- EphyWindow *window);
+static void ephy_window_class_init (EphyWindowClass *klass);
+static void ephy_window_init (EphyWindow *gs);
+static void ephy_window_finalize (GObject *object);
+static void ephy_window_show (GtkWidget *widget);
+static void ephy_window_notebook_switch_page_cb (GtkNotebook *notebook,
+ GtkNotebookPage *page,
+ guint page_num,
+ EphyWindow *window);
static GtkActionEntry ephy_menu_entries [] = {
@@ -97,6 +92,12 @@ static GtkActionEntry ephy_menu_entries [] = {
{ "FileSaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "<shift><control>S",
N_("Save the current page"),
G_CALLBACK (window_cmd_file_save_as) },
+ { "FilePrintSetup", NULL, N_("Print Set_up..."), NULL,
+ N_("Setup the page settings for printing"),
+ G_CALLBACK (window_cmd_file_print_setup) },
+ { "FilePrintPreview", GTK_STOCK_PRINT_PREVIEW, N_("Print Pre_view"),"<control><shift>P",
+ N_("Print preview"),
+ G_CALLBACK (window_cmd_file_print_preview) },
{ "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
N_("Print the current page"),
G_CALLBACK (window_cmd_file_print) },
@@ -1707,7 +1708,7 @@ ephy_window_set_print_preview (EphyWindow *window, gboolean enabled)
{
window->priv->is_ppview = enabled;
update_chrome (window);
- ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (window->priv->notebook), enabled);
+ ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (window->priv->notebook), !enabled);
}
GtkWidget *
@@ -1971,30 +1972,17 @@ ephy_window_find (EphyWindow *window)
ephy_dialog_show (window->priv->find_dialog);
}
-static void
-print_dialog_preview_cb (EphyDialog *dialog,
- EphyWindow *window)
-{
- window->priv->is_ppview = TRUE;
- update_chrome(window);
- ephy_notebook_set_show_tabs (EPHY_NOTEBOOK (window->priv->notebook), FALSE);
-}
-
void
ephy_window_print (EphyWindow *window)
{
- EphyDialog *dialog;
- EphyEmbed *embed;
-
if (window->priv->print_dialog == NULL)
{
+ EphyDialog *dialog;
+ EphyEmbed *embed;
+
embed = ephy_window_get_active_embed (window);
- dialog = print_dialog_new_with_parent
- (GTK_WIDGET(window), embed, NULL);
- g_signal_connect (G_OBJECT (dialog),
- "preview",
- G_CALLBACK (print_dialog_preview_cb),
- window);
+ dialog = ephy_print_dialog_new (GTK_WIDGET (window), embed, FALSE);
+
window->priv->print_dialog = dialog;
g_object_add_weak_pointer(G_OBJECT (dialog),
(gpointer *) &window->priv->print_dialog);
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 40a728fc4..e7fbf1ca5 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -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
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#ifndef EPHY_WINDOW_H
@@ -105,8 +107,6 @@ GList *ephy_window_get_tabs (EphyWindow *window);
Toolbar *ephy_window_get_toolbar (EphyWindow *window);
-/* Dialogs */
-
void ephy_window_find (EphyWindow *window);
void ephy_window_print (EphyWindow *window);
diff --git a/src/language-editor.c b/src/language-editor.c
index ba8ee0f03..bb12d7264 100644
--- a/src/language-editor.c
+++ b/src/language-editor.c
@@ -122,10 +122,10 @@ language_editor_class_init (LanguageEditorClass *klass)
parent_class = g_type_class_peek_parent (klass);
signals[CHANGED] =
- g_signal_new ("changed",
+ g_signal_new ("list-changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (LanguageEditorClass, changed),
+ G_STRUCT_OFFSET (LanguageEditorClass, list_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE,
diff --git a/src/language-editor.h b/src/language-editor.h
index ee5a62193..9b641914b 100644
--- a/src/language-editor.h
+++ b/src/language-editor.h
@@ -51,7 +51,7 @@ struct LanguageEditorClass
{
EphyDialogClass parent_class;
- void (* changed) (GSList *codes);
+ void (* list_changed) (GSList *codes);
};
GType language_editor_get_type (void);
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index 69c63b4ae..4a1a2b118 100755
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -114,15 +114,6 @@ EphyDialogProperty properties [] =
{ NULL }
};
-static const
-char *size_group [] =
-{
- "cookies_remove_button",
- "cookies_properties_button",
- "passwords_remove_button"
-};
-const guint n_size_group = G_N_ELEMENTS (size_group);
-
static void pdm_dialog_class_init (PdmDialogClass *klass);
static void pdm_dialog_init (PdmDialog *dialog);
static void pdm_dialog_finalize (GObject *object);
@@ -804,7 +795,11 @@ pdm_dialog_init (PdmDialog *dialog)
* avoid the little jerk you get otherwise when switching pages because
* one set of buttons is wider than another.
*/
- ephy_dialog_set_size_group (EPHY_DIALOG (dialog), size_group, n_size_group);
+ ephy_dialog_set_size_group (EPHY_DIALOG (dialog),
+ properties[PROP_COOKIES_REMOVE].id,
+ properties[PROP_COOKIES_PROPERTIES].id,
+ properties[PROP_PASSWORDS_REMOVE].id,
+ NULL);
cookies = g_new0 (PdmActionInfo, 1);
cookies->construct = pdm_dialog_cookies_construct;
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index d276753ac..0b4fcf45e 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -70,8 +70,6 @@ void prefs_clear_cache_button_clicked_cb (GtkWidget *button,
void prefs_dialog_response_cb (GtkDialog *widget,
gint response_id,
EphyDialog *dialog);
-void fonts_language_combo_changed_cb (GtkComboBox *combo,
- EphyDialog *dialog);
void prefs_homepage_current_button_clicked_cb (GtkWidget *button,
EphyDialog *dialog);
void prefs_homepage_blank_button_clicked_cb (GtkWidget *button,
@@ -274,15 +272,6 @@ EphyDialogProperty properties [] =
{ NULL }
};
-static const
-char *lang_size_group [] =
-{
- "language_label",
- "default_encoding_label",
- "auto_encoding_label"
-};
-
-static guint n_lang_size_group = G_N_ELEMENTS (lang_size_group);
enum
{
COL_FONTS_LANG_NAME,
@@ -426,17 +415,18 @@ setup_font_combo (EphyDialog *dialog,
ephy_dialog_set_pref (dialog, properties[prop].id, key);
}
-void
-fonts_language_combo_changed_cb (GtkComboBox *combo,
- EphyDialog *dialog)
+static void
+fonts_language_changed_cb (EphyDialog *dialog,
+ const GValue *value,
+ gpointer data)
{
- GValue value = { 0, };
const char *code;
char key[128];
int size;
- ephy_dialog_get_value (dialog, properties[FONTS_LANGUAGE_PROP].id, &value);
- code = g_value_get_string (&value);
+ code = g_value_get_string (value);
+
+ LOG ("fonts language combo changed, new code '%s'", code)
setup_font_combo (dialog, "variable", code, VARIABLE_PROP);
setup_font_combo (dialog, "monospace", code, MONOSPACE_PROP);
@@ -464,8 +454,6 @@ fonts_language_combo_changed_cb (GtkComboBox *combo,
eel_gconf_set_integer (key, default_size[FONT_SIZE_MIN]);
}
ephy_dialog_set_pref (dialog, properties[MIN_SIZE_PROP].id, key);
-
- g_value_unset (&value);
}
static void
@@ -509,9 +497,9 @@ create_fonts_language_menu (EphyDialog *dialog)
ephy_dialog_set_data_column (dialog, properties[FONTS_LANGUAGE_PROP].id, COL_FONTS_LANG_CODE);
- g_signal_connect (combo, "changed",
- G_CALLBACK (fonts_language_combo_changed_cb),
- dialog);
+ g_signal_connect (dialog, "changed::fonts_language_combo",
+ G_CALLBACK (fonts_language_changed_cb),
+ NULL);
}
static void
@@ -752,8 +740,11 @@ prefs_dialog_init (PrefsDialog *pd)
ephy_dialog_add_enum (dialog, properties[ACCEPT_COOKIES_PROP].id,
n_cookies_accept_enum, cookies_accept_enum);
- ephy_dialog_set_size_group (dialog, lang_size_group,
- n_lang_size_group);
+ ephy_dialog_set_size_group (dialog,
+ properties[LANGUAGE_LABEL_PROP].id,
+ properties[DEFAULT_ENCODING_LABEL_PROP].id,
+ properties[AUTO_ENCODING_LABEL_PROP].id,
+ NULL);
window = ephy_dialog_get_control (dialog, properties[WINDOW_PROP].id);
@@ -929,7 +920,7 @@ prefs_language_more_button_clicked_cb (GtkWidget *button,
/* FIXME: make it only modal to prefs dialogue, not to all windows */
ephy_dialog_set_modal (EPHY_DIALOG (editor), TRUE);
- g_signal_connect (editor, "changed",
+ g_signal_connect (editor, "list-changed",
G_CALLBACK (language_dialog_changed_cb),
dialog);
diff --git a/src/window-commands.c b/src/window-commands.c
index b70ca5b8f..a6975d843 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -69,6 +69,35 @@ window_cmd_edit_find (GtkAction *action,
}
void
+window_cmd_file_print_setup (GtkAction *action,
+ EphyWindow *window)
+{
+ EphyDialog *dialog;
+
+ dialog = EPHY_DIALOG (ephy_shell_get_print_setup_dialog (ephy_shell));
+
+ ephy_dialog_show (dialog);
+}
+
+void
+window_cmd_file_print_preview (GtkAction *action,
+ EphyWindow *window)
+{
+ EphyEmbed *embed;
+ EmbedPrintInfo *info;
+
+ embed = ephy_window_get_active_embed (window);
+ g_return_if_fail (EPHY_IS_EMBED (embed));
+
+ info = ephy_print_get_print_info ();
+ info->preview = TRUE;
+
+ ephy_embed_print (embed, info);
+
+ ephy_window_set_print_preview (window, TRUE);
+}
+
+void
window_cmd_file_print (GtkAction *action,
EphyWindow *window)
{
diff --git a/src/window-commands.h b/src/window-commands.h
index 63640abbe..228434c27 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -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
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#include <gtk/gtkaction.h>
@@ -23,9 +25,6 @@
void window_cmd_edit_find (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_print (GtkAction *action,
- EphyWindow *window);
-
void window_cmd_view_stop (GtkAction *action,
EphyWindow *window);
@@ -74,6 +73,15 @@ void window_cmd_file_open (GtkAction *action,
void window_cmd_file_save_as (GtkAction *action,
EphyWindow *window);
+void window_cmd_file_print_setup (GtkAction *action,
+ EphyWindow *window);
+
+void window_cmd_file_print_preview (GtkAction *action,
+ EphyWindow *window);
+
+void window_cmd_file_print (GtkAction *action,
+ EphyWindow *window);
+
void window_cmd_file_send_to (GtkAction *action,
EphyWindow *window);