[devhelp] Window: better function order
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] Window: better function order
- Date: Sun, 18 Feb 2018 08:39:23 +0000 (UTC)
commit c54b9d9653a1aafb50067adc80f8d25656163e22
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Feb 18 08:52:27 2018 +0100
Window: better function order
Just move functions to have a more logical order.
The function prototype is anyway needed.
src/dh-window.c | 168 +++++++++++++++++++++++++++---------------------------
1 files changed, 84 insertions(+), 84 deletions(-)
---
diff --git a/src/dh-window.c b/src/dh-window.c
index a0c1e77..3d0514a 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -52,9 +52,9 @@ typedef struct {
DhLink *selected_link;
} DhWindowPrivate;
-static void open_new_tab (DhWindow *window,
- const gchar *location,
- gboolean switch_focus);
+static void open_new_tab (DhWindow *window,
+ const gchar *location,
+ gboolean switch_focus);
G_DEFINE_TYPE_WITH_PRIVATE (DhWindow, dh_window, GTK_TYPE_APPLICATION_WINDOW);
@@ -146,6 +146,46 @@ update_window_title (DhWindow *window)
}
static void
+update_zoom_actions_sensitivity (DhWindow *window)
+{
+ DhWebView *web_view;
+ GAction *action;
+ gboolean enabled;
+
+ web_view = get_active_web_view (window);
+
+ enabled = dh_web_view_can_zoom_in (web_view);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "zoom-in");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+
+ enabled = dh_web_view_can_zoom_out (web_view);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "zoom-out");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+
+ enabled = dh_web_view_can_reset_zoom (web_view);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "zoom-default");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+}
+
+static void
+update_back_forward_actions_sensitivity (DhWindow *window)
+{
+ WebKitWebView *web_view;
+ GAction *action;
+ gboolean enabled;
+
+ web_view = WEBKIT_WEB_VIEW (get_active_web_view (window));
+
+ enabled = web_view != NULL ? webkit_web_view_can_go_back (web_view) : FALSE;
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "go-back");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+
+ enabled = web_view != NULL ? webkit_web_view_can_go_forward (web_view) : FALSE;
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "go-forward");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+}
+
+static void
new_tab_cb (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -276,46 +316,6 @@ find_cb (GSimpleAction *action,
}
static void
-update_zoom_actions_sensitivity (DhWindow *window)
-{
- DhWebView *web_view;
- GAction *action;
- gboolean enabled;
-
- web_view = get_active_web_view (window);
-
- enabled = dh_web_view_can_zoom_in (web_view);
- action = g_action_map_lookup_action (G_ACTION_MAP (window), "zoom-in");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
-
- enabled = dh_web_view_can_zoom_out (web_view);
- action = g_action_map_lookup_action (G_ACTION_MAP (window), "zoom-out");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
-
- enabled = dh_web_view_can_reset_zoom (web_view);
- action = g_action_map_lookup_action (G_ACTION_MAP (window), "zoom-default");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
-}
-
-static void
-update_back_forward_actions_sensitivity (DhWindow *window)
-{
- WebKitWebView *web_view;
- GAction *action;
- gboolean enabled;
-
- web_view = WEBKIT_WEB_VIEW (get_active_web_view (window));
-
- enabled = web_view != NULL ? webkit_web_view_can_go_back (web_view) : FALSE;
- action = g_action_map_lookup_action (G_ACTION_MAP (window), "go-back");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
-
- enabled = web_view != NULL ? webkit_web_view_can_go_forward (web_view) : FALSE;
- action = g_action_map_lookup_action (G_ACTION_MAP (window), "go-forward");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
-}
-
-static void
zoom_in_cb (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -735,6 +735,47 @@ dh_window_init (DhWindow *window)
dh_sidebar_set_search_focus (priv->sidebar);
}
+static void
+web_view_title_notify_cb (DhWebView *web_view,
+ GParamSpec *param_spec,
+ DhWindow *window)
+{
+ if (web_view == get_active_web_view (window))
+ update_window_title (window);
+}
+
+static void
+web_view_zoom_level_notify_cb (DhWebView *web_view,
+ GParamSpec *pspec,
+ DhWindow *window)
+{
+ if (web_view == get_active_web_view (window))
+ update_zoom_actions_sensitivity (window);
+}
+
+static gboolean
+web_view_button_press_event_cb (WebKitWebView *web_view,
+ GdkEventButton *event,
+ DhWindow *window)
+{
+ switch (event->button) {
+ /* Some mice emit button presses when the scroll wheel is tilted
+ * to the side. Web browsers use them to navigate in history.
+ */
+ case 8:
+ webkit_web_view_go_back (web_view);
+ return GDK_EVENT_STOP;
+ case 9:
+ webkit_web_view_go_forward (web_view);
+ return GDK_EVENT_STOP;
+
+ default:
+ break;
+ }
+
+ return GDK_EVENT_PROPAGATE;
+}
+
static gchar *
find_equivalent_local_uri (const gchar *uri)
{
@@ -861,47 +902,6 @@ web_view_load_changed_cb (WebKitWebView *web_view,
}
static void
-web_view_title_notify_cb (DhWebView *web_view,
- GParamSpec *param_spec,
- DhWindow *window)
-{
- if (web_view == get_active_web_view (window))
- update_window_title (window);
-}
-
-static void
-web_view_zoom_level_notify_cb (DhWebView *web_view,
- GParamSpec *pspec,
- DhWindow *window)
-{
- if (web_view == get_active_web_view (window))
- update_zoom_actions_sensitivity (window);
-}
-
-static gboolean
-web_view_button_press_event_cb (WebKitWebView *web_view,
- GdkEventButton *event,
- DhWindow *window)
-{
- switch (event->button) {
- /* Some mice emit button presses when the scroll wheel is tilted
- * to the side. Web browsers use them to navigate in history.
- */
- case 8:
- webkit_web_view_go_back (web_view);
- return GDK_EVENT_STOP;
- case 9:
- webkit_web_view_go_forward (web_view);
- return GDK_EVENT_STOP;
-
- default:
- break;
- }
-
- return GDK_EVENT_PROPAGATE;
-}
-
-static void
open_new_tab (DhWindow *window,
const gchar *location,
gboolean switch_focus)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]