Use PLUGIN_NAME macro instead of "vCalendar" string literal internally.
authorAndrej Kacian <ticho@claws-mail.org>
Sat, 4 Feb 2017 13:18:03 +0000 (14:18 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Sat, 4 Feb 2017 13:18:03 +0000 (14:18 +0100)
src/plugins/vcalendar/plugin.c
src/plugins/vcalendar/vcal_folder.c
src/plugins/vcalendar/vcal_meeting_gtk.c
src/plugins/vcalendar/vcal_prefs.c
src/plugins/vcalendar/vcalendar.c
src/plugins/vcalendar/vcalendar.h

index a3d39f6..8074156 100644 (file)
@@ -41,7 +41,7 @@
 gint plugin_init(gchar **error)
 {
        if (!check_plugin_version(MAKE_NUMERIC_VERSION(3,13,2,39),
-                               VERSION_NUMERIC, _("vCalendar"), error))
+                               VERSION_NUMERIC, _(PLUGIN_NAME), error))
                return -1;
 
        tzset();
@@ -65,7 +65,7 @@ gboolean plugin_done(void)
 
 const gchar *plugin_name(void)
 {
-       return _("vCalendar");
+       return _(PLUGIN_NAME);
 }
 
 const gchar *plugin_desc(void)
index bd64672..9d3b8e2 100644 (file)
@@ -235,7 +235,7 @@ static void vcal_fill_popup_menu_labels(void)
 
 static FolderViewPopup vcal_popup =
 {
-       "vCalendar",
+       PLUGIN_NAME,
        "<vCalendar>",
        vcal_popup_entries,
        G_N_ELEMENTS(vcal_popup_entries),
@@ -330,7 +330,7 @@ static void vcal_item_opened(FolderItem *item)
 
 void vcal_folder_refresh_cal(FolderItem *item)
 {
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        if (item->folder != folder)
                return;
        if (((VCalFolderItem *)(item))->dw)
@@ -356,8 +356,8 @@ FolderClass *vcal_folder_get_class()
        if (vcal_class.idstr == NULL) {
                debug_print("register class\n");
                vcal_class.type = F_UNKNOWN;
-               vcal_class.idstr = "vCalendar";
-               vcal_class.uistr = "vCalendar";
+               vcal_class.idstr = PLUGIN_NAME;
+               vcal_class.uistr = PLUGIN_NAME;
 
                /* Folder functions */
                vcal_class.new_folder = vcal_folder_new;
@@ -1347,7 +1347,7 @@ static void new_meeting_cb(GtkAction *action, gpointer data)
 
 GSList * vcal_folder_get_waiting_events(void)
 {
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        return vcal_get_events_list(folder->inbox);
 }
 
@@ -1381,7 +1381,7 @@ static gboolean get_webcal_events_func(GNode *node, gpointer user_data)
 GSList * vcal_folder_get_webcal_events(void)
 {
        GetWebcalData *data = g_new0(GetWebcalData, 1);
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        GSList *list = NULL;
        data->item = NULL;
        g_node_traverse(folder->node, G_PRE_ORDER,
@@ -1417,7 +1417,7 @@ static gboolean vcal_free_data_func(GNode *node, gpointer user_data)
 
 void vcal_folder_free_data(void)
 {
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
 
        g_node_traverse(folder->node, G_PRE_ORDER,
                        G_TRAVERSE_ALL, -1, vcal_free_data_func, NULL);
@@ -1426,7 +1426,7 @@ void vcal_folder_free_data(void)
 GSList * vcal_folder_get_webcal_events_for_folder(FolderItem *item)
 {
        GetWebcalData *data = g_new0(GetWebcalData, 1);
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        GSList *list = NULL;
        data->item = item;
        g_node_traverse(folder->node, G_PRE_ORDER,
@@ -1758,7 +1758,7 @@ static gboolean folder_item_find_func(GNode *node, gpointer data)
 
 static FolderItem *get_folder_item_for_uri(const gchar *uri)
 {
-       Folder *root = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *root = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        gpointer d[2];
        
        if (root == NULL)
@@ -1793,7 +1793,7 @@ static gchar *feed_get_title(const gchar *str)
 
 static void update_subscription_finish(const gchar *uri, gchar *feed, gboolean verbose, gchar *error)
 {
-       Folder *root = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *root = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        FolderItem *item = NULL;
        icalcomponent *cal = NULL;
        
@@ -1920,7 +1920,7 @@ static void update_subscription(const gchar *uri, gboolean verbose)
 
 static void check_subs_cb(GtkAction *action, gpointer data)
 {
-       Folder *root = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *root = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
 
        if (prefs_common_get_prefs()->work_offline && 
            !inc_offline_should_override(TRUE,
@@ -2420,7 +2420,7 @@ VCalEvent *vcal_get_event_from_ical(const gchar *ical, const gchar *charset)
 gboolean vcal_event_exists(const gchar *id)
 {
        MsgInfo *info = NULL;
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        if (!folder)
                return FALSE;
 
@@ -2456,7 +2456,7 @@ void vcal_foreach_event(gboolean (*cb_func)(const gchar *vevent))
 gboolean vcal_delete_event(const gchar *id)
 {
        MsgInfo *info = NULL;
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        if (!folder)
                return FALSE;
 
@@ -2478,7 +2478,7 @@ gchar* vcal_add_event(const gchar *vevent)
 {
        VCalEvent *event = vcal_get_event_from_ical(vevent, NULL);
        gchar *retVal = NULL;
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        if (!folder)
                return NULL;
 
index 0294d9b..4c63245 100644 (file)
@@ -1225,7 +1225,7 @@ static gboolean send_meeting_cb(GtkButton *widget, gpointer data)
        PrefsAccount *account = NULL;
        gboolean res = FALSE;
        gboolean found_att = FALSE;
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        gboolean redisp = FALSE;
 
        if (meet->uid == NULL && meet->visible && 
index ce7ed07..e467678 100644 (file)
@@ -772,7 +772,7 @@ void vcal_prefs_init(void)
        gboolean passwords_migrated = FALSE;
 
        path[0] = _("Plugins");
-       path[1] = _("vCalendar");
+       path[1] = _(PLUGIN_NAME);
        path[2] = NULL;
 
        prefs_set_default(param);
@@ -783,7 +783,7 @@ void vcal_prefs_init(void)
        /* Move passwords that are still in main config to password store. */
        if (vcalprefs.export_pass != NULL &&
                        strlen(vcalprefs.export_pass) > 0) {
-               passwd_store_set(PWS_PLUGIN, "vCalendar", "export",
+               passwd_store_set(PWS_PLUGIN, PLUGIN_NAME, "export",
                                vcalprefs.export_pass, TRUE);
                passwords_migrated = TRUE;
                memset(vcalprefs.export_pass, 0, strlen(vcalprefs.export_pass));
@@ -791,7 +791,7 @@ void vcal_prefs_init(void)
        }
        if (vcalprefs.export_freebusy_pass != NULL &&
                        strlen(vcalprefs.export_freebusy_pass) > 0) {
-               passwd_store_set(PWS_PLUGIN, "vCalendar", "export",
+               passwd_store_set(PWS_PLUGIN, PLUGIN_NAME, "export",
                                vcalprefs.export_freebusy_pass, TRUE);
                passwords_migrated = TRUE;
                memset(vcalprefs.export_freebusy_pass, 0, strlen(vcalprefs.export_freebusy_pass));
index 08dc24e..a7064a8 100644 (file)
@@ -441,7 +441,7 @@ static FolderItem *vcalendar_get_current_item(void)
 {
        MainWindow *mainwin = mainwindow_get_mainwindow();
        FolderItem *item = NULL;
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        
        if (mainwin) {
                item = mainwin->summaryview->folder_item;
@@ -897,7 +897,7 @@ void vcalviewer_reload(FolderItem *item)
 {
        if (s_vcalviewer) {
                MainWindow *mainwin = mainwindow_get_mainwindow();
-               Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+               Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
 
                folder_item_scan(item);
                if (mainwin && mainwin->summaryview->folder_item) {
@@ -950,7 +950,7 @@ static gboolean vcalviewer_uribtn_cb(GtkButton *widget, gpointer data)
 
 void vcalendar_refresh_folder_contents(FolderItem *item)
 {
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        if (folder && item->folder == folder) {
                MainWindow *mainwin = mainwindow_get_mainwindow();
                folder_item_scan(item);
@@ -971,7 +971,7 @@ void vcalendar_cancel_meeting(FolderItem *item, const gchar *uid)
        VCalMeeting *meet = NULL;
        gchar *file = NULL;
        gint val = 0;
-       Folder *folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        gboolean redisp = FALSE;
        GtkWidget *send_notify_chkbtn = gtk_check_button_new_with_label(_("Send a notification to the attendees"));
        gboolean send_notify = TRUE;
@@ -1294,7 +1294,7 @@ static gint scan_timeout_tag = 0;
 
 static gboolean vcal_webcal_check(gpointer data)
 {
-       Folder *root = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       Folder *root = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
 
        if (prefs_common_get_prefs()->work_offline)
                return TRUE;
@@ -1327,10 +1327,10 @@ void vcalendar_init(void)
        mimeview_register_viewer_factory(&vcal_viewer_factory);
        folder_register_class(vcal_folder_get_class());
 
-       folder = folder_find_from_name ("vCalendar", vcal_folder_get_class());
+       folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
        if (!folder) {
                START_TIMING("creating folder");
-               folder = folder_new(vcal_folder_get_class(), "vCalendar", NULL);
+               folder = folder_new(vcal_folder_get_class(), PLUGIN_NAME, NULL);
                folder->klass->create_tree(folder);
                folder_add(folder);
                folder_scan_tree(folder, TRUE);
index b6bddd5..ff14bab 100644 (file)
@@ -26,6 +26,8 @@
 #include "procmime.h"
 #include "folder.h"
 
+#define PLUGIN_NAME "vCalendar"
+
 typedef struct _VCalViewer VCalViewer;
 
 void vcalendar_init(void);
@@ -36,8 +38,8 @@ void vcalviewer_reload(FolderItem *item);
 void vcalendar_cancel_meeting(FolderItem *item, const gchar *uid);
 
 #define vcal_passwd_set(id, pwd) \
-       passwd_store_set(PWS_PLUGIN, "vCalendar", id, pwd, FALSE)
+       passwd_store_set(PWS_PLUGIN, PLUGIN_NAME, id, pwd, FALSE)
 #define vcal_passwd_get(id) \
-       passwd_store_get(PWS_PLUGIN, "vCalendar", id)
+       passwd_store_get(PWS_PLUGIN, PLUGIN_NAME, id)
 
 #endif