Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/2d41d6c933cec1a0660bc71aaa115b41dcfdfbed
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/2d41d6c933cec1a0660bc71aaa115b41dcfdfbed
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/2d41d6c933cec1a0660bc71aaa115b41dcfdfbed

The branch, master has been updated
       via  2d41d6c933cec1a0660bc71aaa115b41dcfdfbed (commit)
      from  0c7649d030d980755d9659574214f104368fc6a0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=2d41d6c933cec1a0660bc71aaa115b41dcfdfbed
commit 2d41d6c933cec1a0660bc71aaa115b41dcfdfbed
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    cleanup gtk cookie interface
    
    use gtk_window_present instead of gdk_window_raise and reduce exposed
    variables and interfaces.

diff --git a/frontends/gtk/cookies.c b/frontends/gtk/cookies.c
index 76894fa..f252e6b 100644
--- a/frontends/gtk/cookies.c
+++ b/frontends/gtk/cookies.c
@@ -35,7 +35,11 @@
 #include "gtk/treeview.h"
 #include "gtk/resources.h"
 
-#define MENUPROTO(x) static gboolean nsgtk_on_##x##_activate( \
+static struct nsgtk_treeview *cookies_treeview;
+static GtkBuilder *cookie_builder;
+static GtkWindow *wndCookies = NULL;
+
+#define MENUPROTO(x) static gboolean nsgtk_on_##x##_activate(  \
                GtkMenuItem *widget, gpointer g)
 #define MENUEVENT(x) { #x, G_CALLBACK(nsgtk_on_##x##_activate) }
 #define MENUHANDLER(x) gboolean nsgtk_on_##x##_activate(GtkMenuItem *widget, \
@@ -80,9 +84,7 @@ static struct menu_events menu_events[] = {
        {NULL, NULL}
 };
 
-static struct nsgtk_treeview *cookies_treeview;
-static GtkBuilder *cookie_builder;
-GtkWindow *wndCookies;
+
 
 /**
  * Connects menu events in the cookies window.
@@ -102,13 +104,21 @@ static void nsgtk_cookies_init_menu(void)
        }
 }
 
-/* exported interface documented in gtk/cookies.h */
-nserror nsgtk_cookies_init(void)
+/**
+ * Creates the window for the cookies tree.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+static nserror nsgtk_cookies_init(void)
 {
        GtkScrolledWindow *scrolled;
        GtkDrawingArea *drawing_area;
        nserror res;
 
+       if (wndCookies != NULL) {
+               return NSERROR_OK;
+       }
+
        res = nsgtk_builder_new_from_resname("cookies", &cookie_builder);
        if (res != NSERROR_OK) {
                LOG("Cookie UI builder init failed");
@@ -147,14 +157,6 @@ nserror nsgtk_cookies_init(void)
 }
 
 
-/**
- * Destroys the cookies window and performs any other necessary cleanup 
actions.
- */
-void nsgtk_cookies_destroy(void)
-{
-       /** \todo what about cookie_builder? */
-       nsgtk_treeview_destroy(cookies_treeview);
-}
 
 
 /* edit menu */
@@ -219,3 +221,24 @@ MENUHANDLER(collapse_cookies)
        cookie_manager_contract(false);
        return TRUE;
 }
+
+/* exported function documented gtk/cookies.h */
+nserror nsgtk_cookies_present(void)
+{
+       nserror res;
+
+       res = nsgtk_cookies_init();
+       if (res == NSERROR_OK) {
+               gtk_window_present(wndCookies);
+       }
+       return res;
+}
+
+/* exported function documented gtk/cookies.h */
+void nsgtk_cookies_destroy(void)
+{
+       /** \todo what about cookie_builder? */
+       if (wndCookies != NULL) {
+               nsgtk_treeview_destroy(cookies_treeview);
+       }
+}
diff --git a/frontends/gtk/cookies.h b/frontends/gtk/cookies.h
index 2d5c56d..2af05e1 100644
--- a/frontends/gtk/cookies.h
+++ b/frontends/gtk/cookies.h
@@ -23,15 +23,19 @@
 #ifndef __NSGTK_COOKIES_H__
 #define __NSGTK_COOKIES_H__
 
-extern GtkWindow *wndCookies;
-
 /**
- * Creates the window for the cookies tree.
+ * make the cookie window visible.
  *
  * \return NSERROR_OK on success else appropriate error code on faliure.
  */
-nserror nsgtk_cookies_init(void);
+nserror nsgtk_cookies_present(void);
 
+/**
+ * Free any resources allocated for the cookie window.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
 void nsgtk_cookies_destroy(void);
 
+
 #endif /* __NSGTK_COOKIES_H__ */
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index e0044b5..af24d40 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -313,12 +313,6 @@ static nserror nsgtk_init(int argc, char** argv, char 
**respath)
                return error;
        }
 
-       error = nsgtk_cookies_init();
-       if (error != NSERROR_OK) {
-               LOG("Unable to initialise cookies window.");
-               return error;
-       }
-
        error = nsgtk_hotlist_init();
        if (error != NSERROR_OK) {
                LOG("Unable to initialise hotlist window.");
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index cd3779e..811c844 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -1523,9 +1523,11 @@ MULTIHANDLER(showbookmarks)
 
 MULTIHANDLER(showcookies)
 {
-       gtk_widget_show(GTK_WIDGET(wndCookies));
-       gdk_window_raise(nsgtk_widget_get_window(GTK_WIDGET(wndCookies)));
-
+       nserror res;
+       res = nsgtk_cookies_present();
+       if (res != NSERROR_OK) {
+               LOG("Unable to initialise cookies window.");
+       }
        return TRUE;
 }
 


-----------------------------------------------------------------------

Summary of changes:
 frontends/gtk/cookies.c     |   51 +++++++++++++++++++++++++++++++------------
 frontends/gtk/cookies.h     |   12 ++++++----
 frontends/gtk/gui.c         |    6 -----
 frontends/gtk/scaffolding.c |    8 ++++---
 4 files changed, 50 insertions(+), 27 deletions(-)

diff --git a/frontends/gtk/cookies.c b/frontends/gtk/cookies.c
index 76894fa..f252e6b 100644
--- a/frontends/gtk/cookies.c
+++ b/frontends/gtk/cookies.c
@@ -35,7 +35,11 @@
 #include "gtk/treeview.h"
 #include "gtk/resources.h"
 
-#define MENUPROTO(x) static gboolean nsgtk_on_##x##_activate( \
+static struct nsgtk_treeview *cookies_treeview;
+static GtkBuilder *cookie_builder;
+static GtkWindow *wndCookies = NULL;
+
+#define MENUPROTO(x) static gboolean nsgtk_on_##x##_activate(  \
                GtkMenuItem *widget, gpointer g)
 #define MENUEVENT(x) { #x, G_CALLBACK(nsgtk_on_##x##_activate) }
 #define MENUHANDLER(x) gboolean nsgtk_on_##x##_activate(GtkMenuItem *widget, \
@@ -80,9 +84,7 @@ static struct menu_events menu_events[] = {
        {NULL, NULL}
 };
 
-static struct nsgtk_treeview *cookies_treeview;
-static GtkBuilder *cookie_builder;
-GtkWindow *wndCookies;
+
 
 /**
  * Connects menu events in the cookies window.
@@ -102,13 +104,21 @@ static void nsgtk_cookies_init_menu(void)
        }
 }
 
-/* exported interface documented in gtk/cookies.h */
-nserror nsgtk_cookies_init(void)
+/**
+ * Creates the window for the cookies tree.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
+static nserror nsgtk_cookies_init(void)
 {
        GtkScrolledWindow *scrolled;
        GtkDrawingArea *drawing_area;
        nserror res;
 
+       if (wndCookies != NULL) {
+               return NSERROR_OK;
+       }
+
        res = nsgtk_builder_new_from_resname("cookies", &cookie_builder);
        if (res != NSERROR_OK) {
                LOG("Cookie UI builder init failed");
@@ -147,14 +157,6 @@ nserror nsgtk_cookies_init(void)
 }
 
 
-/**
- * Destroys the cookies window and performs any other necessary cleanup 
actions.
- */
-void nsgtk_cookies_destroy(void)
-{
-       /** \todo what about cookie_builder? */
-       nsgtk_treeview_destroy(cookies_treeview);
-}
 
 
 /* edit menu */
@@ -219,3 +221,24 @@ MENUHANDLER(collapse_cookies)
        cookie_manager_contract(false);
        return TRUE;
 }
+
+/* exported function documented gtk/cookies.h */
+nserror nsgtk_cookies_present(void)
+{
+       nserror res;
+
+       res = nsgtk_cookies_init();
+       if (res == NSERROR_OK) {
+               gtk_window_present(wndCookies);
+       }
+       return res;
+}
+
+/* exported function documented gtk/cookies.h */
+void nsgtk_cookies_destroy(void)
+{
+       /** \todo what about cookie_builder? */
+       if (wndCookies != NULL) {
+               nsgtk_treeview_destroy(cookies_treeview);
+       }
+}
diff --git a/frontends/gtk/cookies.h b/frontends/gtk/cookies.h
index 2d5c56d..2af05e1 100644
--- a/frontends/gtk/cookies.h
+++ b/frontends/gtk/cookies.h
@@ -23,15 +23,19 @@
 #ifndef __NSGTK_COOKIES_H__
 #define __NSGTK_COOKIES_H__
 
-extern GtkWindow *wndCookies;
-
 /**
- * Creates the window for the cookies tree.
+ * make the cookie window visible.
  *
  * \return NSERROR_OK on success else appropriate error code on faliure.
  */
-nserror nsgtk_cookies_init(void);
+nserror nsgtk_cookies_present(void);
 
+/**
+ * Free any resources allocated for the cookie window.
+ *
+ * \return NSERROR_OK on success else appropriate error code on faliure.
+ */
 void nsgtk_cookies_destroy(void);
 
+
 #endif /* __NSGTK_COOKIES_H__ */
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index e0044b5..af24d40 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -313,12 +313,6 @@ static nserror nsgtk_init(int argc, char** argv, char 
**respath)
                return error;
        }
 
-       error = nsgtk_cookies_init();
-       if (error != NSERROR_OK) {
-               LOG("Unable to initialise cookies window.");
-               return error;
-       }
-
        error = nsgtk_hotlist_init();
        if (error != NSERROR_OK) {
                LOG("Unable to initialise hotlist window.");
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index cd3779e..811c844 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -1523,9 +1523,11 @@ MULTIHANDLER(showbookmarks)
 
 MULTIHANDLER(showcookies)
 {
-       gtk_widget_show(GTK_WIDGET(wndCookies));
-       gdk_window_raise(nsgtk_widget_get_window(GTK_WIDGET(wndCookies)));
-
+       nserror res;
+       res = nsgtk_cookies_present();
+       if (res != NSERROR_OK) {
+               LOG("Unable to initialise cookies window.");
+       }
        return TRUE;
 }
 


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to