commit: 437e1cc24f72baa6824199bb70f722d2e0bd261e
parent: c323b97f353e6f5b0d363fb460f0de92028bad29
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Tue, 2 Apr 2019 00:10:05 +0200
badwolf.c: Move search to statusbar
Closes: https://gitlab.com/lanodan/badWolf/issues/5
Diffstat:
2 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/badwolf.c b/badwolf.c
@@ -22,11 +22,13 @@ struct Client
GtkWidget *toolbar;
GtkWidget *javascript;
GtkWidget *location;
- GtkWidget *search;
- GtkWidget *statusbar;
WebKitWebView *webView;
struct Window *window;
+
+ GtkWidget *statusbar;
+ GtkWidget *statuslabel;
+ GtkWidget *search;
};
static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data);
@@ -213,7 +215,7 @@ static gboolean WebViewCb_mouse_target_changed(WebKitWebView *webView,
struct Client *browser = (struct Client *)user_data;
const gchar *link_uri = webkit_hit_test_result_get_link_uri(hit);
- gtk_label_set_text(GTK_LABEL(browser->statusbar), link_uri);
+ gtk_label_set_text(GTK_LABEL(browser->statuslabel), link_uri);
return TRUE;
}
@@ -316,9 +318,11 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web
browser->box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
browser->toolbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
browser->location = gtk_entry_new();
- browser->search = gtk_search_entry_new();
browser->javascript = gtk_check_button_new();
- browser->statusbar = gtk_label_new(NULL);
+
+ browser->statusbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ browser->statuslabel = gtk_label_new(NULL);
+ browser->search = gtk_search_entry_new();
WebKitWebContext *web_context = webkit_web_context_new_ephemeral();
webkit_web_context_set_process_model(web_context,
@@ -347,21 +351,29 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web
TRUE,
TRUE,
BADWOLF_TOOLBAR_PADDING);
- gtk_box_pack_start(GTK_BOX(browser->toolbar),
- GTK_WIDGET(browser->search),
- FALSE,
- FALSE,
- BADWOLF_TOOLBAR_PADDING);
gtk_box_pack_start(
GTK_BOX(browser->box), GTK_WIDGET(browser->toolbar), FALSE, FALSE, BADWOLF_BOX_PADDING);
gtk_box_pack_start(
GTK_BOX(browser->box), GTK_WIDGET(browser->webView), TRUE, TRUE, BADWOLF_BOX_PADDING);
+
gtk_box_pack_start(
GTK_BOX(browser->box), GTK_WIDGET(browser->statusbar), FALSE, FALSE, BADWOLF_BOX_PADDING);
+ gtk_box_pack_start(GTK_BOX(browser->statusbar),
+ GTK_WIDGET(browser->search),
+ FALSE,
+ FALSE,
+ BADWOLF_STATUSBAR_PADDING);
+ gtk_box_pack_start(GTK_BOX(browser->statusbar),
+ GTK_WIDGET(browser->statuslabel),
+ FALSE,
+ FALSE,
+ BADWOLF_STATUSBAR_PADDING);
+
gtk_widget_set_halign(browser->statusbar, GTK_ALIGN_START);
- gtk_label_set_single_line_mode(GTK_LABEL(browser->statusbar), TRUE);
+
+ gtk_label_set_single_line_mode(GTK_LABEL(browser->statuslabel), TRUE);
gtk_entry_set_text(GTK_ENTRY(browser->location), target_url);
gtk_entry_set_has_frame(GTK_ENTRY(browser->location), FALSE);
diff --git a/config.h b/config.h
@@ -27,6 +27,9 @@
// BADWOLF_TOOLBAR_PADDING: Amount of padding between toolbar elements
#define BADWOLF_TOOLBAR_PADDING 0
+// BADWOLF_STATUSBAR_PADDING: Amount of padding between statusbar elements
+#define BADWOLF_STATUSBAR_PADDING 0
+
/* BADWOLF_DEFAULT_WIDTH / BADWOLF_DEFAULT_HEIGHT:
* Used to define the default width/height of the window,
* useful for floating Window Managers, probably useless in tiling ones