talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit e0db6026a22b084f296c004f48ab86d3ab5a3e8e
parent 2a91260a6c7f35cb9e22b1e5695606c3d7295269
Author: Colin Leroy <colin@colino.net>
Date:   Tue,  2 Oct 2018 16:34:17 +0200

Merge branch 'master' of ssh+git://git.claws-mail.org/home/git/claws

Diffstat:
Msrc/common/utils.c | 11-----------
Msrc/common/utils.h | 5-----
Msrc/plugins/fancy/fancy_viewer.c | 23-----------------------
Msrc/plugins/fancy/fancy_viewer.h | 4----
Msrc/prefs_themes.c | 57++++++++++++++++++++++++++++-----------------------------
5 files changed, 28 insertions(+), 72 deletions(-)

diff --git a/src/common/utils.c b/src/common/utils.c @@ -90,17 +90,6 @@ static gboolean debug_mode = FALSE; -/* Return true if we are running as root. This function should beused - instead of getuid () == 0. */ -gboolean superuser_p (void) -{ -#ifdef G_OS_WIN32 - return w32_is_administrator (); -#else - return !getuid(); -#endif -} - GSList *slist_copy_deep(GSList *list, GCopyFunc func) { #if GLIB_CHECK_VERSION(2, 34, 0) diff --git a/src/common/utils.h b/src/common/utils.h @@ -247,11 +247,6 @@ gboolean debug_get_mode (void); #define Str(x) #x #define Xstr(x) Str(x) - -/* System related stuff. */ - -gboolean superuser_p (void); - /* List utilities. */ GSList *slist_copy_deep (GSList *list, diff --git a/src/plugins/fancy/fancy_viewer.c b/src/plugins/fancy/fancy_viewer.c @@ -70,10 +70,6 @@ static void *download_file_curl (void *data); static void download_file_cb(GtkWidget *widget, FancyViewer *viewer); static gboolean fancy_set_contents(FancyViewer *viewer, gboolean use_defaults); -#if !WEBKIT_CHECK_VERSION (1,5,1) -gchar* webkit_web_view_get_selected_text(WebKitWebView* web_view); -#endif - /*------*/ static GtkWidget *fancy_get_widget(MimeViewer *_viewer) { @@ -343,7 +339,6 @@ static gchar *fancy_get_selection (MimeViewer *_viewer) { debug_print("fancy_get_selection\n"); FancyViewer *viewer = (FancyViewer *) _viewer; -#if WEBKIT_CHECK_VERSION(1,5,1) viewer->doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(viewer->view)); viewer->window = webkit_dom_document_get_default_view (viewer->doc); viewer->selection = webkit_dom_dom_window_get_selection (viewer->window); @@ -353,9 +348,6 @@ static gchar *fancy_get_selection (MimeViewer *_viewer) if (viewer->range == NULL) return NULL; gchar *sel = webkit_dom_range_get_text (viewer->range); -#else - gchar *sel = webkit_web_view_get_selected_text(viewer->view); -#endif if (!viewer->view || strlen(sel) == 0) { g_free(sel); return NULL; @@ -627,15 +619,11 @@ static void search_the_web_cb(GtkWidget *widget, FancyViewer *viewer) debug_print("Clicked on Search on Web\n"); if (webkit_web_view_has_selection(viewer->view)) { gchar *search; -#if WEBKIT_CHECK_VERSION(1,5,1) viewer->doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(viewer->view)); viewer->window = webkit_dom_document_get_default_view (viewer->doc); viewer->selection = webkit_dom_dom_window_get_selection (viewer->window); viewer->range = webkit_dom_dom_selection_get_range_at(viewer->selection, 0, NULL); gchar *tmp = webkit_dom_range_get_text (viewer->range); -#else - gchar *tmp = webkit_web_view_get_selected_text(viewer->view); -#endif search = g_strconcat(GOOGLE_SEARCH, tmp, NULL); webkit_web_view_load_uri(viewer->view, search); @@ -890,8 +878,6 @@ static gboolean release_button_cb (WebKitWebView *view, GdkEvent *ev, FancyViewer *viewer) { if (ev->button.button == 1 && viewer->cur_link && viewer->override_prefs_external) { -#if WEBKIT_CHECK_VERSION(1,9,3) - /* The x and y properties were added in 1.9.3 */ gint x, y; WebKitHitTestResult *result; result = webkit_web_view_get_hit_test_result(view, (GdkEventButton *)ev); @@ -904,7 +890,6 @@ static gboolean release_button_cb (WebKitWebView *view, GdkEvent *ev, * want to open the link. */ if ((x != viewer->click_x || y != viewer->click_y)) return FALSE; -#endif open_uri(viewer->cur_link, prefs_common_get_uri_cmd()); return TRUE; @@ -915,16 +900,13 @@ static gboolean release_button_cb (WebKitWebView *view, GdkEvent *ev, static gboolean press_button_cb (WebKitWebView *view, GdkEvent *ev, FancyViewer *viewer) { -#if WEBKIT_CHECK_VERSION(1,5,1) gint type = 0; WebKitHitTestResult *result = webkit_web_view_get_hit_test_result(view, (GdkEventButton *)ev); g_object_get(G_OBJECT(result), "context", &type, -# if WEBKIT_CHECK_VERSION(1,9,3) "x", &viewer->click_x, "y", &viewer->click_y, -# endif /* 1.9.3 */ NULL); if (type & WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION) @@ -935,7 +917,6 @@ static gboolean press_button_cb (WebKitWebView *view, GdkEvent *ev, viewer->selection = webkit_dom_dom_window_get_selection (viewer->window); if (viewer->selection != NULL) webkit_dom_dom_selection_empty(viewer->selection); -#endif /* 1.5.1 */ return FALSE; } @@ -956,7 +937,6 @@ static void zoom_out_cb(GtkWidget *widget, GdkEvent *ev, FancyViewer *viewer) webkit_web_view_zoom_out(viewer->view); } -#if WEBKIT_CHECK_VERSION (1,7,5) static void resource_load_failed_cb(WebKitWebView *web_view, WebKitWebFrame *web_frame, WebKitWebResource *web_resource, @@ -965,7 +945,6 @@ static void resource_load_failed_cb(WebKitWebView *web_view, { debug_print("Loading error: %s\n", error->message); } -#endif static MimeViewer *fancy_viewer_create(void) { @@ -1113,10 +1092,8 @@ static MimeViewer *fancy_viewer_create(void) g_signal_connect(G_OBJECT(viewer->view), "key_press_event", G_CALLBACK(keypress_events_cb), viewer); -#if WEBKIT_CHECK_VERSION (1,7,5) g_signal_connect(G_OBJECT(viewer->view), "resource-load-failed", G_CALLBACK(resource_load_failed_cb), viewer); -#endif viewer->filename = NULL; return (MimeViewer *) viewer; diff --git a/src/plugins/fancy/fancy_viewer.h b/src/plugins/fancy/fancy_viewer.h @@ -35,9 +35,7 @@ #include <webkit/webkitnetworkrequest.h> #include <webkit/webkitwebnavigationaction.h> #include <webkit/webkitwebpolicydecision.h> -#if WEBKIT_CHECK_VERSION (1,3,10) #include <webkit/webkitglobals.h> -#endif #include <prefs_common.h> #include "common/claws.h" #include "common/version.h" @@ -123,12 +121,10 @@ struct _FancyViewer gint click_y; /* DOM Objects */ -#if WEBKIT_CHECK_VERSION(1,5,1) WebKitDOMDocument *doc; WebKitDOMDOMWindow *window; WebKitDOMDOMSelection *selection; WebKitDOMRange *range; -#endif }; #define OPEN_INTERNAL FALSE #define OPEN_EXTERNAL TRUE diff --git a/src/prefs_themes.c b/src/prefs_themes.c @@ -495,18 +495,11 @@ static void prefs_themes_btn_remove_clicked_cb(GtkWidget *widget, gpointer data) theme_str = tdata->displayed; tmp = g_path_get_basename(theme_str); - if (IS_SYSTEM_THEME(theme_str)) { - if (!superuser_p()) { - alertpanel_error(_("Only root can remove system themes")); - return; - } alert_title = g_strdup_printf(_("Remove system theme '%s'"), tmp); - } - if (NULL == alert_title) { + } else { alert_title = g_strdup_printf(_("Remove theme '%s'"), tmp); } - g_free(tmp); val = alertpanel(alert_title, @@ -565,27 +558,30 @@ static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data alert_title = g_strdup_printf(_("Install theme '%s'"), themename); if (file_exist(themeinfo, FALSE) == FALSE) { val = alertpanel(alert_title, - _("This folder doesn't seem to be a theme folder.\nInstall anyway?"), - GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST); - if (G_ALERTALTERNATE != val) - goto end_inst; - } - if (superuser_p ()) { - val = alertpanel(alert_title, - _("Do you want to install theme for all users?"), + _("This folder doesn't seem to be a theme" + "folder.\nInstall anyway?"), GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST); - switch (val) { - case G_ALERTALTERNATE: - cinfo->dest = stock_pixmap_get_system_theme_dir_for_theme( - themename); - break; - case G_ALERTDEFAULT: - break; - default: + if (G_ALERTALTERNATE != val) { + g_free(alert_title); goto end_inst; } } + + val = alertpanel(alert_title, + _("Do you want to install theme for all users?"), + GTK_STOCK_NO, GTK_STOCK_YES, NULL, ALERTFOCUS_FIRST); g_free(alert_title); + switch (val) { + case G_ALERTALTERNATE: + cinfo->dest = stock_pixmap_get_system_theme_dir_for_theme( + themename); + break; + case G_ALERTDEFAULT: + break; + default: + goto end_inst; + } + if (cinfo->dest == NULL) { cinfo->dest = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, PIXMAP_THEME_DIR, G_DIR_SEPARATOR_S, @@ -593,13 +589,15 @@ static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data } if (TRUE == is_dir_exist(cinfo->dest)) { AlertValue val = alertpanel_full(_("Theme exists"), - _("A theme with the same name is\nalready installed in this location.\n\n" + _("A theme with the same name is\n" + "already installed in this location.\n\n" "Do you want to replace it?"), GTK_STOCK_CANCEL, _("Overwrite"), NULL, ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING); if (val == G_ALERTALTERNATE) { if (remove_dir_recursive(cinfo->dest) < 0) { - alertpanel_error(_("Couldn't delete the old theme in %s."), cinfo->dest); + alertpanel_error(_("Couldn't delete the old theme in %s."), + cinfo->dest); goto end_inst; } } else { @@ -607,7 +605,8 @@ static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data } } if (0 != make_dir_hier(cinfo->dest)) { - alertpanel_error(_("Couldn't create destination directory %s."), cinfo->dest); + alertpanel_error(_("Couldn't create destination directory %s."), + cinfo->dest); goto end_inst; } prefs_themes_foreach_file(source, prefs_themes_file_install, cinfo); @@ -616,8 +615,8 @@ static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data /* update interface to show newly installed theme */ prefs_themes_get_themes_and_names(tdata); - insted = g_list_find_custom(tdata->themes, - (gpointer)(cinfo->dest), + insted = g_list_find_custom(tdata->themes, + (gpointer)(cinfo->dest), (GCompareFunc)strcmp2); if (NULL != insted) { alertpanel_notice(_("Theme installed successfully."));