[devhelp] Window: remove ::open-link signal



commit 7477da64d6b40d7495e20273abf331a9afe22a21
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Dec 20 14:33:57 2017 +0100

    Window: remove ::open-link signal
    
    DhWindow is no longer part of the library, so it's possible to simplify
    the code.
    
    Removing the signal permits to remove dh-enum-types-app.
    
    Only DH_OPEN_LINK_NEW_TAB was used.
    
    The signal implementation for DH_OPEN_LINK_NEW_WINDOW was broken, since
    it just created a new window, it didn't open the link in the new window.

 docs/reference/Makefile.am       |    1 -
 src/Makefile.am                  |   25 ----------------------
 src/dh-enum-types-app.c.template |   39 -----------------------------------
 src/dh-enum-types-app.h.template |   27 ------------------------
 src/dh-window.c                  |   42 +-------------------------------------
 src/dh-window.h                  |   11 ----------
 6 files changed, 1 insertions(+), 144 deletions(-)
---
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index 1aa6a29..de1f5be 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -49,7 +49,6 @@ EXTRA_HFILES = \
 IGNORE_HFILES = \
        dh-app.h \
        dh-assistant.h \
-       dh-enum-types-app.h \
        dh-error.h \
        dh-language.h \
        dh-parser.h \
diff --git a/src/Makefile.am b/src/Makefile.am
index dd1d225..6603c67 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -77,22 +77,8 @@ app_c_files =                        \
        dh-window.c             \
        $(NULL)
 
-app_built_headers =            \
-       dh-enum-types-app.h     \
-       $(NULL)
-
-app_built_c_files =            \
-       dh-enum-types-app.c     \
-       $(NULL)
-
-app_built_sources =            \
-       $(app_built_headers)    \
-       $(app_built_c_files)    \
-       $(NULL)
-
 BUILT_SOURCES =                        \
        $(libdevhelp_built_sources)     \
-       $(app_built_sources)            \
        $(NULL)
 
 # The library
@@ -136,9 +122,6 @@ devhelp_SOURCES =   \
        $(app_c_files)  \
        $(NULL)
 
-nodist_devhelp_SOURCES =       \
-       $(app_built_sources)
-
 devhelp_CPPFLAGS =     \
        $(AM_CPPFLAGS)
 
@@ -170,17 +153,9 @@ dh-enum-types.h: dh-enum-types.h.template $(libdevhelp_public_headers) $(GLIB_MK
 dh-enum-types.c: dh-enum-types.c.template $(libdevhelp_public_headers) $(GLIB_MKENUMS)
        $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template dh-enum-types.c.template 
$(libdevhelp_public_headers)) > $@
 
-dh-enum-types-app.h: dh-enum-types-app.h.template $(app_headers) $(GLIB_MKENUMS)
-       $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template dh-enum-types-app.h.template $(app_headers)) 
$@
-
-dh-enum-types-app.c: dh-enum-types-app.c.template $(app_headers) $(GLIB_MKENUMS)
-       $(AM_V_GEN) (cd $(srcdir) && $(GLIB_MKENUMS) --template dh-enum-types-app.c.template $(app_headers)) 
$@
-
 EXTRA_DIST =                           \
        dh-enum-types.c.template        \
        dh-enum-types.h.template        \
-       dh-enum-types-app.c.template    \
-       dh-enum-types-app.h.template    \
        dh.gresource.xml                \
        $(resource_files)               \
        $(NULL)
diff --git a/src/dh-window.c b/src/dh-window.c
index b65b73c..d43e596 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -32,7 +32,6 @@
 #include "dh-sidebar.h"
 #include "dh-util.h"
 #include "dh-settings.h"
-#include "dh-enum-types-app.h"
 
 typedef struct {
         GMenuModel     *gear_app_menu;
@@ -51,13 +50,6 @@ typedef struct {
         guint           configure_id;
 } DhWindowPrivate;
 
-enum {
-        OPEN_LINK,
-        N_SIGNALS
-};
-
-static guint signals[N_SIGNALS] = { 0 };
-
 #define WINDOW_SETTINGS_SAVE_TIMEOUT_MSECS 100
 
 static guint tab_accel_keys[] = {
@@ -503,25 +495,6 @@ gear_menu_cb (GSimpleAction *action,
         g_variant_unref (state);
 }
 
-static void
-dh_window_open_link (DhWindow        *window,
-                     const char      *location,
-                     DhOpenLinkFlags  flags)
-{
-        switch (flags) {
-                case DH_OPEN_LINK_NEW_WINDOW:
-                        dh_app_new_window (DH_APP (gtk_window_get_application (GTK_WINDOW (window))));
-                        break;
-
-                case DH_OPEN_LINK_NEW_TAB:
-                        window_open_new_tab (window, location, FALSE);
-                        break;
-
-                default:
-                        g_assert_not_reached ();
-        }
-}
-
 static GActionEntry win_entries[] = {
         /* tabs */
         { "new-tab",          new_tab_cb },
@@ -722,19 +695,6 @@ dh_window_class_init (DhWindowClass *klass)
         widget_class->configure_event = dh_window_configure_event;
         widget_class->delete_event = dh_window_delete_event;
 
-        klass->open_link = dh_window_open_link;
-
-        signals[OPEN_LINK] =
-                g_signal_new ("open-link",
-                              G_TYPE_FROM_CLASS (klass),
-                              G_SIGNAL_RUN_LAST,
-                              G_STRUCT_OFFSET (DhWindowClass, open_link),
-                              NULL, NULL, NULL,
-                              G_TYPE_NONE,
-                              2,
-                              G_TYPE_STRING,
-                              DH_TYPE_OPEN_LINK_FLAGS);
-
         /* Bind class to template */
         gtk_widget_class_set_template_from_resource (widget_class,
                                                      "/org/gnome/devhelp/dh-window.ui");
@@ -942,7 +902,7 @@ window_web_view_decide_policy_cb (WebKitWebView            *web_view,
         state = webkit_navigation_action_get_modifiers (navigation_action);
         if (button == 2 || (button == 1 && state == GDK_CONTROL_MASK)) {
                 webkit_policy_decision_ignore (policy_decision);
-                g_signal_emit (window, signals[OPEN_LINK], 0, uri, DH_OPEN_LINK_NEW_TAB);
+                window_open_new_tab (window, uri, FALSE);
                 return GDK_EVENT_STOP;
         }
 
diff --git a/src/dh-window.h b/src/dh-window.h
index cafe301..bbbe161 100644
--- a/src/dh-window.h
+++ b/src/dh-window.h
@@ -36,23 +36,12 @@ G_BEGIN_DECLS
 typedef struct _DhWindow       DhWindow;
 typedef struct _DhWindowClass  DhWindowClass;
 
-typedef enum
-{
-        DH_OPEN_LINK_NEW_WINDOW = 1 << 0,
-        DH_OPEN_LINK_NEW_TAB    = 1 << 1
-} DhOpenLinkFlags;
-
 struct _DhWindow {
         GtkApplicationWindow parent_instance;
 };
 
 struct _DhWindowClass {
         GtkApplicationWindowClass parent_class;
-
-        /* Signals */
-        void (*open_link) (DhWindow        *window,
-                           const char      *location,
-                           DhOpenLinkFlags  flags);
 };
 
 GType      dh_window_get_type     (void) G_GNUC_CONST;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]