From git-noreply at xxxxx Sat Jun 2 07:08:01 2018 From: git-noreply at xxxxx (=?utf-8?q?Dominic_Hopf?=) Date: Sat, 02 Jun 2018 07:08:01 -0000 Subject: [geany/plugins.geany.org] 2e197c: Merge pull request #13 from geany/dmaphy/Issue_12_Add_Pagetitle Message-ID: <20180602070808.8CCCB1E9EC0@mail.geany.org> Branch: refs/heads/master Author: Dominic Hopf Committer: GitHub Date: Sat, 02 Jun 2018 07:08:01 UTC Commit: 2e197c54d94ee1f47ce20a83125fea12c49f3833 https://github.com/geany/plugins.geany.org/commit/2e197c54d94ee1f47ce20a83125fea12c49f3833 Log Message: ----------- Merge pull request #13 from geany/dmaphy/Issue_12_Add_Pagetitle Issue#12: Add Pagetitle Modified Paths: -------------- content/downloads.html index.php Modified: content/downloads.html 6 lines changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -136,8 +136,8 @@

Verifying Signatures

@@ -149,7 +149,7 @@

Verifying Signatures

wget http://download.geany.org/frlan-pubkey.txt
gpg --import < frlan-pubkey.txt
-gpg --verify geany-plugins-1.29.tar.bz2.sig geany-plugins-1.29.tar.bz2 +gpg --verify geany-plugins-.tar.bz2.sig geany-plugins-.tar.bz2

Download directly from version control

Modified: index.php 5 lines changed, 4 insertions(+), 1 deletions(-) =================================================================== @@ -16,17 +16,20 @@ if (file_exists(CONTENTPATH . $_GET['site'] . '.html')) { define('CONTENTFILE', CONTENTPATH . $_GET['site'] . '.html'); + define('PAGETITLE', $_GET['site']); } else { define('CONTENTFILE', CONTENTPATH . '404.html'); + define('PAGETITLE', 'Plugin could not be found.'); } } else { define('CONTENTFILE', CONTENTPATH . 'start.html'); + define('PAGETITLE', ''); } print ''; @@ -37,7 +40,7 @@ - Plugins for Geany + Plugins for Geany [<?php print PAGETITLE ?>] -------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure). From git-noreply at xxxxx Sun Jun 3 06:54:37 2018 From: git-noreply at xxxxx (=?utf-8?q?Frank_Lanitz?=) Date: Sun, 03 Jun 2018 06:54:37 -0000 Subject: [geany/geany-plugins] fb82de: Revert "Merge pull request #677 from hyperair/webkit2gtk" Message-ID: <20180603065455.4579A1E9E9D@mail.geany.org> Branch: refs/heads/master Author: Frank Lanitz Committer: Frank Lanitz Date: Sun, 03 Jun 2018 06:54:37 UTC Commit: fb82de4c0e1e45dc000e47e5947796557c8efe3a https://github.com/geany/geany-plugins/commit/fb82de4c0e1e45dc000e47e5947796557c8efe3a Log Message: ----------- Revert "Merge pull request #677 from hyperair/webkit2gtk" This reverts commit 341cab4e13c122b2b74e6f31a43be9adc653f8af, reversing changes made to 1a575ee1b18070b9b6af4cae93d59b2f252cf5c7. Modified Paths: -------------- build/markdown.m4 build/webhelper.m4 markdown/src/Makefile.am markdown/src/viewer.c markdown/src/viewer.h webhelper/src/Makefile.am webhelper/src/gwh-browser.c webhelper/src/gwh-browser.h webhelper/src/gwh-plugin.c Modified: build/markdown.m4 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -49,13 +49,13 @@ AC_DEFUN([GP_CHECK_MARKDOWN], GTK_VERSION=2.16 WEBKIT_VERSION=1.1.13 - GP_CHECK_GTK3([webkit_package=webkit2gtk-4.0], + GP_CHECK_GTK3([webkit_package=webkitgtk-3.0], [webkit_package=webkit-1.0]) + GP_CHECK_PLUGIN_DEPS([markdown], [MARKDOWN], [$GP_GTK_PACKAGE >= ${GTK_VERSION} $webkit_package >= ${WEBKIT_VERSION} gthread-2.0]) - AM_CONDITIONAL([MARKDOWN_WEBKIT2], [test "$webkit_package" = webkit2gtk-4.0]) GP_COMMIT_PLUGIN_STATUS([Markdown]) Modified: build/webhelper.m4 5 lines changed, 3 insertions(+), 2 deletions(-) =================================================================== @@ -19,13 +19,14 @@ AC_DEFUN([GP_CHECK_WEBHELPER], fi fi - GP_CHECK_PLUGIN_GTK3_ONLY([webhelper]) + GP_CHECK_GTK3([webkit_package=webkitgtk-3.0], + [webkit_package=webkit-1.0]) GP_CHECK_PLUGIN_DEPS([WebHelper], [WEBHELPER], [$GP_GTK_PACKAGE >= ${GTK_VERSION} glib-2.0 >= ${GLIB_VERSION} gio-2.0 >= ${GIO_VERSION} gdk-pixbuf-2.0 >= ${GDK_PIXBUF_VERSION} - webkit2gtk-4.0 >= ${WEBKIT_VERSION} + $webkit_package >= ${WEBKIT_VERSION} gthread-2.0]) Modified: markdown/src/Makefile.am 4 lines changed, 0 insertions(+), 4 deletions(-) =================================================================== @@ -35,8 +35,4 @@ markdown_la_CFLAGS += $(LIBMARKDOWN_CFLAGS) markdown_la_LIBADD += $(LIBMARKDOWN_LIBS) endif -if MARKDOWN_WEBKIT2 -markdown_la_CFLAGS += -DMARKDOWN_WEBKIT2 -endif - include $(top_srcdir)/build/cppcheck.mk Modified: markdown/src/viewer.c 29 lines changed, 1 insertions(+), 28 deletions(-) =================================================================== @@ -22,11 +22,7 @@ #include "config.h" #include #include -#ifdef MARKDOWN_WEBKIT2 -# include -#else -# include -#endif +#include #include #ifndef FULL_PRICE # include @@ -300,18 +296,6 @@ pop_scroll_pos(MarkdownViewer *self) return popped; } -#ifdef MARKDOWN_WEBKIT2 -static void -on_webview_load_changed(MarkdownViewer *self, - WebKitLoadEvent load_event, - WebKitWebView *web_view) -{ - /* When the webkit is done loading, reset the scroll position. */ - if (load_event == WEBKIT_LOAD_FINISHED) { - pop_scroll_pos(self); - } -} -#else static void on_webview_load_status_notify(WebKitWebView *view, GParamSpec *pspec, MarkdownViewer *self) @@ -325,7 +309,6 @@ on_webview_load_status_notify(WebKitWebView *view, GParamSpec *pspec, pop_scroll_pos(self); } } -#endif gchar * markdown_viewer_get_html(MarkdownViewer *self) @@ -405,23 +388,13 @@ markdown_viewer_update_view(MarkdownViewer *self) /* Connect a signal handler (only needed once) to restore the scroll * position once the webview is reloaded. */ if (self->priv->load_handle == 0) { -#ifdef MARKDOWN_WEBKIT2 - self->priv->load_handle = - g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "load-changed", - G_CALLBACK(on_webview_load_changed), self); -#else self->priv->load_handle = g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "notify::load-status", G_CALLBACK(on_webview_load_status_notify), self); -#endif } -#ifdef MARKDOWN_WEBKIT2 - webkit_web_view_load_html(WEBKIT_WEB_VIEW(self), html, base_uri); -#else webkit_web_view_load_string(WEBKIT_WEB_VIEW(self), html, "text/html", self->priv->enc, base_uri); -#endif g_free(base_uri); g_free(html); Modified: markdown/src/viewer.h 6 lines changed, 1 insertions(+), 5 deletions(-) =================================================================== @@ -23,11 +23,7 @@ #define MARKDOWN_VIEWER_H 1 #include -#ifdef MARKDOWN_WEBKIT2 -# include -#else -# include -#endif +#include G_BEGIN_DECLS Modified: webhelper/src/Makefile.am 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -34,8 +34,7 @@ webhelper_la_CPPFLAGS = $(AM_CPPFLAGS) \ webhelper_la_CFLAGS = $(AM_CFLAGS) \ $(WEBHELPER_CFLAGS) webhelper_la_LIBADD = $(COMMONLIBS) \ - $(WEBHELPER_LIBS) \ - -lm + $(WEBHELPER_LIBS) # These are generated in $(srcdir) because they are part of the distribution, # and should anyway only be regenerated if the .tpl changes, which is a Modified: webhelper/src/gwh-browser.c 490 lines changed, 286 insertions(+), 204 deletions(-) =================================================================== @@ -21,15 +21,13 @@ #include "config.h" -#include #include #include #include #include #include -#include #include -#include +#include #include "gwh-utils.h" #include "gwh-settings.h" @@ -126,35 +124,33 @@ enum { }; static guint signals[LAST_SIGNAL] = {0}; -static const gdouble zoom_in_factor = 1.2; -static const gdouble zoom_out_factor = 1.0 / 1.2; G_DEFINE_TYPE_WITH_CODE (GwhBrowser, gwh_browser, GTK_TYPE_VBOX, G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)) +static void inspector_set_detached (GwhBrowser *self, + gboolean detached); + + static void set_location_icon (GwhBrowser *self, - const cairo_surface_t *icon_surface) + const gchar *icon_uri) { gboolean success = FALSE; - - if (icon_surface) { + + if (icon_uri) { GdkPixbuf *icon; - - icon = gdk_pixbuf_get_from_surface ( - icon_surface, 0, 0, - cairo_image_surface_get_width (icon_surface), - cairo_image_surface_get_height (icon_surface) - ); - - gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (self->priv->url_entry), - GTK_ENTRY_ICON_PRIMARY, icon); - g_object_unref (icon); - success = TRUE; + + icon = gwh_pixbuf_new_from_uri (icon_uri, NULL); + if (icon) { + gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (self->priv->url_entry), + GTK_ENTRY_ICON_PRIMARY, icon); + g_object_unref (icon); + success = TRUE; + } } - if (! success) { if (G_UNLIKELY (self->priv->default_icon == NULL)) { gchar *ctype; @@ -247,6 +243,17 @@ on_settings_inspector_window_geometry_notify (GObject *object, g_free (geometry); } +static void +on_settings_inspector_detached_notify (GObject *object, + GParamSpec *pspec, + GwhBrowser *self) +{ + gboolean detached; + + g_object_get (object, pspec->name, &detached, NULL); + inspector_set_detached (self, detached); +} + static void on_settings_wm_windows_skip_taskbar_notify (GObject *object, GParamSpec *pspec, @@ -283,10 +290,10 @@ on_settings_wm_windows_type_notify (GObject *object, /* web inspector events handling */ #define INSPECTOR_DETACHED(self) \ - (webkit_web_inspector_is_attached ((self)->priv->inspector)) + (gtk_bin_get_child (GTK_BIN ((self)->priv->inspector_window)) != NULL) #define INSPECTOR_VISIBLE(self) \ - (webkit_web_inspector_get_web_view ((self)->priv->inspector) != NULL) + (gtk_widget_get_visible ((self)->priv->inspector_view)) static void inspector_set_visible (GwhBrowser *self, @@ -301,22 +308,117 @@ inspector_set_visible (GwhBrowser *self, } } -static gboolean -on_inspector_closed (WebKitWebInspector *inspector, - GwhBrowser *self) +static void +inspector_hide_window (GwhBrowser *self) { - gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (self->priv->item_inspector), - FALSE); - return FALSE; + if (gtk_widget_get_visible (self->priv->inspector_window)) { + gtk_window_get_position (GTK_WINDOW (self->priv->inspector_window), + &self->priv->inspector_window_x, + &self->priv->inspector_window_y); + gtk_widget_hide (self->priv->inspector_window); + } +} + +static void +inspector_show_window (GwhBrowser *self) +{ + if (! gtk_widget_get_visible (self->priv->inspector_window)) { + gtk_widget_show (self->priv->inspector_window); + gtk_window_move (GTK_WINDOW (self->priv->inspector_window), + self->priv->inspector_window_x, + self->priv->inspector_window_y); + } +} + +static void +inspector_set_detached (GwhBrowser *self, + gboolean detached) +{ + if (detached != INSPECTOR_DETACHED (self)) { + if (detached) { + gtk_widget_reparent (self->priv->inspector_view, + self->priv->inspector_window); + if (INSPECTOR_VISIBLE (self)) { + inspector_show_window (self); + } + } else { + gtk_widget_reparent (self->priv->inspector_view, self->priv->paned); + inspector_hide_window (self); + } + g_object_set (self->priv->settings, "inspector-detached", detached, NULL); + } +} + +static WebKitWebView * +on_inspector_inspect_web_view (WebKitWebInspector *inspector, + WebKitWebView *view, + GwhBrowser *self) +{ + if (self->priv->inspector_web_view) { + gtk_widget_destroy (self->priv->inspector_web_view); + } + + self->priv->inspector_web_view = webkit_web_view_new (); + gtk_widget_show (self->priv->inspector_web_view); + gtk_container_add (GTK_CONTAINER (self->priv->inspector_view), + self->priv->inspector_web_view); + + return WEBKIT_WEB_VIEW (self->priv->inspector_web_view); } static gboolean -on_inspector_opened (WebKitWebInspector *inspector, +on_inspector_show_window (WebKitWebInspector *inspector, GwhBrowser *self) { + gtk_widget_show (self->priv->inspector_view); + if (INSPECTOR_DETACHED (self)) { + inspector_show_window (self); + } gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (self->priv->item_inspector), TRUE); - return FALSE; + + return TRUE; +} + +static gboolean +on_inspector_close_window (WebKitWebInspector *inspector, + GwhBrowser *self) +{ + gtk_widget_hide (self->priv->inspector_view); + inspector_hide_window (self); + gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (self->priv->item_inspector), + FALSE); + gtk_widget_grab_focus (gtk_widget_get_toplevel (self->priv->web_view)); + + return TRUE; +} + +static gboolean +on_inspector_detach_window (WebKitWebInspector *inspector, + GwhBrowser *self) +{ + inspector_set_detached (self, TRUE); + + return TRUE; +} + +static gboolean +on_inspector_attach_window (WebKitWebInspector *inspector, + GwhBrowser *self) +{ + inspector_set_detached (self, FALSE); + + return TRUE; +} + +static gboolean +on_inspector_window_delete_event (GtkWidget *window, + GdkEvent *event, + GwhBrowser *self) +{ + webkit_web_inspector_close (self->priv->inspector); + + return TRUE; } /* web view events hanlding */ @@ -417,9 +519,20 @@ update_load_status (GwhBrowser *self) { gboolean loading = FALSE; WebKitWebView *web_view = WEBKIT_WEB_VIEW (self->priv->web_view); - - loading = webkit_web_view_is_loading (web_view); - + + switch (webkit_web_view_get_load_status (web_view)) { + case WEBKIT_LOAD_PROVISIONAL: + case WEBKIT_LOAD_COMMITTED: + case WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT: + loading = TRUE; + break; + + case WEBKIT_LOAD_FINISHED: + case WEBKIT_LOAD_FAILED: + loading = FALSE; + break; + } + gtk_widget_set_sensitive (GTK_WIDGET (self->priv->item_reload), ! loading); gtk_widget_set_visible (GTK_WIDGET (self->priv->item_reload), ! loading); gtk_widget_set_sensitive (GTK_WIDGET (self->priv->item_cancel), loading); @@ -429,23 +542,23 @@ update_load_status (GwhBrowser *self) } static void -on_web_view_load_changed (WebKitWebView *object, - WebKitLoadEvent load_event, - GwhBrowser *self) +on_web_view_load_status_notify (GObject *object, + GParamSpec *pspec, + GwhBrowser *self) { update_load_status (self); } static gboolean -on_web_view_load_failed (WebKitWebView *web_view, - WebKitLoadEvent load_event, - gchar *failing_uri, - GError *error, - GwhBrowser *self) +on_web_view_load_error (WebKitWebView *web_view, + WebKitWebFrame *web_frame, + gchar *uri, + gpointer web_error, + GwhBrowser *self) { update_load_status (self); - return FALSE; /* we didn't really handle the error, so return %FALSE */ + return FALSE; /* we didn't really handled the error, so return %FALSE */ } static void @@ -462,14 +575,14 @@ on_web_view_uri_notify (GObject *object, } static void -on_web_view_favicon_notify (GObject *object, - GParamSpec *pspec, - GwhBrowser *self) +on_web_view_icon_uri_notify (GObject *object, + GParamSpec *pspec, + GwhBrowser *self) { - const cairo_surface_t *icon_surface; + const gchar *icon_uri; - icon_surface = webkit_web_view_get_favicon (WEBKIT_WEB_VIEW (self->priv->web_view)); - set_location_icon (self, icon_surface); + icon_uri = webkit_web_view_get_icon_uri (WEBKIT_WEB_VIEW (self->priv->web_view)); + set_location_icon (self, icon_uri); } static void @@ -479,7 +592,7 @@ on_web_view_progress_notify (GObject *object, { gdouble value; - value = webkit_web_view_get_estimated_load_progress (WEBKIT_WEB_VIEW (self->priv->web_view)); + value = webkit_web_view_get_progress (WEBKIT_WEB_VIEW (self->priv->web_view)); if (value >= 1.0) { value = 0.0; } @@ -488,9 +601,8 @@ on_web_view_progress_notify (GObject *object, static void -on_item_flip_orientation_activate (GSimpleAction *action, - GVariant *parameter, - GwhBrowser *self) +on_item_flip_orientation_activate (GtkMenuItem *item, + GwhBrowser *self) { gtk_orientable_set_orientation (GTK_ORIENTABLE (self), gtk_orientable_get_orientation (GTK_ORIENTABLE (self)) == GTK_ORIENTATION_VERTICAL @@ -499,124 +611,82 @@ on_item_flip_orientation_activate (GSimpleAction *action, } static void -on_item_zoom_100_activate (WebKitWebView *view) +on_item_zoom_100_activate (GtkMenuItem *item, + GwhBrowser *self) { - webkit_web_view_set_zoom_level (view, 1.0); + webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW (self->priv->web_view), 1.0); } static void -on_item_full_content_zoom_activate (GSimpleAction *action, - GVariant *dummy_parameter, - GwhBrowser *self) +on_item_full_content_zoom_activate (GtkCheckMenuItem *item, + GwhBrowser *self) { - WebKitSettings *settings; - gboolean zoom_text_only; - - settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (self->priv->web_view)); - - zoom_text_only = !webkit_settings_get_zoom_text_only (settings); - webkit_settings_set_zoom_text_only (settings, zoom_text_only); - g_simple_action_set_state (action, g_variant_new_boolean (!zoom_text_only)); -} - -static void web_view_zoom (WebKitWebView *view, gdouble factor) -{ - gdouble zoom_level = webkit_web_view_get_zoom_level (view); - webkit_web_view_set_zoom_level (view, zoom_level * factor); -} - -static void web_view_zoom_in (WebKitWebView *view) -{ - web_view_zoom (view, zoom_in_factor); + webkit_web_view_set_full_content_zoom (WEBKIT_WEB_VIEW (self->priv->web_view), + gtk_check_menu_item_get_active (item)); } -static void web_view_zoom_out (WebKitWebView *view) -{ - web_view_zoom (view, zoom_out_factor); -} - -static gboolean -on_web_view_context_menu (WebKitWebView *view, - WebKitContextMenu *context_menu, - GdkEvent *event, - WebKitHitTestResult *hit_test_result, - GwhBrowser *self) +static void +on_web_view_populate_popup (WebKitWebView *view, + GtkMenu *menu, + GwhBrowser *self) { - WebKitContextMenuItem *item; - WebKitContextMenu *submenu; - GAction *action; - GVariant *action_state; - - webkit_context_menu_append (context_menu, - webkit_context_menu_item_new_separator ()); - + GtkWidget *item; + GtkWidget *submenu; + + #define ADD_SEPARATOR(menu) \ + item = gtk_separator_menu_item_new (); \ + gtk_widget_show (item); \ + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item) + + ADD_SEPARATOR (menu); + /* Zoom menu */ - submenu = webkit_context_menu_new (); - item = webkit_context_menu_item_new_with_submenu (_("_Zoom"), submenu); - webkit_context_menu_append (context_menu, item); - + submenu = gtk_menu_new (); + item = gtk_menu_item_new_with_mnemonic (_("_Zoom")); + gtk_widget_show (item); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); /* zoom in */ - action = g_simple_action_new ("zoom-in", NULL); - g_signal_connect_swapped (action, "activate", - G_CALLBACK (web_view_zoom_in), view); - item = webkit_context_menu_item_new_from_gaction (action, _("Zoom _In"), - NULL); - webkit_context_menu_append (submenu, item); - + item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ZOOM_IN, NULL); + g_signal_connect_swapped (item, "activate", + G_CALLBACK (webkit_web_view_zoom_in), view); + gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); /* zoom out */ - action = g_simple_action_new ("zoom-out", NULL); - g_signal_connect_swapped (action, "activate", - G_CALLBACK (web_view_zoom_out), view); - item = webkit_context_menu_item_new_from_gaction (action, _("Zoom _Out"), - NULL); - webkit_context_menu_append (submenu, item); - + item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ZOOM_OUT, NULL); + g_signal_connect_swapped (item, "activate", + G_CALLBACK (webkit_web_view_zoom_out), view); + gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); /* zoom 1:1 */ - webkit_context_menu_append (submenu, - webkit_context_menu_item_new_separator ()); - action = g_simple_action_new ("zoom-reset", NULL); - g_signal_connect_swapped (action, "activate", - G_CALLBACK (on_item_zoom_100_activate), view); - item = webkit_context_menu_item_new_from_gaction (action, _("_Reset Zoom"), - NULL); - webkit_context_menu_append (submenu, item); - + ADD_SEPARATOR (submenu); + item = gtk_image_menu_item_new_from_stock (GTK_STOCK_ZOOM_100, NULL); + g_signal_connect (item, "activate", + G_CALLBACK (on_item_zoom_100_activate), self); + gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); /* 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 - ); - item = webkit_context_menu_item_new_from_gaction (action, - _("Full-_content zoom"), - NULL); - g_simple_action_set_enabled (action, TRUE); - webkit_context_menu_append (submenu, item); - g_signal_connect (action, "activate", - on_item_full_content_zoom_activate, self); - - /* flip panes orientation */ - webkit_context_menu_append (context_menu, - webkit_context_menu_item_new_separator ()); - action = g_simple_action_new ("flip-panes", NULL); - g_signal_connect_swapped (action, "activate", - G_CALLBACK (on_item_flip_orientation_activate), - view); - item = webkit_context_menu_item_new_from_gaction ( - action, _("_Flip panes orientation"), NULL); - webkit_context_menu_append (context_menu, item); + ADD_SEPARATOR (submenu); + item = gtk_check_menu_item_new_with_mnemonic (_("Full-_content zoom")); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), + webkit_web_view_get_full_content_zoom (view)); + g_signal_connect (item, "activate", + G_CALLBACK (on_item_full_content_zoom_activate), self); + gtk_menu_shell_append (GTK_MENU_SHELL (submenu), item); + /* show zoom sumbenu */ + gtk_widget_show_all (submenu); + + ADD_SEPARATOR (menu); + + item = gtk_menu_item_new_with_label (_("Flip panes orientation")); + g_signal_connect (item, "activate", + G_CALLBACK (on_item_flip_orientation_activate), self); + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); if (! INSPECTOR_VISIBLE (self) || INSPECTOR_DETACHED (self)) { - g_simple_action_set_enabled (action, FALSE); + gtk_widget_set_sensitive (item, FALSE); } - - g_signal_emit (self, signals[POPULATE_POPUP], 0, context_menu); - - return FALSE; + + #undef ADD_SEPARATOR + + g_signal_emit (self, signals[POPULATE_POPUP], 0, menu); } static gboolean @@ -626,32 +696,18 @@ on_web_view_scroll_event (GtkWidget *widget, { guint mods = event->state & gtk_accelerator_get_default_mod_mask (); gboolean handled = FALSE; - -#if GTK_CHECK_VERSION(3, 0, 0) - gdouble delta; - gdouble factor; -#endif if (mods == GDK_CONTROL_MASK) { handled = TRUE; switch (event->direction) { case GDK_SCROLL_DOWN: - web_view_zoom_out (WEBKIT_WEB_VIEW (self->priv->web_view)); + webkit_web_view_zoom_out (WEBKIT_WEB_VIEW (self->priv->web_view)); break; case GDK_SCROLL_UP: - web_view_zoom_in (WEBKIT_WEB_VIEW (self->priv->web_view)); + webkit_web_view_zoom_in (WEBKIT_WEB_VIEW (self->priv->web_view)); break; - -#if GTK_CHECK_VERSION(3, 0, 0) - case GDK_SCROLL_SMOOTH: - delta = event->delta_x + event->delta_y; - factor = pow (delta < 0 ? zoom_in_factor : zoom_out_factor, - fabs (delta)); - web_view_zoom (WEBKIT_WEB_VIEW (self->priv->web_view), factor); - break; -#endif - + default: handled = FALSE; } @@ -821,7 +877,7 @@ gwh_browser_class_init (GwhBrowserClass *klass) G_STRUCT_OFFSET (GwhBrowserClass, populate_popup), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, WEBKIT_TYPE_CONTEXT_MENU); + G_TYPE_NONE, 1, GTK_TYPE_MENU); g_object_class_override_property (object_class, PROP_ORIENTATION, @@ -963,6 +1019,33 @@ create_toolbar (GwhBrowser *self) return toolbar; } +static GtkWidget * +create_inspector_window (GwhBrowser *self) +{ + gboolean skips_taskbar; + gboolean window_type; + + g_object_get (self->priv->settings, + "wm-secondary-windows-skip-taskbar", &skips_taskbar, + "wm-secondary-windows-type", &window_type, + NULL); + self->priv->inspector_window_x = self->priv->inspector_window_y = 0; + self->priv->inspector_window = g_object_new (GTK_TYPE_WINDOW, + "type", GTK_WINDOW_TOPLEVEL, + "skip-taskbar-hint", skips_taskbar, + "type-hint", window_type, + "title", _("Web inspector"), + NULL); + g_signal_connect (self->priv->inspector_window, "delete-event", + G_CALLBACK (on_inspector_window_delete_event), self); + g_signal_connect (self->priv->settings, "notify::wm-secondary-windows-skip-taskbar", + G_CALLBACK (on_settings_wm_windows_skip_taskbar_notify), self); + g_signal_connect (self->priv->settings, "notify::wm-secondary-windows-type", + G_CALLBACK (on_settings_wm_windows_type_notify), self); + + return self->priv->inspector_window; +} + static guint get_statusbar_context_id (GtkStatusbar *statusbar) { @@ -976,24 +1059,18 @@ get_statusbar_context_id (GtkStatusbar *statusbar) } static void -on_web_view_mouse_target_changed (WebKitWebView *view, - WebKitHitTestResult *hit_test_result, - guint modifiers, - GwhBrowser *self) +on_web_view_hovering_over_link (WebKitWebView *view, + gchar *title, + gchar *uri, + GwhBrowser *self) { GtkStatusbar *statusbar = GTK_STATUSBAR (self->priv->statusbar); - const gchar *uri; - + if (self->priv->hovered_link) { gtk_statusbar_pop (statusbar, get_statusbar_context_id (statusbar)); g_free (self->priv->hovered_link); self->priv->hovered_link = NULL; } - - if (!webkit_hit_test_result_context_is_link (hit_test_result)) - return; - - uri = webkit_hit_test_result_get_link_uri (hit_test_result); if (uri && *uri) { self->priv->hovered_link = g_strdup (uri); gtk_statusbar_push (statusbar, get_statusbar_context_id (statusbar), @@ -1037,8 +1114,7 @@ static void gwh_browser_init (GwhBrowser *self) { GtkWidget *scrolled; - WebKitSettings *wkws; - WebKitWebContext *wkcontext; + WebKitWebSettings *wkws; gboolean inspector_detached; self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GWH_TYPE_BROWSER, @@ -1049,9 +1125,6 @@ gwh_browser_init (GwhBrowser *self) self->priv->web_view = webkit_web_view_new (); wkws = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (self->priv->web_view)); g_object_set (wkws, "enable-developer-extras", TRUE, NULL); - - wkcontext = webkit_web_view_get_context (WEBKIT_WEB_VIEW (self->priv->web_view)); - webkit_web_context_set_favicon_database_directory (wkcontext, NULL); self->priv->settings = gwh_settings_get_default (); g_object_get (self->priv->settings, @@ -1076,6 +1149,7 @@ gwh_browser_init (GwhBrowser *self) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); self->priv->inspector_web_view = NULL; + self->priv->inspector_window = create_inspector_window (self); gtk_container_add (GTK_CONTAINER (inspector_detached ? self->priv->inspector_window : self->priv->paned), @@ -1094,27 +1168,33 @@ gwh_browser_init (GwhBrowser *self) G_CALLBACK (on_orientation_notify), self); self->priv->inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (self->priv->web_view)); - g_signal_connect (self->priv->inspector, "bring-to-front", - G_CALLBACK (on_inspector_opened), self); - g_signal_connect (self->priv->inspector, "closed", - G_CALLBACK (on_inspector_closed), self); + g_signal_connect (self->priv->inspector, "inspect-web-view", + G_CALLBACK (on_inspector_inspect_web_view), self); + g_signal_connect (self->priv->inspector, "show-window", + G_CALLBACK (on_inspector_show_window), self); + g_signal_connect (self->priv->inspector, "close-window", + G_CALLBACK (on_inspector_close_window), self); + g_signal_connect (self->priv->inspector, "detach-window", + G_CALLBACK (on_inspector_detach_window), self); + g_signal_connect (self->priv->inspector, "attach-window", + G_CALLBACK (on_inspector_attach_window), self); g_signal_connect (G_OBJECT (self->priv->web_view), "notify::progress", G_CALLBACK (on_web_view_progress_notify), self); g_signal_connect (G_OBJECT (self->priv->web_view), "notify::uri", G_CALLBACK (on_web_view_uri_notify), self); - g_signal_connect (G_OBJECT (self->priv->web_view), "load-changed", - G_CALLBACK (on_web_view_load_changed), self); - g_signal_connect (G_OBJECT (self->priv->web_view), "load-failed", - G_CALLBACK (on_web_view_load_failed), self); - g_signal_connect (G_OBJECT (self->priv->web_view), "notify::favicon", - G_CALLBACK (on_web_view_favicon_notify), self); - g_signal_connect (G_OBJECT (self->priv->web_view), "context-menu", - G_CALLBACK (on_web_view_context_menu), self); + g_signal_connect (G_OBJECT (self->priv->web_view), "notify::load-status", + G_CALLBACK (on_web_view_load_status_notify), self); + g_signal_connect (G_OBJECT (self->priv->web_view), "notify::load-error", + G_CALLBACK (on_web_view_load_error), self); + g_signal_connect (G_OBJECT (self->priv->web_view), "notify::icon-uri", + G_CALLBACK (on_web_view_icon_uri_notify), self); + g_signal_connect (G_OBJECT (self->priv->web_view), "populate-popup", + G_CALLBACK (on_web_view_populate_popup), self); g_signal_connect (G_OBJECT (self->priv->web_view), "scroll-event", G_CALLBACK (on_web_view_scroll_event), self); - g_signal_connect (G_OBJECT (self->priv->web_view), "mouse-target-changed", - G_CALLBACK (on_web_view_mouse_target_changed), self); + g_signal_connect (G_OBJECT (self->priv->web_view), "hovering-over-link", + G_CALLBACK (on_web_view_hovering_over_link), self); g_signal_connect (G_OBJECT (self->priv->web_view), "leave-notify-event", G_CALLBACK (on_web_view_leave_notify_event), self); g_signal_connect (G_OBJECT (self->priv->web_view), "enter-notify-event", @@ -1135,6 +1215,8 @@ gwh_browser_init (GwhBrowser *self) G_CALLBACK (on_settings_browser_bookmarks_notify), self); g_signal_connect (self->priv->settings, "notify::browser-orientation", G_CALLBACK (on_settings_browser_orientation_notify), self); + g_signal_connect (self->priv->settings, "notify::inspector-detached", + G_CALLBACK (on_settings_inspector_detached_notify), self); g_signal_connect (self->priv->settings, "notify::inspector-window-geometry", G_CALLBACK (on_settings_inspector_window_geometry_notify), self); } @@ -1169,7 +1251,7 @@ gwh_browser_set_uri (GwhBrowser *self, } g_free (scheme); if (g_strcmp0 (real_uri, gwh_browser_get_uri (self)) != 0) { - webkit_web_view_load_uri (WEBKIT_WEB_VIEW (self->priv->web_view), real_uri); + webkit_web_view_open (WEBKIT_WEB_VIEW (self->priv->web_view), real_uri); g_object_notify (G_OBJECT (self), "uri"); } g_free (real_uri); Modified: webhelper/src/gwh-browser.h 6 lines changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -22,7 +22,7 @@ #include #include -#include +#include G_BEGIN_DECLS @@ -56,8 +56,8 @@ struct _GwhBrowserClass { GtkVBoxClass parent_class; - void (*populate_popup) (GwhBrowser *browser, - WebKitContextMenu *menu); + void (*populate_popup) (GwhBrowser *browser, + GtkMenu *menu); }; Modified: webhelper/src/gwh-plugin.c 50 lines changed, 19 insertions(+), 31 deletions(-) =================================================================== @@ -240,45 +240,33 @@ on_document_save (GObject *obj, } static void -on_item_auto_reload_toggled (GAction *action, - GVariant *parameter, - gpointer dummy) +on_item_auto_reload_toggled (GtkCheckMenuItem *item, + gpointer dummy) { - gboolean browser_auto_reload; - - g_object_get (G_OBJECT (G_settings), - "browser-auto-reload", &browser_auto_reload, NULL); g_object_set (G_OBJECT (G_settings), "browser-auto-reload", - !browser_auto_reload, NULL); - g_simple_action_set_state (action, g_variant_new_boolean (browser_auto_reload)); + gtk_check_menu_item_get_active (item), NULL); } static void -on_browser_populate_popup (GwhBrowser *browser, - WebKitContextMenu *menu, - gpointer dummy) +on_browser_populate_popup (GwhBrowser *browser, + GtkMenu *menu, + gpointer dummy) { - GAction *action; - gboolean auto_reload = FALSE; - GVariant *action_state; - WebKitContextMenuItem *item; - - webkit_context_menu_append (menu, - webkit_context_menu_item_new_separator ()); - + GtkWidget *item; + gboolean auto_reload = FALSE; + + item = gtk_separator_menu_item_new (); + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + 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 - ); - item = webkit_context_menu_item_new_from_gaction ( - action, _("Reload upon document saving"), NULL); - webkit_context_menu_append (menu, item); - g_signal_connect (action, "activate", - on_item_auto_reload_toggled, NULL); + item = gtk_check_menu_item_new_with_mnemonic (_("Reload upon document saving")); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), auto_reload); + gtk_widget_show (item); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + g_signal_connect (item, "toggled", G_CALLBACK (on_item_auto_reload_toggled), + NULL); } static void -------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure). From git-noreply at xxxxx Sun Jun 3 06:55:18 2018 From: git-noreply at xxxxx (=?utf-8?q?Frank_Lanitz?=) Date: Sun, 03 Jun 2018 06:55:18 -0000 Subject: [geany/geany-plugins] e803f5: Revert "Port both webhelper and markdown to webkit2gtk" Message-ID: <20180603065522.5D23E1EA9DC@mail.geany.org> Branch: refs/heads/revert-677-webkit2gtk Author: Frank Lanitz Committer: GitHub Date: Sun, 03 Jun 2018 06:55:18 UTC Commit: e803f5b4544d42aa9cd22cef4fbe0f9709021730 https://github.com/geany/geany-plugins/commit/e803f5b4544d42aa9cd22cef4fbe0f9709021730 Log Message: ----------- Revert "Port both webhelper and markdown to webkit2gtk" Modified Paths: -------------- -------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure). From git-noreply at xxxxx Sun Jun 3 06:58:01 2018 From: git-noreply at xxxxx (=?utf-8?q?Frank_Lanitz?=) Date: Sun, 03 Jun 2018 06:58:01 -0000 Subject: [geany/geany-plugins] 6705c5: Merge pull request #746 from codebrainz/markdown-webkit2gtk Message-ID: <20180603065806.AE5141EA9EC@mail.geany.org> Branch: refs/heads/master Author: Frank Lanitz Committer: GitHub Date: Sun, 03 Jun 2018 06:58:01 UTC Commit: 6705c54352b9b89a69e6c49bed6629cd43d2900f https://github.com/geany/geany-plugins/commit/6705c54352b9b89a69e6c49bed6629cd43d2900f Log Message: ----------- Merge pull request #746 from codebrainz/markdown-webkit2gtk Markdown: add support for webkit2gtk Modified Paths: -------------- build/markdown.m4 markdown/src/Makefile.am markdown/src/viewer.c markdown/src/viewer.h Modified: build/markdown.m4 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -49,13 +49,13 @@ AC_DEFUN([GP_CHECK_MARKDOWN], GTK_VERSION=2.16 WEBKIT_VERSION=1.1.13 - GP_CHECK_GTK3([webkit_package=webkitgtk-3.0], + GP_CHECK_GTK3([webkit_package=webkit2gtk-4.0], [webkit_package=webkit-1.0]) - GP_CHECK_PLUGIN_DEPS([markdown], [MARKDOWN], [$GP_GTK_PACKAGE >= ${GTK_VERSION} $webkit_package >= ${WEBKIT_VERSION} gthread-2.0]) + AM_CONDITIONAL([MARKDOWN_WEBKIT2], [test "$webkit_package" = webkit2gtk-4.0]) GP_COMMIT_PLUGIN_STATUS([Markdown]) Modified: markdown/src/Makefile.am 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -35,4 +35,8 @@ markdown_la_CFLAGS += $(LIBMARKDOWN_CFLAGS) markdown_la_LIBADD += $(LIBMARKDOWN_LIBS) endif +if MARKDOWN_WEBKIT2 +markdown_la_CFLAGS += -DMARKDOWN_WEBKIT2 +endif + include $(top_srcdir)/build/cppcheck.mk Modified: markdown/src/viewer.c 29 lines changed, 28 insertions(+), 1 deletions(-) =================================================================== @@ -22,7 +22,11 @@ #include "config.h" #include #include -#include +#ifdef MARKDOWN_WEBKIT2 +# include +#else +# include +#endif #include #ifndef FULL_PRICE # include @@ -296,6 +300,18 @@ pop_scroll_pos(MarkdownViewer *self) return popped; } +#ifdef MARKDOWN_WEBKIT2 +static void +on_webview_load_changed(MarkdownViewer *self, + WebKitLoadEvent load_event, + WebKitWebView *web_view) +{ + /* When the webkit is done loading, reset the scroll position. */ + if (load_event == WEBKIT_LOAD_FINISHED) { + pop_scroll_pos(self); + } +} +#else static void on_webview_load_status_notify(WebKitWebView *view, GParamSpec *pspec, MarkdownViewer *self) @@ -309,6 +325,7 @@ on_webview_load_status_notify(WebKitWebView *view, GParamSpec *pspec, pop_scroll_pos(self); } } +#endif gchar * markdown_viewer_get_html(MarkdownViewer *self) @@ -388,13 +405,23 @@ markdown_viewer_update_view(MarkdownViewer *self) /* Connect a signal handler (only needed once) to restore the scroll * position once the webview is reloaded. */ if (self->priv->load_handle == 0) { +#ifdef MARKDOWN_WEBKIT2 + self->priv->load_handle = + g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "load-changed", + G_CALLBACK(on_webview_load_changed), self); +#else self->priv->load_handle = g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "notify::load-status", G_CALLBACK(on_webview_load_status_notify), self); +#endif } +#ifdef MARKDOWN_WEBKIT2 + webkit_web_view_load_html(WEBKIT_WEB_VIEW(self), html, base_uri); +#else webkit_web_view_load_string(WEBKIT_WEB_VIEW(self), html, "text/html", self->priv->enc, base_uri); +#endif g_free(base_uri); g_free(html); Modified: markdown/src/viewer.h 6 lines changed, 5 insertions(+), 1 deletions(-) =================================================================== @@ -23,7 +23,11 @@ #define MARKDOWN_VIEWER_H 1 #include -#include +#ifdef MARKDOWN_WEBKIT2 +# include +#else +# include +#endif G_BEGIN_DECLS -------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure). From git-noreply at xxxxx Mon Jun 11 18:30:12 2018 From: git-noreply at xxxxx (=?utf-8?q?Frank_Lanitz?=) Date: Mon, 11 Jun 2018 18:30:12 -0000 Subject: [geany/geany-plugins] 4b7694: Updatechecker: Use HTTPS by default Message-ID: <20180611183023.164161EAA1F@mail.geany.org> Branch: refs/heads/master Author: Frank Lanitz Committer: Frank Lanitz Date: Mon, 11 Jun 2018 18:30:12 UTC Commit: 4b769465ab52ae069ba92c1ac6f6e814e3edd716 https://github.com/geany/geany-plugins/commit/4b769465ab52ae069ba92c1ac6f6e814e3edd716 Log Message: ----------- Updatechecker: Use HTTPS by default Modified Paths: -------------- updatechecker/src/updatechecker.c Modified: updatechecker/src/updatechecker.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -47,7 +47,7 @@ enum { UPDATECHECK_STARTUP }; -#define UPDATE_CHECK_URL "http://geany.org/service/version.php" +#define UPDATE_CHECK_URL "https://geany.org/service/version.php" static GtkWidget *main_menu_item = NULL; static void update_check_result_cb(SoupSession *session, -------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure). From git-noreply at xxxxx Sat Jun 16 17:41:20 2018 From: git-noreply at xxxxx (=?utf-8?b?SmnFmcOtIFRlY2hldA==?=) Date: Sat, 16 Jun 2018 17:41:20 -0000 Subject: [geany/geany-plugins] bb00b1: geanyctags: Use base path as relative to the project file path Message-ID: <20180617181733.790E81EAA61@mail.geany.org> Branch: refs/heads/master Author: Jiří Techet Committer: Jiří Techet Date: Sat, 16 Jun 2018 17:41:20 UTC Commit: bb00b19db5252616e55d1bcfb2ad54f7501f8389 https://github.com/geany/geany-plugins/commit/bb00b19db5252616e55d1bcfb2ad54f7501f8389 Log Message: ----------- geanyctags: Use base path as relative to the project file path When prj->base_path is relative, construct path using prj->file_name so base path is relative to the project file directory. Fixes #698 Modified Paths: -------------- geanyctags/src/geanyctags.c Modified: geanyctags/src/geanyctags.c 33 lines changed, 29 insertions(+), 4 deletions(-) =================================================================== @@ -205,6 +205,25 @@ static gchar *generate_find_string(GeanyProject *prj) } +static gchar *get_base_path(void) +{ + gchar *ret; + GeanyProject *prj = geany_data->app->project; + gchar *project_dir_utf8; + + if (!prj) + return NULL; + + if (g_path_is_absolute(prj->base_path)) + return g_strdup(prj->base_path); + + project_dir_utf8 = g_path_get_dirname(prj->file_name); + ret = g_build_filename(project_dir_utf8, prj->base_path, NULL); + g_free(project_dir_utf8); + return ret; +} + + static void on_generate_tags(GtkMenuItem *menuitem, gpointer user_data) { @@ -215,6 +234,7 @@ on_generate_tags(GtkMenuItem *menuitem, gpointer user_data) { gchar *cmd; gchar *tag_filename; + gchar *base_path; tag_filename = get_tags_filename(); @@ -236,10 +256,12 @@ on_generate_tags(GtkMenuItem *menuitem, gpointer user_data) tag_filename, "\"", NULL); #endif - spawn_cmd(cmd, prj->base_path); + base_path = get_base_path(); + spawn_cmd(cmd, base_path); g_free(cmd); g_free(tag_filename); + g_free(base_path); } } @@ -412,6 +434,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen tagFile *tf; GeanyProject *prj; gchar *tag_filename = NULL; + gchar *base_path; tagEntry entry; tagFileInfo info; int last_line_number = 0; @@ -420,8 +443,9 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen if (!prj) return; + base_path = get_base_path(); msgwin_clear_tab(MSG_MESSAGE); - msgwin_set_messages_dir(prj->base_path); + msgwin_set_messages_dir(base_path); tag_filename = get_tags_filename(); tf = tagsOpen(tag_filename, &info); @@ -445,7 +469,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen if (!filter_tag(&entry, name_pat, declaration, case_sensitive)) { - path = g_build_filename(prj->base_path, entry.file, NULL); + path = g_build_filename(base_path, entry.file, NULL); show_entry(&entry); last_line_number = entry.address.lineNumber; num++; @@ -456,7 +480,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen if (!filter_tag(&entry, name_pat, declaration, case_sensitive)) { if (!path) - path = g_build_filename(prj->base_path, entry.file, NULL); + path = g_build_filename(base_path, entry.file, NULL); show_entry(&entry); last_line_number = entry.address.lineNumber; num++; @@ -484,6 +508,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen msgwin_switch_tab(MSG_MESSAGE, TRUE); g_free(tag_filename); + g_free(base_path); } static void on_find_declaration(GtkMenuItem *menuitem, gpointer user_data) -------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure). From git-noreply at xxxxx Sun Jun 17 18:17:28 2018 From: git-noreply at xxxxx (=?utf-8?q?Frank_Lanitz?=) Date: Sun, 17 Jun 2018 18:17:28 -0000 Subject: [geany/geany-plugins] 640305: Merge pull request #755 from techee/ctags_relpath Message-ID: <20180617181734.035291EA9F1@mail.geany.org> Branch: refs/heads/master Author: Frank Lanitz Committer: GitHub Date: Sun, 17 Jun 2018 18:17:28 UTC Commit: 64030594a3542114501c9927dc3b3ec3a6f95b0b https://github.com/geany/geany-plugins/commit/64030594a3542114501c9927dc3b3ec3a6f95b0b Log Message: ----------- Merge pull request #755 from techee/ctags_relpath geanyctags: Use base path as relative to the project file path Modified Paths: -------------- geanyctags/src/geanyctags.c Modified: geanyctags/src/geanyctags.c 33 lines changed, 29 insertions(+), 4 deletions(-) =================================================================== @@ -205,6 +205,25 @@ static gchar *generate_find_string(GeanyProject *prj) } +static gchar *get_base_path(void) +{ + gchar *ret; + GeanyProject *prj = geany_data->app->project; + gchar *project_dir_utf8; + + if (!prj) + return NULL; + + if (g_path_is_absolute(prj->base_path)) + return g_strdup(prj->base_path); + + project_dir_utf8 = g_path_get_dirname(prj->file_name); + ret = g_build_filename(project_dir_utf8, prj->base_path, NULL); + g_free(project_dir_utf8); + return ret; +} + + static void on_generate_tags(GtkMenuItem *menuitem, gpointer user_data) { @@ -215,6 +234,7 @@ on_generate_tags(GtkMenuItem *menuitem, gpointer user_data) { gchar *cmd; gchar *tag_filename; + gchar *base_path; tag_filename = get_tags_filename(); @@ -236,10 +256,12 @@ on_generate_tags(GtkMenuItem *menuitem, gpointer user_data) tag_filename, "\"", NULL); #endif - spawn_cmd(cmd, prj->base_path); + base_path = get_base_path(); + spawn_cmd(cmd, base_path); g_free(cmd); g_free(tag_filename); + g_free(base_path); } } @@ -412,6 +434,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen tagFile *tf; GeanyProject *prj; gchar *tag_filename = NULL; + gchar *base_path; tagEntry entry; tagFileInfo info; int last_line_number = 0; @@ -420,8 +443,9 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen if (!prj) return; + base_path = get_base_path(); msgwin_clear_tab(MSG_MESSAGE); - msgwin_set_messages_dir(prj->base_path); + msgwin_set_messages_dir(base_path); tag_filename = get_tags_filename(); tf = tagsOpen(tag_filename, &info); @@ -445,7 +469,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen if (!filter_tag(&entry, name_pat, declaration, case_sensitive)) { - path = g_build_filename(prj->base_path, entry.file, NULL); + path = g_build_filename(base_path, entry.file, NULL); show_entry(&entry); last_line_number = entry.address.lineNumber; num++; @@ -456,7 +480,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen if (!filter_tag(&entry, name_pat, declaration, case_sensitive)) { if (!path) - path = g_build_filename(prj->base_path, entry.file, NULL); + path = g_build_filename(base_path, entry.file, NULL); show_entry(&entry); last_line_number = entry.address.lineNumber; num++; @@ -484,6 +508,7 @@ static void find_tags(const gchar *name, gboolean declaration, gboolean case_sen msgwin_switch_tab(MSG_MESSAGE, TRUE); g_free(tag_filename); + g_free(base_path); } static void on_find_declaration(GtkMenuItem *menuitem, gpointer user_data) -------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).