From ab85075e032841edd47341ae48b1c24750a05493 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 16 Sep 2017 19:19:28 -0400 Subject: mq_tab_chrome_new(): Refactor navigation toolbar code into new function --- (limited to 'src') diff --git a/src/tab-chrome.c b/src/tab-chrome.c index 25e6f40..ba1e4d5 100644 --- a/src/tab-chrome.c +++ b/src/tab-chrome.c @@ -25,17 +25,12 @@ #include "tab-chrome.h" -MqTabChrome * -mq_tab_chrome_new(gchar *uri) +static GtkWidget * +navigation_toolbar_new(MqTabChrome *chrome, gchar *uri) { - MqTabChrome *chrome; GtkWidget *navigation_toolbar; GtkToolItem *location_bar_container; - chrome = malloc(sizeof(*chrome)); - - chrome->container = gtk_grid_new(); - navigation_toolbar = gtk_toolbar_new(); gtk_toolbar_insert(GTK_TOOLBAR(navigation_toolbar), gtk_tool_button_new( @@ -59,8 +54,19 @@ mq_tab_chrome_new(gchar *uri) location_bar_container, -1); gtk_widget_set_hexpand(navigation_toolbar, TRUE); - gtk_grid_attach(GTK_GRID(chrome->container), navigation_toolbar, - 0, 0, 1, 1); + return navigation_toolbar; +} + +MqTabChrome * +mq_tab_chrome_new(gchar *uri) +{ + MqTabChrome *chrome; + + chrome = malloc(sizeof(*chrome)); + + chrome->container = gtk_grid_new(); + gtk_grid_attach(GTK_GRID(chrome->container), + navigation_toolbar_new(chrome, uri), 0, 0, 1, 1); return chrome; } -- cgit v0.9.1