From 3096aa1d9437540b36cefc1f2d4245d6eb5855a9 Mon Sep 17 00:00:00 2001 From: Michael Rasmussen Date: Sat, 18 Mar 2017 20:43:47 +0100 Subject: [PATCH] Fix bug #3787. Create tooltip i helper function --- src/plugins/archive/archiver.c | 2 +- src/plugins/archive/archiver.h | 2 +- src/plugins/archive/archiver_gtk.c | 35 ++++++++--------------- src/plugins/archive/archiver_prefs.c | 36 +++++++++--------------- src/plugins/archive/archiver_prefs.h | 2 +- src/plugins/archive/libarchive_archive.c | 7 ++++- src/plugins/archive/libarchive_archive.h | 3 +- 7 files changed, 36 insertions(+), 51 deletions(-) diff --git a/src/plugins/archive/archiver.c b/src/plugins/archive/archiver.c index 65d22c7db..cf689deb8 100644 --- a/src/plugins/archive/archiver.c +++ b/src/plugins/archive/archiver.c @@ -2,7 +2,7 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2008 Michael Rasmussen and the Claws Mail Team + * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/plugins/archive/archiver.h b/src/plugins/archive/archiver.h index 61abab044..440554723 100644 --- a/src/plugins/archive/archiver.h +++ b/src/plugins/archive/archiver.h @@ -2,7 +2,7 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2008 Michael Rasmussen and the Claws Mail Team + * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/plugins/archive/archiver_gtk.c b/src/plugins/archive/archiver_gtk.c index 1f31ac499..e3123fa23 100644 --- a/src/plugins/archive/archiver_gtk.c +++ b/src/plugins/archive/archiver_gtk.c @@ -2,7 +2,7 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2008 Michael Rasmussen and the Claws Mail Team + * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1106,37 +1106,32 @@ void archiver_gtk_show() { gzip_radio_btn = gtk_radio_button_new_with_mnemonic(NULL, "G_ZIP"); gtk_widget_set_name(gzip_radio_btn, "GZIP"); gtk_box_pack_start(GTK_BOX(hbox1), gzip_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(gzip_radio_btn, - _("Choose this option to use GZIP compression for the archive")); + archiver_set_tooltip(gzip_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "GZIP")); bzip_radio_btn = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON(gzip_radio_btn), "BZIP_2"); gtk_widget_set_name(bzip_radio_btn, "BZIP"); gtk_box_pack_start(GTK_BOX(hbox1), bzip_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(bzip_radio_btn, - _("Choose this option to use BZIP2 compression for the archive")); + archiver_set_tooltip(bzip_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "BZIP2")); compress_radio_btn = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON(gzip_radio_btn), "Com_press"); gtk_widget_set_name(compress_radio_btn, "COMPRESS"); gtk_box_pack_start(GTK_BOX(hbox1), compress_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(compress_radio_btn, - _("Choose this to use Compress compression for your archive")); + archiver_set_tooltip(compress_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "COMPRESS")); #if ARCHIVE_VERSION_NUMBER >= 2006990 lzma_radio_btn = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON(gzip_radio_btn), "_LZMA"); gtk_widget_set_name(lzma_radio_btn, "LZMA"); gtk_box_pack_start(GTK_BOX(hbox1), lzma_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lzma_radio_btn, - _("Choose this option to use LZMA compression for the archive")); + archiver_set_tooltip(lzma_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "LZMA")); xz_radio_btn = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON(gzip_radio_btn), "_XZ"); gtk_widget_set_name(xz_radio_btn, "XZ"); gtk_box_pack_start(GTK_BOX(hbox1), xz_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(xz_radio_btn, - _("Choose this option to use XZ compression for the archive")); + archiver_set_tooltip(xz_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "XZ")); #endif #if ARCHIVE_VERSION_NUMBER >= 3000000 @@ -1144,8 +1139,7 @@ void archiver_gtk_show() { GTK_RADIO_BUTTON(gzip_radio_btn), "_LZIP"); gtk_widget_set_name(lzip_radio_btn, "LZIP"); gtk_box_pack_start(GTK_BOX(hbox1), lzip_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lzip_radio_btn, - _("Choose this option to use LZIP compression for the archive")); + archiver_set_tooltip(lzip_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "LZIP")); #endif #if ARCHIVE_VERSION_NUMBER >= 3001000 @@ -1153,22 +1147,19 @@ void archiver_gtk_show() { GTK_RADIO_BUTTON(gzip_radio_btn), "L_RZIP"); gtk_widget_set_name(lrzip_radio_btn, "LRZIP"); gtk_box_pack_start(GTK_BOX(hbox1), lrzip_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lrzip_radio_btn, - _("Choose this option to use LRZIP compression for the archive")); + archiver_set_tooltip(lrzip_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "LRZIP")); lzop_radio_btn = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON(gzip_radio_btn), "LZ_OP"); gtk_widget_set_name(lzop_radio_btn, "LZOP"); gtk_box_pack_start(GTK_BOX(hbox1), lzop_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lzop_radio_btn, - _("Choose this option to use LZOP compression for the archive")); + archiver_set_tooltip(lzop_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "LZOP")); grzip_radio_btn = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON(gzip_radio_btn), "_GRZIP"); gtk_widget_set_name(grzip_radio_btn, "GRZIP"); gtk_box_pack_start(GTK_BOX(hbox1), grzip_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(grzip_radio_btn, - _("Choose this option to use GRZIP compression for the archive")); + archiver_set_tooltip(grzip_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "GRZIP")); #endif #if ARCHIVE_VERSION_NUMBER >= 3001900 @@ -1176,16 +1167,14 @@ void archiver_gtk_show() { GTK_RADIO_BUTTON(gzip_radio_btn), "LZ_4"); gtk_widget_set_name(lz4_radio_btn, "LZ4"); gtk_box_pack_start(GTK_BOX(hbox1), lz4_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lz4_radio_btn, - _("Choose this option to use LZ4 compression for the archive")); + archiver_set_tooltip(lz4_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "LZ4")); #endif no_radio_btn = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON(gzip_radio_btn), _("_None")); gtk_widget_set_name(no_radio_btn, "NONE"); gtk_box_pack_start(GTK_BOX(hbox1), no_radio_btn, FALSE, FALSE, 0); - CLAWS_SET_TIP(no_radio_btn, - _("Choose this option to disable compression for the archive")); + archiver_set_tooltip(no_radio_btn, g_strdup_printf(_("Choose this option to use %s compression for the archive"), "NO")); page->compress_methods = gtk_radio_button_get_group(GTK_RADIO_BUTTON(gzip_radio_btn)); diff --git a/src/plugins/archive/archiver_prefs.c b/src/plugins/archive/archiver_prefs.c index fb733d55b..8d8340ccf 100644 --- a/src/plugins/archive/archiver_prefs.c +++ b/src/plugins/archive/archiver_prefs.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2008 Michael Rasmussen and the Claws Mail Team + * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,6 +39,7 @@ #include "filesel.h" #include "archiver_prefs.h" +#include "libarchive_archive.h" #define PREFS_BLOCK_NAME "Archiver" @@ -245,37 +246,32 @@ static void create_archiver_prefs_page(PrefsPage * _page, compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(gzip_radiobtn)); gtk_widget_show(gzip_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), gzip_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(gzip_radiobtn, - _("Choose this option to use GZIP compression by default")); + archiver_set_tooltip(gzip_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "GZIP")); bzip_radiobtn = gtk_radio_button_new_with_label(compression_group, "BZIP2"); compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(bzip_radiobtn)); gtk_widget_show(bzip_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), bzip_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(bzip_radiobtn, - _("Choose this option to use BZIP2 compression by default")); + archiver_set_tooltip(bzip_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "BZIP2")); compress_radiobtn = gtk_radio_button_new_with_label(compression_group, "COMPRESS"); compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(compress_radiobtn)); gtk_widget_show(compress_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), compress_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(compress_radiobtn, - _("Choose this option to use COMPRESS compression by default")); + archiver_set_tooltip(compress_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "COMPRESS")); #if ARCHIVE_VERSION_NUMBER >= 2006990 lzma_radiobtn = gtk_radio_button_new_with_label(compression_group, "LZMA"); compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(lzma_radiobtn)); gtk_widget_show(lzma_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), lzma_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lzma_radiobtn, - _("Choose this option to use LZMA compression by default")); + archiver_set_tooltip(lzma_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "LZMA")); xz_radiobtn = gtk_radio_button_new_with_label(compression_group, "XZ"); compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(xz_radiobtn)); gtk_widget_show(xz_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), xz_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(xz_radiobtn, - _("Choose this option to use XZ compression by default")); + archiver_set_tooltip(xz_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "XZ")); #endif #if ARCHIVE_VERSION_NUMBER >= 3000000 @@ -283,8 +279,7 @@ static void create_archiver_prefs_page(PrefsPage * _page, compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(lzip_radiobtn)); gtk_widget_show(lzip_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), lzip_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lzip_radiobtn, - _("Choose this option to use LZIP compression by default")); + archiver_set_tooltip(lzip_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "LZIP")); #endif #if ARCHIVE_VERSION_NUMBER >= 3001000 @@ -292,22 +287,19 @@ static void create_archiver_prefs_page(PrefsPage * _page, compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(lrzip_radiobtn)); gtk_widget_show(lrzip_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), lrzip_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lrzip_radiobtn, - _("Choose this option to use LRZIP compression by default")); + archiver_set_tooltip(lrzip_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "LRZIP")); lzop_radiobtn = gtk_radio_button_new_with_label(compression_group, "LZOP"); compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(lzop_radiobtn)); gtk_widget_show(lzop_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), lzop_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lzop_radiobtn, - _("Choose this option to use LZOP compression by default")); + archiver_set_tooltip(lzop_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "LZOP")); grzip_radiobtn = gtk_radio_button_new_with_label(compression_group, "GRZIP"); compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(grzip_radiobtn)); gtk_widget_show(grzip_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), grzip_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(grzip_radiobtn, - _("Choose this option to use GRZIP compression by default")); + archiver_set_tooltip(grzip_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "GRZIP")); #endif #if ARCHIVE_VERSION_NUMBER >= 3001900 @@ -315,16 +307,14 @@ static void create_archiver_prefs_page(PrefsPage * _page, compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(lz4_radiobtn)); gtk_widget_show(lz4_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), lz4_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(lz4_radiobtn, - _("Choose this option to use LZ4 compression by default")); + archiver_set_tooltip(lz4_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "LZ4")); #endif none_radiobtn = gtk_radio_button_new_with_label(compression_group, _("None")); compression_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(none_radiobtn)); gtk_widget_show(none_radiobtn); gtk_box_pack_start(GTK_BOX (hbox1), none_radiobtn, FALSE, FALSE, 0); - CLAWS_SET_TIP(none_radiobtn, - _("Choose this option to disable compression by default")); + archiver_set_tooltip(none_radiobtn, g_strdup_printf(_("Choose this option to use %s compression by default"), "NO")); switch (archiver_prefs.compression) { case COMPRESSION_GZIP: diff --git a/src/plugins/archive/archiver_prefs.h b/src/plugins/archive/archiver_prefs.h index 0e9572ed8..159b3c1b9 100644 --- a/src/plugins/archive/archiver_prefs.h +++ b/src/plugins/archive/archiver_prefs.h @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2008 Michael Rasmussen and the Claws Mail Team + * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/plugins/archive/libarchive_archive.c b/src/plugins/archive/libarchive_archive.c index e7b324522..cc1c95cb8 100644 --- a/src/plugins/archive/libarchive_archive.c +++ b/src/plugins/archive/libarchive_archive.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2016 Michael Rasmussen and the Claws Mail Team + * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -747,3 +747,8 @@ int main(int argc, char** argv) { return EXIT_SUCCESS; } #endif + +void archiver_set_tooltip(GtkWidget* widget, gchar* text) { + gtk_widget_set_tooltip_text(widget, text); + g_free(text); +} diff --git a/src/plugins/archive/libarchive_archive.h b/src/plugins/archive/libarchive_archive.h index 1659cc6fa..60207bc2d 100644 --- a/src/plugins/archive/libarchive_archive.h +++ b/src/plugins/archive/libarchive_archive.h @@ -2,7 +2,7 @@ /* * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2008 Michael Rasmussen and the Claws Mail Team + * Copyright (C) 1999-2017 Michael Rasmussen and the Claws Mail Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,6 +75,7 @@ void archive_free_file_list(gboolean md5, gboolean rename); const gchar* archive_create(const char* archive_name, GSList* files, COMPRESS_METHOD method, ARCHIVE_FORMAT format); gboolean before_date(time_t msg_mtime, const gchar* before); +void archiver_set_tooltip(GtkWidget* widget, gchar* text); #ifdef _TEST void archive_set_permissions(int perm); -- 2.25.1