Use plugin name consistently
authorRicardo Mones <ricardo@mones.org>
Fri, 3 Sep 2021 16:54:11 +0000 (18:54 +0200)
committerRicardo Mones <ricardo@mones.org>
Fri, 3 Sep 2021 16:54:11 +0000 (18:54 +0200)
src/plugins/attachwarner/attachwarner.c
src/plugins/attachwarner/attachwarner.h
src/plugins/attachwarner/attachwarner_prefs.c
src/plugins/attachwarner/attachwarner_prefs.h

index 98d8695cfa5d40fcadb3acb93aa233b7b4b38df1..56b1125adc43e083bdb985ed43863ea0d8e53ff0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2006-2019  Ricardo Mones and the Claws Mail Team
+ * Copyright (C) 2006-2021  Ricardo Mones 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
@@ -82,7 +82,7 @@ static AttachWarnerMention *aw_matcherlist_string_match(MatcherList *matchers, g
                }
        }
        if (ret != FALSE) {
-                awm = g_new0(AttachWarnerMention, 1);
+               awm = g_new0(AttachWarnerMention, 1);
                awm->line = i; /* usual humans count lines from 1 */
                awm->context = g_strdup(lines[i - 1]);
                debug_print("found at line %d, context \"%s\"\n", awm->line, awm->context);
@@ -143,14 +143,14 @@ AttachWarnerMention *are_attachments_mentioned(Compose *compose)
 gboolean does_not_have_attachments(Compose *compose)
 {
        GtkTreeView *tree_view = GTK_TREE_VIEW(compose->attach_clist);
-        GtkTreeModel *model;
-        GtkTreeIter iter;
+       GtkTreeModel *model;
+       GtkTreeIter iter;
 
-        model = gtk_tree_view_get_model(tree_view);
+       model = gtk_tree_view_get_model(tree_view);
 
        debug_print("checking for attachments existence\n");
-        if (!gtk_tree_model_get_iter_first(model, &iter))
-                return TRUE;
+       if (!gtk_tree_model_get_iter_first(model, &iter))
+               return TRUE;
 
        return FALSE;
 }
@@ -191,7 +191,7 @@ static gboolean attwarn_before_send_hook(gpointer source, gpointer data)
        Compose *compose = (Compose *)source;
        AttachWarnerMention *mention = NULL;
 
-       debug_print("attachwarner invoked\n");
+       debug_print("AttachWarner invoked\n");
        if (compose->batch)
                return FALSE;   /* do not check while queuing */
 
@@ -242,12 +242,12 @@ static gboolean attwarn_before_send_hook(gpointer source, gpointer data)
 gint plugin_init(gchar **error)
 {
        if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72),
-                                 VERSION_NUMERIC, _("Attach warner"), error))
+                       VERSION_NUMERIC, "AttachWarner", error))
                return -1;
 
-       hook_id = hooks_register_hook(COMPOSE_CHECK_BEFORE_SEND_HOOKLIST, 
-                                     attwarn_before_send_hook, NULL);
-       
+       hook_id = hooks_register_hook(COMPOSE_CHECK_BEFORE_SEND_HOOKLIST,
+                       attwarn_before_send_hook, NULL);
+
        if (hook_id == HOOK_NONE) {
                *error = g_strdup(_("Failed to register check before send hook"));
                return -1;
@@ -255,7 +255,7 @@ gint plugin_init(gchar **error)
 
        attachwarner_prefs_init();
 
-       debug_print("Attachment warner plugin loaded\n");
+       debug_print("AttachWarner plugin loaded\n");
 
        return 0;
 }
@@ -268,7 +268,7 @@ gboolean plugin_done(void)
 {      
        hooks_unregister_hook(COMPOSE_CHECK_BEFORE_SEND_HOOKLIST, hook_id);
        attachwarner_prefs_done();
-       debug_print("Attachment warner plugin unloaded\n");
+       debug_print("AttachWarner plugin unloaded\n");
        return TRUE;
 }
 
@@ -279,7 +279,7 @@ gboolean plugin_done(void)
  */
 const gchar *plugin_name(void)
 {
-       return _("Attach warner");
+       return _("AttachWarner");
 }
 
 /**
@@ -331,7 +331,7 @@ const gchar *plugin_version(void)
 struct PluginFeature *plugin_provides(void)
 {
        static struct PluginFeature features[] = 
-               { {PLUGIN_OTHER, N_("Attach warner")},
+               { {PLUGIN_OTHER, N_("AttachWarner")},
                  {PLUGIN_NOTHING, NULL}};
 
        return features;
index eee9b9b3c77d90c86d72d8b32fe6d0003052bd10..26bbdf0493b8fca61296e0cc8417207644c206c7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2006-2015 Ricardo Mones and the Claws Mail Team
+ * Copyright (C) 2006-2021 Ricardo Mones 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
@@ -37,19 +37,18 @@ struct _AttachWarnerMention {
 
 typedef struct _AttachWarnerMention AttachWarnerMention;
 
-MatcherProp *  new_matcherprop           (void);
-gboolean       matcherprop_string_match  (MatcherProp *mp, gchar *str);
-AttachWarnerMention *are_attachments_mentioned (Compose *compose);
-gboolean       does_not_have_attachments (Compose *compose);
+MatcherProp *                  new_matcherprop (void);
+gboolean                               matcherprop_string_match  (MatcherProp *mp, gchar *str);
+AttachWarnerMention *  are_attachments_mentioned (Compose *compose);
+gboolean                               does_not_have_attachments (Compose *compose);
 
-gint           plugin_init               (gchar **error);
-gboolean       plugin_done               (void);
-const gchar *  plugin_name               (void);
-const gchar *  plugin_desc               (void);
-const gchar *  plugin_type               (void);
-const gchar *  plugin_licence            (void);
-const gchar *  plugin_version            (void);
-struct PluginFeature *plugin_provides    (void);
+gint                                   plugin_init (gchar **error);
+gboolean                               plugin_done (void);
+const gchar *                  plugin_name (void);
+const gchar *                  plugin_desc (void);
+const gchar *                  plugin_type (void);
+const gchar *                  plugin_licence (void);
+const gchar *                  plugin_version (void);
+struct PluginFeature * plugin_provides (void);
 
 #endif
-
index 9b9488e32aacaaf72fbbd8c4fe4446adc86f59a6..2d35533b78393092593178c1a15a6ad4da911e67 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2006-2019 Ricardo Mones and the Claws Mail Team
+ * Copyright (C) 2006-2021 Ricardo Mones 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
@@ -38,7 +38,7 @@ AttachWarnerPrefs attwarnerprefs;
 struct AttachWarnerPrefsPage
 {
        PrefsPage page;
-       
+
        GtkWidget *regexp_text;
        GtkWidget *skip_quotes_checkbox;
        GtkWidget *skip_forwards_and_redirections;
@@ -63,8 +63,8 @@ static PrefParam param[] = {
 };
 
 static void attwarner_prefs_create_widget_func(PrefsPage * _page,
-                                          GtkWindow * window,
-                                          gpointer data)
+                               GtkWindow * window,
+                               gpointer data)
 {
        struct AttachWarnerPrefsPage *page = (struct AttachWarnerPrefsPage *) _page;
        GtkWidget *vbox, *vbox1, *vbox2;
@@ -79,15 +79,16 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
 
        vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
        vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
-       
+
        label = gtk_label_new(_("One of the following regular expressions is matched (one per line)"));
        gtk_label_set_xalign(GTK_LABEL(label), 0.0);
        gtk_widget_set_margin_start(GTK_WIDGET(label), 2);
        gtk_widget_set_margin_end(GTK_WIDGET(label), 0);
 
        case_sensitive_checkbox = gtk_check_button_new_with_label(_("Expressions are case sensitive"));
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(case_sensitive_checkbox),
-                attwarnerprefs.case_sensitive);
+       gtk_toggle_button_set_active(
+               GTK_TOGGLE_BUTTON(case_sensitive_checkbox),
+               attwarnerprefs.case_sensitive);
        gtk_widget_show(case_sensitive_checkbox);
 
        CLAWS_SET_TIP(case_sensitive_checkbox,
@@ -97,13 +98,13 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
        page->regexp_text = gtk_text_view_new();
        buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(page->regexp_text));
        gtk_text_buffer_set_text(buffer, attwarnerprefs.match_strings, -1);
-       
+
        scrolledwin = gtk_scrolled_window_new(NULL, NULL);
-       gtk_scrolled_window_set_policy
-               (GTK_SCROLLED_WINDOW (scrolledwin),
-                GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-       gtk_scrolled_window_set_shadow_type
-               (GTK_SCROLLED_WINDOW (scrolledwin), GTK_SHADOW_IN);
+       gtk_scrolled_window_set_policy(
+               GTK_SCROLLED_WINDOW (scrolledwin),
+               GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+       gtk_scrolled_window_set_shadow_type(
+               GTK_SCROLLED_WINDOW (scrolledwin), GTK_SHADOW_IN);
        gtk_container_set_border_width(GTK_CONTAINER(scrolledwin), 3);
 
        gtk_container_add(GTK_CONTAINER(scrolledwin), page->regexp_text);
@@ -112,35 +113,40 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
        gtk_box_pack_start(GTK_BOX(vbox1), label, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox1), scrolledwin, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(vbox1), case_sensitive_checkbox, FALSE, FALSE, 0);
-       
+
        skip_quotes_checkbox = gtk_check_button_new_with_label(_("Lines starting with quotation marks"));
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(skip_quotes_checkbox),
-                attwarnerprefs.skip_quotes);
+       gtk_toggle_button_set_active(
+               GTK_TOGGLE_BUTTON(skip_quotes_checkbox),
+               attwarnerprefs.skip_quotes);
        gtk_box_pack_start(GTK_BOX(vbox2), skip_quotes_checkbox, FALSE, FALSE, 0);
        gtk_widget_show(skip_quotes_checkbox);
 
        CLAWS_SET_TIP(skip_quotes_checkbox,
-                       _("Exclude quoted lines from checking for the regular expressions above. Note that handmade quotes cannot be distinguished from quotes generated by replying."));
+               _("Exclude quoted lines from checking for the regular "
+                 "expressions above. Note that handmade quotes cannot "
+                 "be distinguished from quotes generated by replying."));
        page->skip_quotes_checkbox = skip_quotes_checkbox;
        
        skip_fwd_redir_checkbox = gtk_check_button_new_with_label(_("Forwarded or redirected messages"));
-       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(skip_fwd_redir_checkbox),
-                attwarnerprefs.skip_forwards_and_redirections);
+       gtk_toggle_button_set_active(
+               GTK_TOGGLE_BUTTON(skip_fwd_redir_checkbox),
+               attwarnerprefs.skip_forwards_and_redirections);
        gtk_box_pack_start(GTK_BOX(vbox2), skip_fwd_redir_checkbox, FALSE, FALSE, 0);
        gtk_widget_show(skip_fwd_redir_checkbox);
 
        CLAWS_SET_TIP(skip_fwd_redir_checkbox,
-                       _("Don't check for missing attachments when forwarding or redirecting messages"));
+               _("Don't check for missing attachments when forwarding or redirecting messages"));
        page->skip_forwards_and_redirections = skip_fwd_redir_checkbox;
 
        skip_signature_checkbox = gtk_check_button_new_with_label(_("Signatures"));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(skip_signature_checkbox),
-                attwarnerprefs.skip_signature);
+               attwarnerprefs.skip_signature);
        gtk_box_pack_start(GTK_BOX(vbox2), skip_signature_checkbox, FALSE, FALSE, 0);
        gtk_widget_show(skip_signature_checkbox);
 
        CLAWS_SET_TIP(skip_signature_checkbox,
-                       _("Exclude lines from the first signature-separator onwards from checking for the regular expressions above"));
+               _("Exclude lines from the first signature-separator onwards "
+                 "from checking for the regular expressions above"));
        page->skip_signature = skip_signature_checkbox;
        
        vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, VSPACING);
@@ -155,7 +161,7 @@ static void attwarner_prefs_create_widget_func(PrefsPage * _page,
        gtk_container_add(GTK_CONTAINER(frame), vbox2);
 
        gtk_widget_show_all(vbox);
-       
+
        page->page.widget = vbox;
 }
 
@@ -177,15 +183,15 @@ static void attwarner_save_config(void)
                return;
 
        if (prefs_write_param(param, pfile->fp) < 0) {
-               g_warning("failed to write Attach warner configuration to file");
+               g_warning("failed to write AttachWarner configuration to file");
                prefs_file_close_revert(pfile);
                return;
        }
-        if (fprintf(pfile->fp, "\n") < 0) {
+       if (fprintf(pfile->fp, "\n") < 0) {
                FILE_OP_ERROR(rcpath, "fprintf");
                prefs_file_close_revert(pfile);
        } else
-               prefs_file_close(pfile);
+               prefs_file_close(pfile);
 }
 
 
@@ -196,25 +202,25 @@ static void attwarner_prefs_save_func(PrefsPage * _page)
        GtkTextIter start, end;
        gchar *tmp;
        buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(page->regexp_text));
-       
+
        g_free(attwarnerprefs.match_strings);
-       
+
        gtk_text_buffer_get_start_iter(buffer, &start);
        gtk_text_buffer_get_end_iter(buffer, &end);
-       
+
        tmp = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
-       
+
        attwarnerprefs.match_strings = g_malloc(2*strlen(tmp)+1);
        pref_get_escaped_pref(attwarnerprefs.match_strings, tmp);
 
-       attwarnerprefs.skip_quotes = gtk_toggle_button_get_active
-                       (GTK_TOGGLE_BUTTON(page->skip_quotes_checkbox));
-       attwarnerprefs.skip_forwards_and_redirections = gtk_toggle_button_get_active
-                       (GTK_TOGGLE_BUTTON(page->skip_forwards_and_redirections));
-       attwarnerprefs.skip_signature = gtk_toggle_button_get_active
-                       (GTK_TOGGLE_BUTTON(page->skip_signature));
-       attwarnerprefs.case_sensitive = gtk_toggle_button_get_active
-                       (GTK_TOGGLE_BUTTON(page->case_sensitive_checkbox));
+       attwarnerprefs.skip_quotes = gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON(page->skip_quotes_checkbox));
+       attwarnerprefs.skip_forwards_and_redirections = gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON(page->skip_forwards_and_redirections));
+       attwarnerprefs.skip_signature = gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON(page->skip_signature));
+       attwarnerprefs.case_sensitive = gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON(page->case_sensitive_checkbox));
 
        attwarner_save_config();
        g_free(attwarnerprefs.match_strings);
@@ -226,9 +232,9 @@ void attachwarner_prefs_init(void)
        static gchar *path[3];
        gchar *rcpath;
        gchar *tmp;
-       
+
        path[0] = _("Plugins");
-       path[1] = _("Attach Warner");
+       path[1] = _("AttachWarner");
        path[2] = NULL;
 
        prefs_set_default(param);
@@ -238,10 +244,10 @@ void attachwarner_prefs_init(void)
 
        tmp = g_malloc(strlen(attwarnerprefs.match_strings)+1);
        pref_get_unescaped_pref(tmp, attwarnerprefs.match_strings);
-       
+
        g_free(attwarnerprefs.match_strings);
        attwarnerprefs.match_strings = tmp;
-       
+
        attwarnerprefs_page.page.path = path;
        attwarnerprefs_page.page.create_widget = attwarner_prefs_create_widget_func;
        attwarnerprefs_page.page.destroy_widget = attwarner_prefs_destroy_widget_func;
index 8ef0e9b55067c9454b87de5033f81372b8dd2070..93b7215e417f5046b823cbe64f089cb60798e149 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2006-2015 Ricardo Mones and the Claws Mail Team
+ * Copyright (C) 2006-2021 Ricardo Mones 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
@@ -25,11 +25,11 @@ typedef struct _AttachWarnerPrefs AttachWarnerPrefs;
 
 struct _AttachWarnerPrefs
 {
-       gchar            *match_strings;
-       gboolean         skip_quotes;
-       gboolean         skip_forwards_and_redirections;
-       gboolean         skip_signature;
-       gboolean         case_sensitive;
+       gchar *         match_strings;
+       gboolean        skip_quotes;
+       gboolean        skip_forwards_and_redirections;
+       gboolean        skip_signature;
+       gboolean        case_sensitive;
 };
 
 extern AttachWarnerPrefs attwarnerprefs;