Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Thu, 16 Feb 2023 22:29:21 UTC Commit: 81c631fdeffc65f70319be2783d85ee35e255829 https://github.com/geany/geany-plugins/commit/81c631fdeffc65f70319be2783d85e...
Log Message: ----------- webhelper: Improve style
* Reorder calls to be more consistent when it doesn't affect behavior; * Remove unnecessary call setting a default value; * Better manage line length.
Modified Paths: -------------- webhelper/src/gwh-browser.c webhelper/src/gwh-plugin.c
Modified: webhelper/src/gwh-browser.c 18 lines changed, 6 insertions(+), 12 deletions(-) =================================================================== @@ -400,7 +400,7 @@ on_web_view_context_menu (WebKitWebView *view, WebKitContextMenuItem *item; WebKitContextMenu *submenu; GSimpleAction *action; - GVariant *action_state; + gboolean zoom_text_only;
webkit_context_menu_append (context_menu, webkit_context_menu_item_new_separator ()); @@ -442,21 +442,15 @@ on_web_view_context_menu (WebKitWebView *view, /* full content zoom */ webkit_context_menu_append (submenu, webkit_context_menu_item_new_separator ()); - action_state = g_variant_new_boolean ( - !webkit_settings_get_zoom_text_only (webkit_web_view_get_settings (view))); - - action = g_simple_action_new_stateful ( - "full-content-zoom", - NULL, - action_state - ); + zoom_text_only = webkit_settings_get_zoom_text_only (webkit_web_view_get_settings (view)); + action = g_simple_action_new_stateful ("full-content-zoom", NULL, + g_variant_new_boolean (!zoom_text_only)); + g_signal_connect (action, "activate", + G_CALLBACK (on_item_full_content_zoom_activate), self); item = webkit_context_menu_item_new_from_gaction (G_ACTION (action), _("Full-_content zoom"), NULL); - g_simple_action_set_enabled (action, TRUE); webkit_context_menu_append (submenu, item); - g_signal_connect (action, "activate", - G_CALLBACK (on_item_full_content_zoom_activate), self); g_object_unref (action);
g_signal_emit (self, signals[POPULATE_POPUP], 0, context_menu);
Modified: webhelper/src/gwh-plugin.c 10 lines changed, 4 insertions(+), 6 deletions(-) =================================================================== @@ -256,23 +256,21 @@ on_browser_populate_popup (GwhBrowser *browser, { GSimpleAction *action; gboolean auto_reload = FALSE; - GVariant *action_state; WebKitContextMenuItem *item;
webkit_context_menu_append (menu, webkit_context_menu_item_new_separator ());
g_object_get (G_OBJECT (G_settings), "browser-auto-reload", &auto_reload, NULL); - action_state = g_variant_new_boolean (auto_reload); - action = g_simple_action_new_stateful ("browser-auto-reload", - NULL, action_state); + action = g_simple_action_new_stateful ("browser-auto-reload", NULL, + g_variant_new_boolean (auto_reload)); + g_signal_connect (action, "activate", + G_CALLBACK (on_item_auto_reload_toggled), NULL); item = webkit_context_menu_item_new_from_gaction (G_ACTION (action), _("Reload upon document saving"), NULL); webkit_context_menu_append (menu, item); - g_signal_connect (action, "activate", - G_CALLBACK (on_item_auto_reload_toggled), NULL); g_object_unref (action); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).