Gitweb links:

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

The branch, vince/gtk-tab-restyle has been updated
       via  c1acd4b7ac4ab0ee42ece7da9e9b242eec34b3b4 (commit)
      from  499ef68c0ca2a1f4f4fa43e958107f217838e198 (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=c1acd4b7ac4ab0ee42ece7da9e9b242eec34b3b4
commit c1acd4b7ac4ab0ee42ece7da9e9b242eec34b3b4
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    change toolbar customization to tab approach

diff --git a/frontends/gtk/res/toolbar.gtk3.ui 
b/frontends/gtk/res/toolbar.gtk3.ui
index 1f11487..b9eee2c 100644
--- a/frontends/gtk/res/toolbar.gtk3.ui
+++ b/frontends/gtk/res/toolbar.gtk3.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <!--*- mode: xml -*-->
 <interface>
   <requires lib="gtk+" version="3.0"/>
@@ -14,6 +14,9 @@
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">gtkToolBarTitle</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -134,4 +137,84 @@
       </object>
     </child>
   </object>
+  <object class="GtkBox" id="tabBox">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkToolbar" id="toolbar">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLayout" id="viewport">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButtonBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="layout_style">end</property>
+        <child>
+          <object class="GtkButton" id="rese">
+            <property name="label" translatable="yes">Reset</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="discard">
+            <property name="label">gtk-discard</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_stock">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="apply">
+            <property name="label">gtk-apply</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_stock">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+  </object>
 </interface>
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 1022e76..a2c3a7d 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -586,15 +586,6 @@ nsgtk_on_link_copy_activate_menu(GtkMenuItem *widget, 
gpointer data)
 }
 
 
-static gboolean
-nsgtk_on_customize_activate_menu(GtkMenuItem *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       nsgtk_toolbar_customization_init(g);
-       return TRUE;
-}
-
-
 static gboolean nsgtk_on_find_activate_menu(GtkMenuItem *widget, gpointer data)
 {
        struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
@@ -773,10 +764,6 @@ static void nsgtk_menu_connect_signals(struct 
nsgtk_scaffolding *g)
                         "toggled",
                         G_CALLBACK(nsgtk_on_toolbar_activate_menu),
                         g);
-       
g_signal_connect(g->menu_bar->view_submenu->toolbars_submenu->customize_menuitem,
-                        "activate",
-                        G_CALLBACK(nsgtk_on_customize_activate_menu),
-                        g);
 
 }
 
@@ -807,10 +794,6 @@ create_scaffolding_burger_menu(struct nsgtk_scaffolding 
*gs,
                         "toggled",
                         G_CALLBACK(nsgtk_on_toolbar_activate_menu),
                         gs);
-       
g_signal_connect(nmenu->view_submenu->toolbars_submenu->customize_menuitem,
-                        "activate",
-                        G_CALLBACK(nsgtk_on_customize_activate_menu),
-                        gs);
        return nmenu;
 }
 
@@ -845,10 +828,6 @@ create_scaffolding_popup_menu(struct nsgtk_scaffolding 
*gs, GtkAccelGroup *group
                         "toggled",
                         G_CALLBACK(nsgtk_on_toolbar_activate_menu),
                         gs);
-       g_signal_connect(nmenu->toolbars_submenu->customize_menuitem,
-                        "activate",
-                        G_CALLBACK(nsgtk_on_customize_activate_menu),
-                        gs);
 
        /* set initial popup menu visibility */
        popup_menu_hide(nmenu, false, false);
@@ -974,6 +953,9 @@ static nserror nsgtk_menu_initialise(struct 
nsgtk_scaffolding *g)
        ITEM_MB(NEXTTAB, nexttab, view_submenu->tabs);
        ITEM_MB(PREVTAB, prevtab, view_submenu->tabs);
        ITEM_MB(CLOSETAB, closetab, view_submenu->tabs);
+       /* view - toolbars submenu */
+       ITEM_MB(CUSTOMIZE, customize, view_submenu->toolbars);
+       g->menus[CUSTOMIZE_BUTTON].popup = 
g->popup_menu->toolbars_submenu->customize_menuitem;
 
        /* navigation menu */
        ITEM_MBp(BACK, back, nav);
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 5a7d252..dadddc2 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -137,11 +137,21 @@ struct nsgtk_toolbar {
        void *get_ctx;
 };
 
+/**
+ * toolbar cusomisation context
+ */
+struct nsgtk_toolbar_customization {
+       /**
+        * first entry is a toolbar widget so a customisation widget
+        *   can be cast to toolbar and back.
+        */
+       struct nsgtk_toolbar toolbar;
 
-static GtkTargetEntry entry = {(char *)"nsgtk_button_data",
-               GTK_TARGET_SAME_APP, 0};
-
-static bool edit_mode = false;
+       /**
+        * toolbar gtk builder
+        */
+       GtkBuilder *builder;
+};
 
 /**
  * toolbar customization window context
@@ -158,6 +168,8 @@ struct nsgtk_toolbar_custom_store {
        bool fromstore;
 };
 
+static bool edit_mode = false;
+
 /* the number of buttons that fit in the width of the store window */
 #define NSGTK_STORE_WIDTH 6
 
@@ -233,11 +245,6 @@ nsgtk_toolbar_##name##_data_minus(GtkWidget *widget,       
                \
 #undef TOOLBAR_ITEM
 
 
-/* exported interface documented in gtk/scaffolding.h */
-static GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g)
-{
-       return NULL;//g->tool_bar;
-}
 
 /**
  * get default image for buttons / menu items from gtk stock items.
@@ -494,37 +501,6 @@ void nsgtk_theme_implement(struct nsgtk_scaffolding *g)
 }
 
 
-/**
- * callback function to iterate toolbar's widgets
- */
-static void nsgtk_toolbar_clear_toolbar(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       gtk_container_remove(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
-                            widget);
-}
-
-/**
- * connect temporary handler for toolbar edit events
- *
- * \param g The scaffolding
- * \param bi The button index
- */
-static void nsgtk_toolbar_temp_connect(struct nsgtk_scaffolding *g,
-                                      nsgtk_toolbar_button bi)
-{
-       struct nsgtk_toolbar_item *bc;
-
-       if (bi != URL_BAR_ITEM) {
-               bc = nsgtk_scaffolding_button(g, bi);
-               if ((bc->button != NULL) && (bc->dataminus != NULL)) {
-                       g_signal_connect(bc->button,
-                                        "drag-data-get",
-                                        G_CALLBACK(bc->dataminus),
-                                        g);
-               }
-       }
-}
 
 /**
  * get scaffolding button index of button at location
@@ -817,6 +793,48 @@ make_toolbar_item(nsgtk_toolbar_button i, struct 
nsgtk_theme *theme)
 
        return w;
 }
+#if 0
+
+static GtkTargetEntry entry = {(char *)"nsgtk_button_data",
+               GTK_TARGET_SAME_APP, 0};
+
+/* exported interface documented in gtk/scaffolding.h */
+static GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g)
+{
+       return NULL;//g->tool_bar;
+}
+
+/**
+ * callback function to iterate toolbar's widgets
+ */
+static void nsgtk_toolbar_clear_toolbar(GtkWidget *widget, gpointer data)
+{
+       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
+       gtk_container_remove(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
+                            widget);
+}
+
+/**
+ * connect temporary handler for toolbar edit events
+ *
+ * \param g The scaffolding
+ * \param bi The button index
+ */
+static void nsgtk_toolbar_temp_connect(struct nsgtk_scaffolding *g,
+                                      nsgtk_toolbar_button bi)
+{
+       struct nsgtk_toolbar_item *bc;
+
+       if (bi != URL_BAR_ITEM) {
+               bc = nsgtk_scaffolding_button(g, bi);
+               if ((bc->button != NULL) && (bc->dataminus != NULL)) {
+                       g_signal_connect(bc->button,
+                                        "drag-data-get",
+                                        G_CALLBACK(bc->dataminus),
+                                        g);
+               }
+       }
+}
 
 /* exported interface documented in gtk/scaffolding.h */
 static void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g)
@@ -1498,7 +1516,42 @@ void nsgtk_toolbar_customization_init(struct 
nsgtk_scaffolding *g)
        /* open toolbar window */
        nsgtk_toolbar_window_open(g);
 }
+#endif
+/**
+ * create a toolbar customization tab
+ *
+ * this is completely different approach to previous implementation. it
+ *  is not modal and the toolbar configuration is performed completely
+ *  within the tab. once the user is happy they can apply the change or
+ *  cancel as they see fit while continuing to use the browser as usual.
+ */
+static gboolean cutomize_button_clicked_cb(GtkWidget *widget, gpointer data)
+{
+       struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data;
+       struct nsgtk_toolbar_customization *tbc;
+       nserror res;
+       /* create nsgtk_toolbar_customization which has nsgtk_toolbar
+        * at the front so we can reuse functions that take
+        * nsgtk_toolbar
+        */
+       tbc = calloc(1, sizeof(struct nsgtk_toolbar_customization));
 
+       /* create builder*/
+       res = nsgtk_builder_new_from_resname("toolbar", &tbc->builder);
+       if (res != NSERROR_OK) {
+               NSLOG(netsurf, INFO, "Toolbar UI builder init failed");
+               return TRUE;
+       }
+
+       /* get toolbar widget from builder */
+       /* populate toolbar widget in edit mode */
+       /* attach handlers to widgets */
+       /* use layout box for widgets to drag to/from */
+       /* save and update on apply button then discard */
+       /* discard button causes destruction */
+       /* close and cleanup on destroy signal */
+       return TRUE;
+}
 
 /**
  * \return toolbar item id when a widget is an element of the scaffolding
diff --git a/frontends/gtk/toolbar_items.h b/frontends/gtk/toolbar_items.h
index 0ed2f2a..661cbef 100644
--- a/frontends/gtk/toolbar_items.h
+++ b/frontends/gtk/toolbar_items.h
@@ -72,6 +72,7 @@ typedef enum {
        INFO_BUTTON,
        ABOUT_BUTTON,
        OPENMENU_BUTTON,
+       CUSTOMIZE_BUTTON,
        PLACEHOLDER_BUTTON /* size indicator; array maximum indices */
 } nsgtk_toolbar_button;    /* PLACEHOLDER_BUTTON - 1 */
 
@@ -144,6 +145,7 @@ TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, y, p)
 TOOLBAR_ITEM(INFO_BUTTON, info, true, y, p)
 TOOLBAR_ITEM(ABOUT_BUTTON, about, true, y, p)
 TOOLBAR_ITEM(OPENMENU_BUTTON, openmenu, true, y, n)
+TOOLBAR_ITEM(CUSTOMIZE_BUTTON, cutomize, true, y, p)
 
 #ifdef TOOLBAR_ITEM_SET
 #undef TOOLBAR_ITEM


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

Summary of changes:
 frontends/gtk/res/toolbar.gtk3.ui |   85 +++++++++++++++++++++++-
 frontends/gtk/scaffolding.c       |   24 +------
 frontends/gtk/toolbar.c           |  133 ++++++++++++++++++++++++++-----------
 frontends/gtk/toolbar_items.h     |    2 +
 4 files changed, 182 insertions(+), 62 deletions(-)

diff --git a/frontends/gtk/res/toolbar.gtk3.ui 
b/frontends/gtk/res/toolbar.gtk3.ui
index 1f11487..b9eee2c 100644
--- a/frontends/gtk/res/toolbar.gtk3.ui
+++ b/frontends/gtk/res/toolbar.gtk3.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <!--*- mode: xml -*-->
 <interface>
   <requires lib="gtk+" version="3.0"/>
@@ -14,6 +14,9 @@
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">gtkToolBarTitle</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -134,4 +137,84 @@
       </object>
     </child>
   </object>
+  <object class="GtkBox" id="tabBox">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkToolbar" id="toolbar">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLayout" id="viewport">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkButtonBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="layout_style">end</property>
+        <child>
+          <object class="GtkButton" id="rese">
+            <property name="label" translatable="yes">Reset</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="discard">
+            <property name="label">gtk-discard</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_stock">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="apply">
+            <property name="label">gtk-apply</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_stock">True</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+  </object>
 </interface>
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 1022e76..a2c3a7d 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -586,15 +586,6 @@ nsgtk_on_link_copy_activate_menu(GtkMenuItem *widget, 
gpointer data)
 }
 
 
-static gboolean
-nsgtk_on_customize_activate_menu(GtkMenuItem *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       nsgtk_toolbar_customization_init(g);
-       return TRUE;
-}
-
-
 static gboolean nsgtk_on_find_activate_menu(GtkMenuItem *widget, gpointer data)
 {
        struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
@@ -773,10 +764,6 @@ static void nsgtk_menu_connect_signals(struct 
nsgtk_scaffolding *g)
                         "toggled",
                         G_CALLBACK(nsgtk_on_toolbar_activate_menu),
                         g);
-       
g_signal_connect(g->menu_bar->view_submenu->toolbars_submenu->customize_menuitem,
-                        "activate",
-                        G_CALLBACK(nsgtk_on_customize_activate_menu),
-                        g);
 
 }
 
@@ -807,10 +794,6 @@ create_scaffolding_burger_menu(struct nsgtk_scaffolding 
*gs,
                         "toggled",
                         G_CALLBACK(nsgtk_on_toolbar_activate_menu),
                         gs);
-       
g_signal_connect(nmenu->view_submenu->toolbars_submenu->customize_menuitem,
-                        "activate",
-                        G_CALLBACK(nsgtk_on_customize_activate_menu),
-                        gs);
        return nmenu;
 }
 
@@ -845,10 +828,6 @@ create_scaffolding_popup_menu(struct nsgtk_scaffolding 
*gs, GtkAccelGroup *group
                         "toggled",
                         G_CALLBACK(nsgtk_on_toolbar_activate_menu),
                         gs);
-       g_signal_connect(nmenu->toolbars_submenu->customize_menuitem,
-                        "activate",
-                        G_CALLBACK(nsgtk_on_customize_activate_menu),
-                        gs);
 
        /* set initial popup menu visibility */
        popup_menu_hide(nmenu, false, false);
@@ -974,6 +953,9 @@ static nserror nsgtk_menu_initialise(struct 
nsgtk_scaffolding *g)
        ITEM_MB(NEXTTAB, nexttab, view_submenu->tabs);
        ITEM_MB(PREVTAB, prevtab, view_submenu->tabs);
        ITEM_MB(CLOSETAB, closetab, view_submenu->tabs);
+       /* view - toolbars submenu */
+       ITEM_MB(CUSTOMIZE, customize, view_submenu->toolbars);
+       g->menus[CUSTOMIZE_BUTTON].popup = 
g->popup_menu->toolbars_submenu->customize_menuitem;
 
        /* navigation menu */
        ITEM_MBp(BACK, back, nav);
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 5a7d252..dadddc2 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -137,11 +137,21 @@ struct nsgtk_toolbar {
        void *get_ctx;
 };
 
+/**
+ * toolbar cusomisation context
+ */
+struct nsgtk_toolbar_customization {
+       /**
+        * first entry is a toolbar widget so a customisation widget
+        *   can be cast to toolbar and back.
+        */
+       struct nsgtk_toolbar toolbar;
 
-static GtkTargetEntry entry = {(char *)"nsgtk_button_data",
-               GTK_TARGET_SAME_APP, 0};
-
-static bool edit_mode = false;
+       /**
+        * toolbar gtk builder
+        */
+       GtkBuilder *builder;
+};
 
 /**
  * toolbar customization window context
@@ -158,6 +168,8 @@ struct nsgtk_toolbar_custom_store {
        bool fromstore;
 };
 
+static bool edit_mode = false;
+
 /* the number of buttons that fit in the width of the store window */
 #define NSGTK_STORE_WIDTH 6
 
@@ -233,11 +245,6 @@ nsgtk_toolbar_##name##_data_minus(GtkWidget *widget,       
                \
 #undef TOOLBAR_ITEM
 
 
-/* exported interface documented in gtk/scaffolding.h */
-static GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g)
-{
-       return NULL;//g->tool_bar;
-}
 
 /**
  * get default image for buttons / menu items from gtk stock items.
@@ -494,37 +501,6 @@ void nsgtk_theme_implement(struct nsgtk_scaffolding *g)
 }
 
 
-/**
- * callback function to iterate toolbar's widgets
- */
-static void nsgtk_toolbar_clear_toolbar(GtkWidget *widget, gpointer data)
-{
-       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
-       gtk_container_remove(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
-                            widget);
-}
-
-/**
- * connect temporary handler for toolbar edit events
- *
- * \param g The scaffolding
- * \param bi The button index
- */
-static void nsgtk_toolbar_temp_connect(struct nsgtk_scaffolding *g,
-                                      nsgtk_toolbar_button bi)
-{
-       struct nsgtk_toolbar_item *bc;
-
-       if (bi != URL_BAR_ITEM) {
-               bc = nsgtk_scaffolding_button(g, bi);
-               if ((bc->button != NULL) && (bc->dataminus != NULL)) {
-                       g_signal_connect(bc->button,
-                                        "drag-data-get",
-                                        G_CALLBACK(bc->dataminus),
-                                        g);
-               }
-       }
-}
 
 /**
  * get scaffolding button index of button at location
@@ -817,6 +793,48 @@ make_toolbar_item(nsgtk_toolbar_button i, struct 
nsgtk_theme *theme)
 
        return w;
 }
+#if 0
+
+static GtkTargetEntry entry = {(char *)"nsgtk_button_data",
+               GTK_TARGET_SAME_APP, 0};
+
+/* exported interface documented in gtk/scaffolding.h */
+static GtkToolbar *nsgtk_scaffolding_toolbar(struct nsgtk_scaffolding *g)
+{
+       return NULL;//g->tool_bar;
+}
+
+/**
+ * callback function to iterate toolbar's widgets
+ */
+static void nsgtk_toolbar_clear_toolbar(GtkWidget *widget, gpointer data)
+{
+       struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
+       gtk_container_remove(GTK_CONTAINER(nsgtk_scaffolding_toolbar(g)),
+                            widget);
+}
+
+/**
+ * connect temporary handler for toolbar edit events
+ *
+ * \param g The scaffolding
+ * \param bi The button index
+ */
+static void nsgtk_toolbar_temp_connect(struct nsgtk_scaffolding *g,
+                                      nsgtk_toolbar_button bi)
+{
+       struct nsgtk_toolbar_item *bc;
+
+       if (bi != URL_BAR_ITEM) {
+               bc = nsgtk_scaffolding_button(g, bi);
+               if ((bc->button != NULL) && (bc->dataminus != NULL)) {
+                       g_signal_connect(bc->button,
+                                        "drag-data-get",
+                                        G_CALLBACK(bc->dataminus),
+                                        g);
+               }
+       }
+}
 
 /* exported interface documented in gtk/scaffolding.h */
 static void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g)
@@ -1498,7 +1516,42 @@ void nsgtk_toolbar_customization_init(struct 
nsgtk_scaffolding *g)
        /* open toolbar window */
        nsgtk_toolbar_window_open(g);
 }
+#endif
+/**
+ * create a toolbar customization tab
+ *
+ * this is completely different approach to previous implementation. it
+ *  is not modal and the toolbar configuration is performed completely
+ *  within the tab. once the user is happy they can apply the change or
+ *  cancel as they see fit while continuing to use the browser as usual.
+ */
+static gboolean cutomize_button_clicked_cb(GtkWidget *widget, gpointer data)
+{
+       struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data;
+       struct nsgtk_toolbar_customization *tbc;
+       nserror res;
+       /* create nsgtk_toolbar_customization which has nsgtk_toolbar
+        * at the front so we can reuse functions that take
+        * nsgtk_toolbar
+        */
+       tbc = calloc(1, sizeof(struct nsgtk_toolbar_customization));
 
+       /* create builder*/
+       res = nsgtk_builder_new_from_resname("toolbar", &tbc->builder);
+       if (res != NSERROR_OK) {
+               NSLOG(netsurf, INFO, "Toolbar UI builder init failed");
+               return TRUE;
+       }
+
+       /* get toolbar widget from builder */
+       /* populate toolbar widget in edit mode */
+       /* attach handlers to widgets */
+       /* use layout box for widgets to drag to/from */
+       /* save and update on apply button then discard */
+       /* discard button causes destruction */
+       /* close and cleanup on destroy signal */
+       return TRUE;
+}
 
 /**
  * \return toolbar item id when a widget is an element of the scaffolding
diff --git a/frontends/gtk/toolbar_items.h b/frontends/gtk/toolbar_items.h
index 0ed2f2a..661cbef 100644
--- a/frontends/gtk/toolbar_items.h
+++ b/frontends/gtk/toolbar_items.h
@@ -72,6 +72,7 @@ typedef enum {
        INFO_BUTTON,
        ABOUT_BUTTON,
        OPENMENU_BUTTON,
+       CUSTOMIZE_BUTTON,
        PLACEHOLDER_BUTTON /* size indicator; array maximum indices */
 } nsgtk_toolbar_button;    /* PLACEHOLDER_BUTTON - 1 */
 
@@ -144,6 +145,7 @@ TOOLBAR_ITEM(GUIDE_BUTTON, guide, true, y, p)
 TOOLBAR_ITEM(INFO_BUTTON, info, true, y, p)
 TOOLBAR_ITEM(ABOUT_BUTTON, about, true, y, p)
 TOOLBAR_ITEM(OPENMENU_BUTTON, openmenu, true, y, n)
+TOOLBAR_ITEM(CUSTOMIZE_BUTTON, cutomize, true, y, p)
 
 #ifdef TOOLBAR_ITEM_SET
 #undef TOOLBAR_ITEM


-- 
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