Fix bug #3787. Create tooltip i helper function
authorMichael Rasmussen <mir@datanom.net>
Sat, 18 Mar 2017 19:43:47 +0000 (20:43 +0100)
committerMichael Rasmussen <mir@datanom.net>
Sat, 18 Mar 2017 19:43:47 +0000 (20:43 +0100)
src/plugins/archive/archiver.c
src/plugins/archive/archiver.h
src/plugins/archive/archiver_gtk.c
src/plugins/archive/archiver_prefs.c
src/plugins/archive/archiver_prefs.h
src/plugins/archive/libarchive_archive.c
src/plugins/archive/libarchive_archive.h

index 65d22c7db90a7693c2cc8ad919c50569f1ea272b..cf689deb870b988b4687c8332d6cb4fe2c9855c3 100644 (file)
@@ -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
index 61abab044f303df837c4181cb0bedeff8e4487c4..4405547234a9535051371516ba3e18d04dc3c0dc 100644 (file)
@@ -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
index 1f31ac499751e85d318359bd33cdda48debf680d..e3123fa23a26e3d110c150670467e7b852d1cba3 100644 (file)
@@ -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));
index fb733d55bf30d0d833078abc8bd39c9b4a65b57d..8d8340ccf90e6976057b5db5468e6c4e2578b2de 100644 (file)
@@ -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:
index 0e9572ed8c44a3f83b0872670fae45b85e2bd03c..159b3c1b93067171b191b728ffb98e5caf247b55 100644 (file)
@@ -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
index e7b32452242e3fe92ecc94a6fdce64cdca356cd8..cc1c95cb8951e3fc83ae31dcb1b320bec8557f25 100644 (file)
@@ -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);
+}
index 1659cc6fae7a599e0fc37ee45822acc2f636d6ef..60207bc2da73e61e04f2fe988c129a4d7a10f9a8 100644 (file)
@@ -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);