diff options
-rw-r--r-- | ChangeLog | 23 | ||||
-rw-r--r-- | data/Makefile.am | 2 | ||||
-rw-r--r-- | data/art/Makefile.am | 3 | ||||
-rw-r--r-- | data/bme.desktop.in | 10 | ||||
-rw-r--r-- | idl/EphyAutomation.idl | 10 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 22 | ||||
-rw-r--r-- | src/ephy-automation.c | 35 | ||||
-rw-r--r-- | src/ephy-main.c | 10 | ||||
-rw-r--r-- | src/ephy-shell.c | 40 | ||||
-rw-r--r-- | src/ephy-shell.h | 2 | ||||
-rw-r--r-- | src/window-commands.c | 38 |
11 files changed, 126 insertions, 69 deletions
@@ -1,3 +1,26 @@ +2003-04-09 Xan Lopez <xan@masilla.org> + + * data/Makefile.am: + * data/art/Makefile.am: + * idl/EphyAutomation.idl: + * src/bookmarks/ephy-bookmarks-editor.c: + (ephy_bookmarks_editor_node_activated_cb), + (ephy_bookmarks_editor_update_menu), + (ephy_bookmarks_editor_construct): + * src/ephy-automation.c: (impl_ephy_automation_loadurl), + (impl_ephy_automation_add_bookmark), (impl_ephy_automation_quit), + (impl_ephy_automation_load_session), + (impl_ephy_automation_open_bookmarks_editor), + (ephy_automation_class_init): + * src/ephy-main.c: (ephy_main_start): + * src/ephy-shell.c: (ephy_shell_init), (ephy_shell_finalize), + (bookmarks_hide_cb), (ephy_shell_show_bookmarks_editor): + * src/ephy-shell.h: + * src/window-commands.c: (window_cmd_go_bookmarks): + + Allow to launch the BME alone, rework some CORBA code, add a .desktop + file for the BME. Fixes #102477. + 2003-04-09 Marco Pesenti Gritti <marco@it.gnome.org> * src/bookmarks/ephy-bookmarks-editor.c: (add_focus_monitor), diff --git a/data/Makefile.am b/data/Makefile.am index d1df72dd6..b103c6677 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -8,7 +8,7 @@ server_in_files = GNOME_Epiphany_Automation.server.in GNOME_Epiphany_NautilusVie server_DATA = GNOME_Epiphany_Automation.server GNOME_Epiphany_NautilusView.server serverdir = $(libdir)/bonobo/servers -DESKTOP_IN_FILES= epiphany.desktop.in +DESKTOP_IN_FILES= epiphany.desktop.in bme.desktop.in DESKTOP_FILES= $(DESKTOP_IN_FILES:.desktop.in=.desktop) Applicationsdir = $(datadir)/applications diff --git a/data/art/Makefile.am b/data/art/Makefile.am index 57b6a453d..8e5bc397e 100644 --- a/data/art/Makefile.am +++ b/data/art/Makefile.am @@ -3,7 +3,6 @@ art_DATA = \ epiphany-unsecure.png \ epiphany.png \ epiphany-fullscreen.png \ - epiphany-bookmarks.png \ epiphany-bookmark-page.png \ epiphany-entry.png \ epiphany-download.png \ @@ -13,7 +12,7 @@ art_DATA = \ epiphany-send-link.png \ epiphany-tab-loading.gif -appicon_DATA = epiphany.png +appicon_DATA = epiphany.png epiphany-bookmarks.png appicondir = $(datadir)/pixmaps artdir = $(pkgdatadir)/art diff --git a/data/bme.desktop.in b/data/bme.desktop.in new file mode 100644 index 000000000..3010384e4 --- /dev/null +++ b/data/bme.desktop.in @@ -0,0 +1,10 @@ +[Desktop Entry] +_Name=Epiphany Bookmarks Editor +_Comment=Browse and organize your bookmarks +Exec=epiphany --bookmarks-editor +StartupNotify=true +Terminal=0 +Type=Application +Icon=epiphany-bookmarks.png +X-GNOME-DocPath= +Categories=Application;Network; diff --git a/idl/EphyAutomation.idl b/idl/EphyAutomation.idl index 5f64b90d8..a9a286dcd 100644 --- a/idl/EphyAutomation.idl +++ b/idl/EphyAutomation.idl @@ -3,7 +3,7 @@ module GNOME { interface EphyAutomation : Bonobo::Unknown { - boolean loadurl (in string url, + void loadurl (in string url, in string geometry, in boolean fullscreen, in boolean open_in_existing_tab, @@ -11,7 +11,7 @@ module GNOME { in boolean open_in_new_window, in boolean raise); - boolean addBookmark (in string url); + void addBookmark (in string url); /** * Closes all opened windows. @@ -19,9 +19,11 @@ module GNOME { * server mode is disbaled * (and Epiphany exits) */ - boolean quit (in boolean disableServer); + void quit (in boolean disableServer); - boolean loadSession (in string filename); + void loadSession (in string filename); + + void openBookmarksEditor (); }; }; diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index 4786c9d67..7307570d6 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -25,6 +25,7 @@ #include <gtk/gtkvbox.h> #include <gdk/gdkkeysyms.h> #include <libgnome/gnome-i18n.h> +#include <libgnome/gnome-program.h> #include <string.h> #include "ephy-bookmarks-editor.h" @@ -446,17 +447,25 @@ ephy_bookmarks_editor_node_activated_cb (GtkWidget *view, EphyBookmarksEditor *editor) { const char *location; - GtkWindow *window; + EphyWindow *window; g_return_if_fail (EPHY_IS_NODE (node)); location = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION); g_return_if_fail (location != NULL); - window = GTK_WINDOW (get_target_window (editor)); - g_return_if_fail (IS_EPHY_WINDOW (window)); - ephy_window_load_url (EPHY_WINDOW (window), location); - gtk_window_present (GTK_WINDOW (window)); + window = EPHY_WINDOW (get_target_window (editor)); + if (window != NULL) + { + ephy_window_load_url (EPHY_WINDOW (window), location); + gtk_window_present (GTK_WINDOW (window)); + } + else + { + /* We have to create a browser window */ + ephy_shell_new_tab (ephy_shell, NULL, NULL, location, + EPHY_NEW_TAB_IN_NEW_WINDOW); + } } static void @@ -770,7 +779,8 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor) gtk_window_set_title (GTK_WINDOW (editor), _("Bookmarks")); - icon_path = ephy_file ("epiphany-bookmarks.png"); + icon_path = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_PIXMAP, + "epiphany-bookmarks.png", TRUE, NULL); gtk_window_set_icon_from_file (GTK_WINDOW (editor), icon_path, NULL); g_signal_connect (editor, "delete_event", diff --git a/src/ephy-automation.c b/src/ephy-automation.c index 75829d444..014702762 100644 --- a/src/ephy-automation.c +++ b/src/ephy-automation.c @@ -27,15 +27,15 @@ #include <bonobo/bonobo-main.h> #include <bonobo/bonobo-context.h> -static CORBA_boolean +static void impl_ephy_automation_add_bookmark (PortableServer_Servant _servant, const CORBA_char * url, CORBA_Environment * ev); -static CORBA_boolean +static void impl_ephy_automation_quit (PortableServer_Servant _servant, const CORBA_boolean disableServer, CORBA_Environment * ev); -static CORBA_boolean +static void impl_ephy_automation_load_session (PortableServer_Servant _servant, const CORBA_char * filename, CORBA_Environment * ev); @@ -80,7 +80,7 @@ ephy_automation_new (void) return BONOBO_OBJECT (factory); } -static CORBA_boolean +static void impl_ephy_automation_loadurl (PortableServer_Servant _servant, const CORBA_char * url, const CORBA_char * geometry, @@ -105,7 +105,7 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant, res = session_autoresume (session); /* no need to open the homepage, * we did already open session windows */ - if (res && *url == '\0') return TRUE; + if (res && *url == '\0') return; } window = ephy_shell_get_active_window (ephy_shell); @@ -113,7 +113,7 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant, if (open_in_existing_tab && window != NULL) { ephy_window_load_url (window, url); - return TRUE; + return; } if (*url == '\0') @@ -142,47 +142,43 @@ impl_ephy_automation_loadurl (PortableServer_Servant _servant, ephy_shell_new_tab (ephy_shell, window, NULL, load_page, flags); - - return TRUE; } -static CORBA_boolean +static void impl_ephy_automation_add_bookmark (PortableServer_Servant _servant, const CORBA_char * url, CORBA_Environment * ev) { - CORBA_boolean retval = TRUE; - return retval; } -static CORBA_boolean +static void impl_ephy_automation_quit (PortableServer_Servant _servant, const CORBA_boolean disableServer, CORBA_Environment * ev) { - CORBA_boolean retval = TRUE; - Session *session; session = ephy_shell_get_session (ephy_shell); session_close (session); - - return retval; } -static CORBA_boolean +static void impl_ephy_automation_load_session (PortableServer_Servant _servant, const CORBA_char * filename, CORBA_Environment * ev) { - CORBA_boolean retval = TRUE; Session *session; session = ephy_shell_get_session (ephy_shell); session_load (session, filename); +} - return retval; +static void +impl_ephy_automation_open_bookmarks_editor (PortableServer_Servant _servant, + CORBA_Environment * ev) +{ + ephy_shell_show_bookmarks_editor (ephy_shell); } static void @@ -200,6 +196,7 @@ ephy_automation_class_init (EphyAutomationClass *klass) epv->addBookmark = impl_ephy_automation_add_bookmark; epv->quit = impl_ephy_automation_quit; epv->loadSession = impl_ephy_automation_load_session; + epv->openBookmarksEditor = impl_ephy_automation_open_bookmarks_editor; } static void diff --git a/src/ephy-main.c b/src/ephy-main.c index 8408354e4..e14c4abf3 100644 --- a/src/ephy-main.c +++ b/src/ephy-main.c @@ -55,6 +55,7 @@ static gchar *bookmark_url = NULL; /* the temp bookmark to add static gboolean close_option = FALSE; /* --close */ static gboolean quit_option = FALSE; /* --quit */ static gboolean ephy_server_mode = FALSE; +static gboolean open_as_bookmarks_editor = FALSE; /* --bookmarks-editor */ static gboolean open_as_nautilus_view = FALSE; static BonoboObject *automation_object; @@ -105,6 +106,9 @@ static struct poptOption popt_options[] = { "nautilus-view", 'v', POPT_ARG_NONE, &open_as_nautilus_view, 0, N_("Used internally by the nautilus view"), NULL }, + { "bookmarks-editor", 'b', POPT_ARG_NONE, &open_as_bookmarks_editor, 0, + N_("Launch the bookmarks editor"), + NULL }, /* terminator, must be last */ { NULL, 0, 0, NULL, 0, NULL, NULL } @@ -202,6 +206,12 @@ ephy_main_start (gpointer data) { g_object_ref (G_OBJECT(ephy_shell)); } + /* Launch the bookmarks editor */ + else if (open_as_bookmarks_editor) + { + GNOME_EphyAutomation_openBookmarksEditor + (gaserver, &corba_env); + } /* load the session if requested */ else if (session_filename) { diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 4fc7e26f3..1fa250e66 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -31,6 +31,7 @@ #include "ephy-file-helpers.h" #include "ephy-thread-helpers.h" #include "ephy-bookmarks-import.h" +#include "ephy-bookmarks-editor.h" #include "ephy-debug.h" #include "toolbar.h" @@ -56,6 +57,7 @@ struct EphyShellPrivate Session *session; EphyAutocompletion *autocompletion; EphyBookmarks *bookmarks; + GtkWidget *bme; }; enum @@ -257,6 +259,7 @@ ephy_shell_init (EphyShell *gs) gs->priv = g_new0 (EphyShellPrivate, 1); gs->priv->session = NULL; gs->priv->bookmarks = NULL; + gs->priv->bme = NULL; ephy_shell = gs; g_object_add_weak_pointer (G_OBJECT(ephy_shell), @@ -315,6 +318,12 @@ ephy_shell_finalize (GObject *object) g_object_unref (gs->priv->autocompletion); } + LOG ("Unref Bookmarks Editor"); + if (gs->priv->bme) + { + gtk_widget_destroy (GTK_WIDGET (gs->priv->bme)); + } + LOG ("Unref bookmarks") if (gs->priv->bookmarks) { @@ -614,3 +623,34 @@ ephy_shell_get_bookmarks (EphyShell *gs) return gs->priv->bookmarks; } + +static void +bookmarks_hide_cb (GtkWidget *widget, gpointer data) +{ + LOG ("Unref shell for bookmarks editor") + g_object_unref (ephy_shell); +} + +void +ephy_shell_show_bookmarks_editor (EphyShell *gs) +{ + EphyBookmarks *bookmarks; + + if (gs->priv->bme == NULL) + { + bookmarks = ephy_shell_get_bookmarks (ephy_shell); + g_assert (bookmarks != NULL); + gs->priv->bme = ephy_bookmarks_editor_new (bookmarks); + g_signal_connect (gs->priv->bme, "hide", + G_CALLBACK (bookmarks_hide_cb), NULL); + } + + if (!GTK_WIDGET_VISIBLE (gs->priv->bme)) + { + LOG ("Ref shell for bookmarks editor") + g_object_ref (ephy_shell); + } + + gtk_window_present (GTK_WINDOW (gs->priv->bme)); +} + diff --git a/src/ephy-shell.h b/src/ephy-shell.h index 0acd107d1..f4ec200ed 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -94,6 +94,8 @@ EphyAutocompletion *ephy_shell_get_autocompletion (EphyShell *gs); EphyBookmarks *ephy_shell_get_bookmarks (EphyShell *gs); +void ephy_shell_show_bookmarks_editor (EphyShell *gs); + G_END_DECLS #endif diff --git a/src/window-commands.c b/src/window-commands.c index f9e5ecf72..4cd9c9b87 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -239,47 +239,11 @@ window_cmd_file_new_tab (EggAction *action, EPHY_NEW_TAB_JUMP); } -static void -bookmarks_hide_cb (GtkWidget *widget, gpointer data) -{ - LOG ("Unref shell for bookmarks editor") - g_object_unref (ephy_shell); -} - -static void -shell_weak_notify_cb (gpointer data, GObject *object) -{ - LOG ("Bookmarks editor destroyed") - gtk_widget_destroy (GTK_WIDGET (data)); -} - void window_cmd_go_bookmarks (EggAction *action, EphyWindow *window) { - static GtkWidget *dialog = NULL; - EphyBookmarks *bookmarks; - - if (dialog == NULL) - { - bookmarks = ephy_shell_get_bookmarks (ephy_shell); - g_assert (bookmarks != NULL); - dialog = ephy_bookmarks_editor_new (bookmarks); - g_object_weak_ref (G_OBJECT (ephy_shell), - shell_weak_notify_cb, dialog); - g_signal_connect (dialog, "hide", - G_CALLBACK (bookmarks_hide_cb), NULL); - } - - if (!GTK_WIDGET_VISIBLE (dialog)) - { - LOG ("Ref shell for bookmarks editor") - g_object_ref (ephy_shell); - } - - ephy_bookmarks_editor_set_parent (EPHY_BOOKMARKS_EDITOR (dialog), - GTK_WIDGET (window)); - gtk_window_present (GTK_WINDOW (dialog)); + ephy_shell_show_bookmarks_editor (ephy_shell); } void |