diff options
author | Iulian Radu <iulian.radu67@gmail.com> | 2016-07-23 22:27:54 +0300 |
---|---|---|
committer | Iulian Radu <iulian.radu67@gmail.com> | 2016-07-28 14:23:43 +0300 |
commit | 133c02e34ba1f0e14468a70f7af96d80b40779f0 (patch) | |
tree | e9b72cb3cd5ec8c11f8f81e5901e082e988adad4 | |
parent | a55e05267dce59bae302a68b346d0f209a3f730c (diff) | |
download | epiphany-133c02e34ba1f0e14468a70f7af96d80b40779f0.tar.gz |
Misc: coding style fixes
-rw-r--r-- | src/bookmarks/ephy-bookmarks-menu.c | 2 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-ui.c | 8 | ||||
-rw-r--r-- | src/bookmarks/ephy-topic-action.c | 37 | ||||
-rw-r--r-- | src/ephy-lockdown.c | 8 | ||||
-rw-r--r-- | src/ephy-toolbar.c | 34 | ||||
-rw-r--r-- | src/ephy-window.c | 15 | ||||
-rw-r--r-- | src/popup-commands.h | 20 | ||||
-rw-r--r-- | src/window-commands.c | 3 |
8 files changed, 31 insertions, 96 deletions
diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c index 9b92ba10f..4a89d58c5 100644 --- a/src/bookmarks/ephy-bookmarks-menu.c +++ b/src/bookmarks/ephy-bookmarks-menu.c @@ -47,7 +47,7 @@ enum { /* Construct a block of bookmark actions. Note that no bookmark action appears * more than once in a menu, so no need to supply names. */ static void -append_bookmarks (GMenu *menu, +append_bookmarks (GMenu *menu, const GPtrArray *bookmarks) { EphyNode *child; diff --git a/src/bookmarks/ephy-bookmarks-ui.c b/src/bookmarks/ephy-bookmarks-ui.c index 3170da5c1..52b5920c0 100644 --- a/src/bookmarks/ephy-bookmarks-ui.c +++ b/src/bookmarks/ephy-bookmarks-ui.c @@ -79,7 +79,8 @@ find_bookmarks_menu (EphyWindow *window) /* Looking for the bookmarks section */ section_label = g_menu_model_get_item_attribute_value (page_menu, i, "id", G_VARIANT_TYPE_STRING); if (section_label != NULL && g_strcmp0 (g_variant_get_string (section_label, NULL), "bookmarks-section") == 0) { - GMenuModel *bookmarks_section_model, *bookmarks_menu_model; + GMenuModel *bookmarks_section_model; + GMenuModel *bookmarks_menu_model; /* Bookmarks section should contain the bookmarks menu */ bookmarks_section_model = g_menu_model_get_item_link (page_menu, i, G_MENU_LINK_SECTION); @@ -107,7 +108,7 @@ activate_bookmarks_menu (GSimpleAction *action, menu = g_menu_new (); ephy_bookmarks_menu_build (menu, 0); - data->bookmarks_menu = G_MENU(find_bookmarks_menu (EPHY_WINDOW (user_data))); + data->bookmarks_menu = G_MENU (find_bookmarks_menu (EPHY_WINDOW (user_data))); if (data->bookmarks_menu == NULL) return G_SOURCE_REMOVE; @@ -126,8 +127,7 @@ erase_bookmarks_menu (EphyWindow *window) if (data != NULL && data->bookmarks_menu != NULL) { g_menu_remove_all (data->bookmarks_menu); - g_object_unref (data->bookmarks_menu); - data->bookmarks_menu = NULL; + g_clear_object (&data->bookmarks_menu); } } diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c index 80e1a478b..57eff2ae4 100644 --- a/src/bookmarks/ephy-topic-action.c +++ b/src/bookmarks/ephy-topic-action.c @@ -83,36 +83,6 @@ ephy_topic_action_sync_label (GtkAction *action, g_value_unset (&value); } -#if 0 -static GtkWidget * -get_popup (EphyTopicAction *action) -{ - EphyTopicActionPrivate *priv = action->priv; - char path[40]; - - g_snprintf (path, sizeof (path), "/PopupTopic%ld", - (long int)ephy_node_get_id (action->priv->node)); - - if (priv->merge_id == 0) { - GString *popup_menu_string; - - popup_menu_string = g_string_new (NULL); - g_string_append_printf (popup_menu_string, "<ui><popup name=\"%s\">", path + 1); - - ephy_bookmarks_menu_build (popup_menu_string, priv->node); - g_string_append (popup_menu_string, "</popup></ui>"); - - priv->merge_id = gtk_ui_manager_add_ui_from_string - (priv->manager, popup_menu_string->str, - popup_menu_string->len, 0); - - g_string_free (popup_menu_string, TRUE); - } - - return gtk_ui_manager_get_widget (priv->manager, path); -} -#endif - static void erase_popup (EphyTopicAction *action) { @@ -167,13 +137,6 @@ menu_init_cb (GtkWidget *menuitem, EphyTopicAction *action) { if (gtk_menu_item_get_submenu (GTK_MENU_ITEM (menuitem)) == NULL) { - #if 0 - GtkWidget *popup; - - /* Disabled. Will be removed in the upcoming bookmarks subsystem update */ - popup = get_popup (action); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), popup); - #endif g_signal_connect (menuitem, "destroy", G_CALLBACK (menu_destroy_cb), NULL); } diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c index eac42c645..c0d2b7a43 100644 --- a/src/ephy-lockdown.c +++ b/src/ephy-lockdown.c @@ -210,21 +210,21 @@ window_added_cb (GtkApplication *application, G_N_ELEMENTS (app_actions)); action_group = gtk_widget_get_action_group (GTK_WIDGET (window), - "win"); + "win"); bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN, action_group, window_actions, G_N_ELEMENTS (window_actions)); action_group = gtk_widget_get_action_group (GTK_WIDGET (window), - "tab"); + "tab"); bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN, action_group, tab_actions, G_N_ELEMENTS (tab_actions)); action_group = gtk_widget_get_action_group (GTK_WIDGET (window), - "toolbar"); + "toolbar"); bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN, action_group, toolbar_actions, @@ -237,7 +237,7 @@ window_added_cb (GtkApplication *application, G_N_ELEMENTS (popup_actions)); action = g_action_map_lookup_action (G_ACTION_MAP (action_group), - "set-image-as-background"); + "set-image-as-background"); settings = ephy_settings_get ("org.gnome.desktop.background"); g_settings_bind_writable (settings, "picture-filename", action, "enabled", FALSE); diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c index 66c0fe651..d8af7ef13 100644 --- a/src/ephy-toolbar.c +++ b/src/ephy-toolbar.c @@ -2,6 +2,7 @@ /* * Copyright © 2012 Igalia S.L * Copyright © 2013 Yosef Or Boczko <yoseforb@gmail.com> + * Copyright © 2016 Iulian-Gabriel Radu <iulian.radu67@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -283,23 +284,11 @@ new_history_menu_item (EphyWebView *view, } static void -set_new_back_history (EphyEmbed *source, - EphyEmbed *dest, - gint offset) -{ - /* TODO: WebKitBackForwardList: In WebKit2 WebKitBackForwardList can't be modified */ -} - -static void middle_click_handle_on_history_menu_item (EphyEmbed *embed, WebKitBackForwardListItem *item) { EphyEmbed *new_embed = NULL; const gchar *url; - gint offset; - - /* TODO: WebKitBackForwardList is read-only in WebKit2 */ - offset = 0; new_embed = ephy_shell_new_tab (ephy_shell_get_default (), EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed))), @@ -307,11 +296,6 @@ middle_click_handle_on_history_menu_item (EphyEmbed *embed, 0); g_return_if_fail (new_embed != NULL); - /* We manually set the back history instead of trusting - ephy_shell_new_tab because the logic is more complex than - usual, due to handling also the forward history */ - set_new_back_history (embed, new_embed, offset); - /* Load the new URL */ url = webkit_back_forward_list_item_get_original_uri (item); ephy_web_view_load_url (ephy_embed_get_web_view (new_embed), url); @@ -330,7 +314,7 @@ navigation_menu_item_pressed_cb (GtkWidget *menuitem, item = (WebKitBackForwardListItem *)g_object_get_data (G_OBJECT (menuitem), HISTORY_ITEM_DATA_KEY); - if (((GdkEventButton *)event)->button == 2) { + if (((GdkEventButton *)event)->button == GDK_BUTTON_MIDDLE) { middle_click_handle_on_history_menu_item (embed, item); } else { WebKitWebView *web_view; @@ -455,7 +439,7 @@ navigation_button_press_event_cb (GtkButton *button, direction = strstr (action_name, "back") ? EPHY_NAVIGATION_HISTORY_DIRECTION_BACK : EPHY_NAVIGATION_HISTORY_DIRECTION_FORWARD; - if (((GdkEventButton *)event)->button == 3) { + if (((GdkEventButton *)event)->button == GDK_BUTTON_SECONDARY) { popup_history_menu (GTK_WIDGET (button), toolbar->window, direction, (GdkEventButton *)event); } else { @@ -659,6 +643,7 @@ ephy_toolbar_constructed (GObject *object) gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (page_menu)); g_object_unref (builder); + menu = gtk_menu_button_get_popup (GTK_MENU_BUTTON (button)); gtk_widget_set_halign (GTK_WIDGET (menu), GTK_ALIGN_END); gtk_header_bar_pack_end (GTK_HEADER_BAR (toolbar), button); @@ -719,20 +704,12 @@ ephy_toolbar_dispose (GObject *object) g_clear_object (&toolbar->window); g_clear_object (&toolbar->title_box); - G_OBJECT_CLASS (ephy_toolbar_parent_class)->dispose (object); -} - -static void -ephy_toolbar_finalize (GObject *object) -{ - EphyToolbar *toolbar = EPHY_TOOLBAR (object); - if (toolbar->navigation_buttons_menu_timeout > 0) { g_source_remove (toolbar->navigation_buttons_menu_timeout); toolbar->navigation_buttons_menu_timeout = 0; } - G_OBJECT_CLASS (ephy_toolbar_parent_class)->finalize (object); + G_OBJECT_CLASS (ephy_toolbar_parent_class)->dispose (object); } static void @@ -741,7 +718,6 @@ ephy_toolbar_class_init (EphyToolbarClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gobject_class->dispose = ephy_toolbar_dispose; - gobject_class->finalize = ephy_toolbar_finalize; gobject_class->set_property = ephy_toolbar_set_property; gobject_class->get_property = ephy_toolbar_get_property; gobject_class->constructed = ephy_toolbar_constructed; diff --git a/src/ephy-window.c b/src/ephy-window.c index 95879c18f..de3d734ed 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -997,9 +997,9 @@ _ephy_window_set_default_actions_sensitive (EphyWindow *window, /* Page context popup */ action_group = gtk_widget_get_action_group (GTK_WIDGET (window), "popup"); action = g_action_map_lookup_action (G_ACTION_MAP (action_group), - "context-bookmark-page"); + "context-bookmark-page"); ephy_action_change_sensitivity_flags (G_SIMPLE_ACTION (action), - flags, set); + flags, set); /* Toolbar */ action_group = gtk_widget_get_action_group (GTK_WIDGET (window), "toolbar"); @@ -1269,7 +1269,7 @@ action_activate_cb (GtkAction *action, gpointer user_data) g_slice_free (GActionData, action_data); } -static WebKitContextMenuItem* +static WebKitContextMenuItem * webkit_context_menu_item_new_from_gaction (GAction *action, const gchar *label) { GtkAction *gtk_action; @@ -1281,8 +1281,7 @@ webkit_context_menu_item_new_from_gaction (GAction *action, const gchar *label) if (g_action_get_parameter_type (action) != NULL && g_variant_type_equal (g_action_get_parameter_type (action), G_VARIANT_TYPE_STRING)) { action_data->parameter = g_variant_new_string (label); - } - else { + } else { action_data->parameter = NULL; } @@ -2304,10 +2303,6 @@ show_notebook_popup_menu (GtkNotebook *notebook, GAction *action; builder = gtk_builder_new_from_resource ("/org/gnome/epiphany/gtk/menus.ui"); - if (!builder) { - g_object_unref (builder); - return FALSE; - } menu_model = G_MENU (gtk_builder_get_object (builder, "notebook-menu")); menu = gtk_menu_new_from_model (G_MENU_MODEL (menu_model)); @@ -3022,7 +3017,7 @@ ephy_window_constructor (GType type, /* other notifiers */ action_group = gtk_widget_get_action_group (GTK_WIDGET (window), "win"); new_action = g_action_map_lookup_action (G_ACTION_MAP (action_group), - "browse-with-caret"); + "browse-with-caret"); g_settings_bind_with_mapping (EPHY_SETTINGS_MAIN, EPHY_PREFS_ENABLE_CARET_BROWSING, diff --git a/src/popup-commands.h b/src/popup-commands.h index 5b736f1fb..2424e3b78 100644 --- a/src/popup-commands.h +++ b/src/popup-commands.h @@ -24,43 +24,43 @@ G_BEGIN_DECLS -void popup_cmd_link_in_new_window (GSimpleAction *action, +void popup_cmd_link_in_new_window (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void popup_cmd_link_in_new_tab (GSimpleAction *action, +void popup_cmd_link_in_new_tab (GSimpleAction *action, GVariant *parameter, gpointer user_data); void popup_cmd_link_in_incognito_window (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void popup_cmd_bookmark_link (GSimpleAction *action, +void popup_cmd_bookmark_link (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void popup_cmd_view_source (GSimpleAction *action, +void popup_cmd_view_source (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void popup_cmd_copy_link_address (GSimpleAction *action, +void popup_cmd_copy_link_address (GSimpleAction *action, GVariant *parameter, gpointer user_data); void popup_cmd_copy_link_location (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void popup_cmd_download_link_as (GSimpleAction *action, +void popup_cmd_download_link_as (GSimpleAction *action, GVariant *parameter, gpointer user_data); void popup_cmd_set_image_as_background (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void popup_cmd_copy_image_location (GSimpleAction *action, +void popup_cmd_copy_image_location (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void popup_cmd_view_image_in_new_tab (GSimpleAction *action, +void popup_cmd_view_image_in_new_tab (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void popup_cmd_download_link (GSimpleAction *action, +void popup_cmd_download_link (GSimpleAction *action, GVariant *parameter, gpointer user_data); -void popup_cmd_save_image_as (GSimpleAction *action, +void popup_cmd_save_image_as (GSimpleAction *action, GVariant *parameter, gpointer user_data); void popup_cmd_media_in_new_window (GSimpleAction *action, diff --git a/src/window-commands.c b/src/window-commands.c index 6b14b7ed0..8d3ed38cc 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -4,6 +4,7 @@ * Copyright © 2000-2004 Marco Pesenti Gritti * Copyright © 2009 Collabora Ltd. * Copyright © 2011 Igalia S.L. + * Copyright © 2016 Iulian-Gabriel Radu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -250,7 +251,7 @@ window_cmd_show_about (GSimpleAction *action, "program-name", _("Web"), "version", VERSION, "copyright", "Copyright © 2002–2004 Marco Pesenti Gritti\n" - "Copyright © 2003–2014 The Web Developers", + "Copyright © 2003–2016 The Web Developers", "artists", artists, "authors", authors, "comments", comments, |