<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[260949] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/260949">260949</a></dd>
<dt>Author</dt> <dd>csaavedra@igalia.com</dd>
<dt>Date</dt> <dd>2020-04-30 07:04:51 -0700 (Thu, 30 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK4] Add navigation and reload buttons to MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=211231

Reviewed by Adrian Perez de Castro.

* MiniBrowser/gtk/BrowserWindow.c:
(browserWindowUpdateNavigationMenu):
(webViewIsLoadingChanged):
(browserWindowSetupToolbarItem):
(browser_window_init):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowsergtkBrowserWindowc">trunk/Tools/MiniBrowser/gtk/BrowserWindow.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (260948 => 260949)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2020-04-30 13:55:35 UTC (rev 260948)
+++ trunk/Tools/ChangeLog       2020-04-30 14:04:51 UTC (rev 260949)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2020-04-30  Claudio Saavedra  <csaavedra@igalia.com>
+
+        [GTK4] Add navigation and reload buttons to MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=211231
+
+        Reviewed by Adrian Perez de Castro.
+
+        * MiniBrowser/gtk/BrowserWindow.c:
+        (browserWindowUpdateNavigationMenu):
+        (webViewIsLoadingChanged):
+        (browserWindowSetupToolbarItem):
+        (browser_window_init):
+
</ins><span class="cx"> 2020-04-30  Philippe Normand  <pnormand@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [SOUP] http/tests/media/video-accept-encoding.html fails
</span></span></pre></div>
<a id="trunkToolsMiniBrowsergtkBrowserWindowc"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/gtk/BrowserWindow.c (260948 => 260949)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/gtk/BrowserWindow.c      2020-04-30 13:55:35 UTC (rev 260948)
+++ trunk/Tools/MiniBrowser/gtk/BrowserWindow.c 2020-04-30 14:04:51 UTC (rev 260949)
</span><span class="lines">@@ -118,7 +118,6 @@
</span><span class="cx">     );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !GTK_CHECK_VERSION(3, 98, 0)
</del><span class="cx"> static void reloadOrStopCallback(BrowserWindow *window)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebView *webView = browser_tab_get_web_view(window->activeTab);
</span><span class="lines">@@ -140,6 +139,7 @@
</span><span class="cx">     webkit_web_view_go_forward(webView);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !GTK_CHECK_VERSION(3, 98, 0)
</ins><span class="cx"> static void settingsCallback(BrowserWindow *window)
</span><span class="cx"> {
</span><span class="cx">     if (window->settingsDialog) {
</span><span class="lines">@@ -263,11 +263,11 @@
</span><span class="cx"> 
</span><span class="cx"> static void browserWindowUpdateNavigationMenu(BrowserWindow *window, WebKitBackForwardList *backForwardlist)
</span><span class="cx"> {
</span><del>-#if !GTK_CHECK_VERSION(3, 98, 0)
</del><span class="cx">     WebKitWebView *webView = browser_tab_get_web_view(window->activeTab);
</span><span class="cx">     gtk_widget_set_sensitive(window->backItem, webkit_web_view_can_go_back(webView));
</span><span class="cx">     gtk_widget_set_sensitive(window->forwardItem, webkit_web_view_can_go_forward(webView));
</span><span class="cx"> 
</span><ins>+#if !GTK_CHECK_VERSION(3, 98, 0)
</ins><span class="cx">     GList *list = g_list_reverse(webkit_back_forward_list_get_back_list_with_limit(backForwardlist, 10));
</span><span class="cx">     gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(window->backItem),
</span><span class="cx">         browserWindowCreateBackForwardMenu(window, list));
</span><span class="lines">@@ -537,11 +537,8 @@
</span><span class="cx"> 
</span><span class="cx"> static void webViewIsLoadingChanged(WebKitWebView *webView, GParamSpec *paramSpec, BrowserWindow *window)
</span><span class="cx"> {
</span><del>-#if !GTK_CHECK_VERSION(3, 98, 0)
</del><span class="cx">     gboolean isLoading = webkit_web_view_is_loading(webView);
</span><del>-    gtk_tool_button_set_label(GTK_TOOL_BUTTON(window->reloadOrStopButton), isLoading ? "Stop" : "Reload");
-    gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(window->reloadOrStopButton), isLoading ? "process-stop" : "view-refresh");
-#endif
</del><ins>+    g_object_set(G_OBJECT(window->reloadOrStopButton), "label", isLoading ? "Stop" : "Reload", "icon-name", isLoading ? "process-stop" : "view-refresh", NULL);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !GTK_CHECK_VERSION(3, 98, 0)
</span><span class="lines">@@ -946,7 +943,17 @@
</span><span class="cx">     gtk_notebook_set_show_tabs(GTK_NOTEBOOK(window->notebook), gtk_notebook_get_n_pages(notebook) > 1);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !GTK_CHECK_VERSION(3, 98, 0)
</del><ins>+#if GTK_CHECK_VERSION(3, 98, 0)
+static GtkWidget* browserWindowSetupToolbarItem(BrowserWindow* window, GtkContainer* container, const char* namedIcon, GCallback callback)
+{
+    GtkWidget *button = gtk_button_new_from_icon_name(namedIcon);
+    gtk_button_set_has_frame(GTK_BUTTON(button), FALSE);
+    gtk_container_add(container, button);
+    g_signal_connect_swapped(button, "clicked", callback, (gpointer)window);
+
+    return button;
+}
+#else
</ins><span class="cx"> static GtkWidget* browserWindowSetupToolbarItem(BrowserWindow* window, GtkWidget* toolbar, GType type, const char* label, const char* namedIcon, GCallback callback)
</span><span class="cx"> {
</span><span class="cx">     GtkWidget *item = g_object_new(type, "icon-name", namedIcon, NULL);
</span><span class="lines">@@ -1050,6 +1057,12 @@
</span><span class="cx">     window->toolbar = toolbar;
</span><span class="cx">     gtk_widget_set_hexpand(window->uriEntry, TRUE);
</span><span class="cx">     gtk_center_box_set_center_widget(GTK_CENTER_BOX(toolbar), window->uriEntry);
</span><ins>+
+    GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+    window->backItem = browserWindowSetupToolbarItem(window, GTK_CONTAINER(box), "go-previous", G_CALLBACK(goBackCallback));
+    window->forwardItem = browserWindowSetupToolbarItem(window, GTK_CONTAINER(box), "go-next", G_CALLBACK(goForwardCallback));
+    window->reloadOrStopButton = browserWindowSetupToolbarItem(window, GTK_CONTAINER(box), "view-refresh", G_CALLBACK(reloadOrStopCallback));
+    gtk_center_box_set_start_widget(GTK_CENTER_BOX(toolbar), box);
</ins><span class="cx"> #else
</span><span class="cx">     GtkWidget *toolbar = gtk_toolbar_new();
</span><span class="cx">     window->toolbar = toolbar;
</span></span></pre>
</div>
</div>

</body>
</html>