summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2010-12-14 18:54:20 +0000
committerVincent Sanders <vince@netsurf-browser.org>2010-12-14 18:54:20 +0000
commitf6b0a33fd286c190814fb9e6c835f27552ad3186 (patch)
tree23687b1a26c512e8bc735cd0720801c12d57c850 /gtk
parentb550f27f4b62cdf8ec91e416670f7fc4dc60f6e6 (diff)
downloadnetsurf-f6b0a33fd286c190814fb9e6c835f27552ad3186.tar.gz
netsurf-f6b0a33fd286c190814fb9e6c835f27552ad3186.tar.bz2
make the history, download, hotlist and cookies initialisation actually use the generic glade file finding code instead of their own thing and erroring out.
svn path=/trunk/netsurf/; revision=11055
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtk_cookies.c13
-rw-r--r--gtk/gtk_cookies.h3
-rw-r--r--gtk/gtk_download.c4
-rw-r--r--gtk/gtk_download.h2
-rw-r--r--gtk/gtk_gui.c21
-rw-r--r--gtk/gtk_gui.h2
-rw-r--r--gtk/gtk_history.c8
-rw-r--r--gtk/gtk_history.h12
-rw-r--r--gtk/gtk_hotlist.c17
-rw-r--r--gtk/gtk_hotlist.h7
10 files changed, 57 insertions, 32 deletions
diff --git a/gtk/gtk_cookies.c b/gtk/gtk_cookies.c
index e9528320b..12fa9cc14 100644
--- a/gtk/gtk_cookies.c
+++ b/gtk/gtk_cookies.c
@@ -86,14 +86,15 @@ GtkWindow *wndCookies;
/**
* Creates the window for the cookies tree.
*/
-void nsgtk_cookies_init(void)
+bool nsgtk_cookies_init(const char *glade_file_location)
{
- gchar *glade_location = g_strconcat(res_dir_location, GLADE_NAME, NULL);
- gladeFile = glade_xml_new(glade_location, NULL, NULL);
- g_free(glade_location);
GtkWindow *window;
GtkScrolledWindow *scrolled;
GtkDrawingArea *drawing_area;
+
+ gladeFile = glade_xml_new(glade_file_location, NULL, NULL);
+ if (gladeFile == NULL)
+ return false;
glade_xml_signal_autoconnect(gladeFile);
@@ -110,7 +111,7 @@ void nsgtk_cookies_init(void)
scrolled, drawing_area);
if (cookies_window == NULL)
- return;
+ return false;
#define CONNECT(obj, sig, callback, ptr) \
g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
@@ -123,6 +124,8 @@ void nsgtk_cookies_init(void)
tree_content_icon_name);
nsgtk_cookies_init_menu();
+
+ return true;
}
/**
diff --git a/gtk/gtk_cookies.h b/gtk/gtk_cookies.h
index 7048e2da9..db12dfe31 100644
--- a/gtk/gtk_cookies.h
+++ b/gtk/gtk_cookies.h
@@ -27,7 +27,8 @@
extern GtkWindow *wndCookies;
-void nsgtk_cookies_init(void);
+bool nsgtk_cookies_init(const char *glade_file_location);
+
void nsgtk_cookies_destroy(void);
#endif /* __NSGTK_COOKIES_H__ */
diff --git a/gtk/gtk_download.c b/gtk/gtk_download.c
index 4d58f389d..a91f25188 100644
--- a/gtk/gtk_download.c
+++ b/gtk/gtk_download.c
@@ -84,11 +84,11 @@ static gboolean nsgtk_download_handle_error (GError *error);
-bool nsgtk_download_init()
+bool nsgtk_download_init(const char *glade_file_location)
{
GladeXML *gladeFile;
- gladeFile = glade_xml_new(glade_downloads_file_location, NULL, NULL);
+ gladeFile = glade_xml_new(glade_file_location, NULL, NULL);
if (gladeFile == NULL)
return false;
diff --git a/gtk/gtk_download.h b/gtk/gtk_download.h
index e38c51632..7e8226ce9 100644
--- a/gtk/gtk_download.h
+++ b/gtk/gtk_download.h
@@ -72,7 +72,7 @@ struct gui_download_window {
typedef void (*nsgtk_download_selection_action)(struct gui_download_window *dl);
-bool nsgtk_download_init(void);
+bool nsgtk_download_init(const char *glade_file_location);
void nsgtk_download_destroy (void);
bool nsgtk_check_for_downloads(GtkWindow *parent);
void nsgtk_download_show(GtkWindow *parent);
diff --git a/gtk/gtk_gui.c b/gtk/gtk_gui.c
index 739462060..7eb9446ca 100644
--- a/gtk/gtk_gui.c
+++ b/gtk/gtk_gui.c
@@ -93,10 +93,13 @@ char *glade_warning_file_location;
char *glade_login_file_location;
char *glade_ssl_file_location;
char *glade_toolbar_file_location;
-char *glade_downloads_file_location;
-char *glade_history_file_location;
char *glade_options_file_location;
+static char *glade_downloads_file_location;
+static char *glade_history_file_location;
+static char *glade_hotlist_file_location;
+static char *glade_cookies_file_location;
+
static GtkWindow *nsgtk_warning_window;
GtkWidget *widWarning;
@@ -323,6 +326,8 @@ nsgtk_init_glade(char **respath)
glade_downloads_file_location = nsgtk_new_glade(respath, "downloads", NULL);
glade_history_file_location = nsgtk_new_glade(respath, "history", NULL);
glade_options_file_location = nsgtk_new_glade(respath, "options", NULL);
+ glade_hotlist_file_location = nsgtk_new_glade(respath, "hotlist", NULL);
+ glade_cookies_file_location = nsgtk_new_glade(respath, "cookies", NULL);
glade_warning_file_location = nsgtk_new_glade(respath, "warning", &gladeWarning);
nsgtk_warning_window = GTK_WINDOW(glade_xml_get_widget(gladeWarning, "wndWarning"));
@@ -492,14 +497,18 @@ static void gui_init(int argc, char** argv, char **respath)
urldb_load(option_url_file);
urldb_load_cookies(option_cookie_file);
- if (nsgtk_history_init() == false)
+ if (nsgtk_history_init(glade_history_file_location) == false)
die("Unable to initialise history window.\n");
- if (nsgtk_download_init() == false)
+ if (nsgtk_download_init(glade_downloads_file_location) == false)
die("Unable to initialise download window.\n");
- nsgtk_cookies_init();
- nsgtk_hotlist_init();
+ if (nsgtk_cookies_init(glade_cookies_file_location) == false)
+ die("Unable to initialise cookies window.\n");
+
+ if (nsgtk_hotlist_init(glade_hotlist_file_location) == false)
+ die("Unable to initialise hotlist window.\n");
+
sslcert_init(tree_content_icon_name);
if (option_homepage_url != NULL && option_homepage_url[0] != '\0')
diff --git a/gtk/gtk_gui.h b/gtk/gtk_gui.h
index 622b6ca55..9035d8873 100644
--- a/gtk/gtk_gui.h
+++ b/gtk/gtk_gui.h
@@ -37,8 +37,6 @@ extern char *glade_warning_file_location;
extern char *glade_login_file_location;
extern char *glade_ssl_file_location;
extern char *glade_toolbar_file_location;
-extern char *glade_downloads_file_location;
-extern char *glade_history_file_location;
extern char *glade_options_file_location;
extern char *languages_file_location;
diff --git a/gtk/gtk_history.c b/gtk/gtk_history.c
index 62cc798e5..09f945963 100644
--- a/gtk/gtk_history.c
+++ b/gtk/gtk_history.c
@@ -89,16 +89,14 @@ static GladeXML *gladeFile;
GtkWindow *wndHistory;
-/**
- * Creates the window for the global history tree.
- */
-bool nsgtk_history_init(void)
+/* exported interface, documented in gtk_history.h */
+bool nsgtk_history_init(const char *glade_file_location)
{
GtkWindow *window;
GtkScrolledWindow *scrolled;
GtkDrawingArea *drawing_area;
- gladeFile = glade_xml_new(glade_history_file_location, NULL, NULL);
+ gladeFile = glade_xml_new(glade_file_location, NULL, NULL);
if (gladeFile == NULL)
return false;
diff --git a/gtk/gtk_history.h b/gtk/gtk_history.h
index 93d57b2b7..ab3c10ee6 100644
--- a/gtk/gtk_history.h
+++ b/gtk/gtk_history.h
@@ -24,7 +24,17 @@
extern GtkWindow *wndHistory;
-bool nsgtk_history_init(void);
+/**
+ * Creates the window for the global history tree.
+ *
+ * \param glade_file_location The glade file to use for the window.
+ * \return true on success false on faliure.
+ */
+bool nsgtk_history_init(const char *glade_file_location);
+
+/**
+ * Free global resources associated with the gtk history window.
+ */
void nsgtk_history_destroy(void);
#endif /* __NSGTK_HISTORY_H__ */
diff --git a/gtk/gtk_hotlist.c b/gtk/gtk_hotlist.c
index bf700a047..98e0b217e 100644
--- a/gtk/gtk_hotlist.c
+++ b/gtk/gtk_hotlist.c
@@ -95,17 +95,16 @@ static GladeXML *gladeFile;
GtkWindow *wndHotlist;
-/**
- * Creates the window for the hotlist tree.
- */
-void nsgtk_hotlist_init()
+/* exported interface docuemnted in gtk_hotlist.h */
+bool nsgtk_hotlist_init(const char *glade_file_location)
{
- gchar *glade_location = g_strconcat(res_dir_location, GLADE_NAME, NULL);
- gladeFile = glade_xml_new(glade_location, NULL, NULL);
- g_free(glade_location);
GtkWindow *window;
GtkScrolledWindow *scrolled;
GtkDrawingArea *drawing_area;
+
+ gladeFile = glade_xml_new(glade_file_location, NULL, NULL);
+ if (gladeFile == NULL)
+ return false;
glade_xml_signal_autoconnect(gladeFile);
@@ -123,7 +122,7 @@ void nsgtk_hotlist_init()
scrolled, drawing_area);
if (hotlist_window == NULL)
- return;
+ return false;
#define CONNECT(obj, sig, callback, ptr) \
g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
@@ -136,6 +135,8 @@ void nsgtk_hotlist_init()
tree_directory_icon_name);
nsgtk_hotlist_init_menu();
+
+ return true;
}
diff --git a/gtk/gtk_hotlist.h b/gtk/gtk_hotlist.h
index 22dc0a45f..b2477bc9f 100644
--- a/gtk/gtk_hotlist.h
+++ b/gtk/gtk_hotlist.h
@@ -27,7 +27,12 @@
extern GtkWindow *wndHotlist;
-void nsgtk_hotlist_init(void);
+/**
+ * Initialise the gtk specific hotlist (bookmarks) display.
+ *
+ * \param glade_hotlist_file_location the path to the glade file for the hotlist
+ */
+bool nsgtk_hotlist_init(const char *glade_hotlist_file_location);
void nsgtk_hotlist_destroy(void);
#endif /* __NSGTK_HOTLIST_H__ */