Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
1 files changed, 12 insertions, 5 deletions
-rw-r--r--badwolf.c17
diff --git a/badwolf.c b/badwolf.c
index 84344fc..4df0154 100644
--- a/badwolf.c
+++ b/badwolf.c
@@ -63,6 +63,7 @@ void new_tabCb_clicked(GtkButton *new_tab, gpointer user_data);
void closeCb_clicked(GtkButton *close, gpointer user_data);
int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser);
GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser);
+gint get_tab_position(GtkContainer *notebook, GtkWidget *child);
int main(int argc, char *argv[]);
static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data)
@@ -70,12 +71,8 @@ static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data)
(void)webView;
struct Client *browser = (struct Client *)user_data;
GtkNotebook *notebook = GTK_NOTEBOOK(browser->window->notebook);
- GValue position = G_VALUE_INIT;
- g_value_init(&position, G_TYPE_INT);
-
- gtk_container_child_get_property(GTK_CONTAINER(notebook), browser->box, "position", &position);
- gtk_notebook_remove_page(notebook, g_value_get_int(&position));
+ gtk_notebook_remove_page(notebook, get_tab_position(GTK_CONTAINER(notebook), browser->box));
gtk_widget_destroy(browser->box);
@@ -467,6 +464,16 @@ notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num,
gtk_window_set_title(GTK_WINDOW(window->main_window), gtk_widget_get_tooltip_text(label));
}
+gint get_tab_position(GtkContainer *notebook, GtkWidget *child)
+{
+ GValue position = G_VALUE_INIT;
+ g_value_init(&position, G_TYPE_INT);
+
+ gtk_container_child_get_property(notebook, child, "position", &position);
+
+ return g_value_get_int(&position);
+}
+
int main(int argc, char *argv[])
{
struct Window *window = g_malloc(sizeof(struct Client));