From 288b1e258989bed2de3400b954d98d41198895a5 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 18 Oct 2017 00:58:46 -0400 Subject: MqMainMenu: Use MqTabPage --- (limited to 'src/toolbars/navigation') diff --git a/src/toolbars/navigation/main-menu.c b/src/toolbars/navigation/main-menu.c index ad6809b..38fecd2 100644 --- a/src/toolbars/navigation/main-menu.c +++ b/src/toolbars/navigation/main-menu.c @@ -31,14 +31,14 @@ struct _MqMainMenu { GtkToolButton parent_instance; - MqTab *tab; + MqTabPage *tab_page; MqFindToolbar *find_toolbar; MqWebView *web_view; GtkWidget *popover; }; enum { - PROP_TAB = 1, + PROP_TAB_PAGE = 1, PROP_FIND_TOOLBAR, PROP_WEB_VIEW, N_PROPERTIES @@ -81,7 +81,7 @@ static void fullscreen_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqMainMenu *main_menu) { gtk_widget_hide(main_menu->popover); - mq_window_toggle_fullscreen(mq_tab_get_window(main_menu->tab)); + mq_window_toggle_fullscreen(mq_tab_page_get_window(main_menu->tab_page)); } static void @@ -97,27 +97,27 @@ static void preferences_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqMainMenu *main_menu) { gtk_widget_hide(main_menu->popover); - mq_tab_new("about:preferences", main_menu->tab); + mq_tab_page_new("about:preferences", main_menu->tab_page); /* TODO: Hack: */ - gtk_notebook_next_page(GTK_NOTEBOOK(main_menu->tab->window->notebook)); + gtk_notebook_next_page(GTK_NOTEBOOK(main_menu->tab_page->window->notebook)); } static void about_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqMainMenu *main_menu) { gtk_widget_hide(main_menu->popover); - mq_tab_new("about:", main_menu->tab); + mq_tab_page_new("about:", main_menu->tab_page); /* TODO: Hack: */ - gtk_notebook_next_page(GTK_NOTEBOOK(main_menu->tab->window->notebook)); + gtk_notebook_next_page(GTK_NOTEBOOK(main_menu->tab_page->window->notebook)); } static void quit_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqMainMenu *main_menu) { - /* mq_tab_quit() just calls mq_window_quit(), which just calls + /* mq_tab_page_quit() just calls mq_window_quit(), which just calls * mq_application_quit(), which is asynchronous. So close the menu. */ gtk_widget_hide(main_menu->popover); - mq_tab_quit(main_menu->tab); + mq_tab_page_quit(main_menu->tab_page); } #define BUTTON_ROWS 6 @@ -201,8 +201,8 @@ get_property(GObject *object, guint property_id, GValue *value, main_menu = MQ_MAIN_MENU(object); switch (property_id) { - case PROP_TAB: - g_value_set_pointer(value, main_menu->tab); + case PROP_TAB_PAGE: + g_value_set_object(value, main_menu->tab_page); break; case PROP_FIND_TOOLBAR: g_value_set_object(value, main_menu->find_toolbar); @@ -226,8 +226,8 @@ set_property(GObject *object, guint property_id, const GValue *value, main_menu = MQ_MAIN_MENU(object); switch (property_id) { - case PROP_TAB: - main_menu->tab = g_value_get_pointer(value); + case PROP_TAB_PAGE: + main_menu->tab_page = g_value_get_object(value); break; case PROP_FIND_TOOLBAR: main_menu->find_toolbar = g_value_get_object(value); @@ -250,10 +250,11 @@ mq_main_menu_class_init(MqMainMenuClass *klass) object_class->get_property = get_property; object_class->set_property = set_property; - obj_properties[PROP_TAB] = g_param_spec_pointer( - "tab", - "MqTab", - "The ancestral MqTab instance", + obj_properties[PROP_TAB_PAGE] = g_param_spec_object( + "tab-page", + "MqTabPage", + "The ancestral MqTabPage instance", + MQ_TYPE_TAB_PAGE, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB); obj_properties[PROP_FIND_TOOLBAR] = g_param_spec_object( @@ -287,10 +288,11 @@ mq_main_menu_init(MqMainMenu *main_menu) } GtkToolItem * -mq_main_menu_new(MqTab *tab, MqFindToolbar *find_toolbar, MqWebView *web_view) +mq_main_menu_new(MqTabPage *tab_page, MqFindToolbar *find_toolbar, + MqWebView *web_view) { return g_object_new(MQ_TYPE_MAIN_MENU, - "tab", tab, + "tab-page", tab_page, "find-toolbar", find_toolbar, "web-view", web_view, NULL); diff --git a/src/toolbars/navigation/main-menu.h b/src/toolbars/navigation/main-menu.h index e1e85da..2d93b47 100644 --- a/src/toolbars/navigation/main-menu.h +++ b/src/toolbars/navigation/main-menu.h @@ -50,7 +50,8 @@ GType mq_main_menu_get_type(void); GtkToolItem * -mq_main_menu_new(MqTab *tab, MqFindToolbar *find_toolbar, MqWebView *web_view); +mq_main_menu_new(MqTabPage *tab_page, MqFindToolbar *find_toolbar, + MqWebView *web_view); G_END_DECLS -- cgit v0.9.1