[Xfce4-commits] <orage:master> 4.9.9.0 Enhancement 7873 add an option to save event into a different ICS file

Juha Kautto noreply at xfce.org
Mon Nov 18 13:58:01 CET 2013


Updating branch refs/heads/master
         to a628748d466cb13babdb29903c08e52ef522740e (commit)
       from 59cb2c131784dcf973956dbf3641beb1c68088b4 (commit)

commit a628748d466cb13babdb29903c08e52ef522740e
Author: Juha Kautto <juha at xfce.org>
Date:   Mon Nov 18 14:53:49 2013 +0200

    4.9.9.0 Enhancement 7873 add an option to save event into a different ICS file
    
    It is now possible to add appointments to foreign files. Added also option
    to name foreign files so that long filesystem names are not mandoatory.
    Also did some minor code cleaning.

 configure.in.in            |    2 +-
 src/appointment.c          |   82 +++++++++++++++++++++++++++++--
 src/appointment.h          |    1 +
 src/ical-code.c            |   30 +++++-------
 src/ical-code.h            |    2 +-
 src/interface.c            |  117 +++++++++++++++++++++++++++++++++++---------
 src/interface.h            |    6 ++-
 src/main.c                 |   47 ++++++++++++------
 src/orage-dbus-client.c    |    4 +-
 src/orage-dbus-client.h    |    8 +--
 src/orage-dbus-object.c    |    8 +--
 src/orage-dbus-object.h    |    2 +-
 src/orage-dbus-service.h   |   52 ++++++++++----------
 src/orage-dbus-service.xml |    1 +
 src/orage-dbus.h           |    3 +-
 src/parameters.c           |   21 ++++----
 src/parameters.h           |    1 +
 src/reminder.c             |    6 ++-
 18 files changed, 282 insertions(+), 111 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index f9c2f5d..8683eb5 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -9,7 +9,7 @@ dnl Written for Xfce by Juha Kautto <juha at xfce.org>
 dnl
 
 dnl Version information
-m4_define([orage_version], [4.9.8.0-git])
+m4_define([orage_version], [4.9.9.0-git])
 
 m4_define([gtk_minimum_version], [2.14.0])
 m4_define([xfce_minimum_version], [4.8.0])
diff --git a/src/appointment.c b/src/appointment.c
index 87eaae8..ddc7f48 100644
--- a/src/appointment.c
+++ b/src/appointment.c
@@ -1120,28 +1120,99 @@ static gboolean fill_appt_from_apptw(xfical_appt *appt, appt_win *apptw)
     return(TRUE);
 }
 
+static void add_file_select_cb(appt_win *apptw)
+{
+    GtkWidget *toolbar_separator;
+    GtkWidget *tool_item;
+    gint i = 0;
+    gboolean use_list = FALSE;
+
+    /* Build insert file selection combobox */
+    apptw->File_insert_cb = NULL;
+    if (g_par.foreign_count == 0) { /* we do not have foreign files */
+        return;
+    }
+
+    apptw->File_insert_cb = gtk_combo_box_new_text();
+    gtk_widget_set_tooltip_text(apptw->File_insert_cb
+            , _("Add new appointment to this file."));
+    gtk_combo_box_append_text(GTK_COMBO_BOX(apptw->File_insert_cb), _("Orage default file"));
+    gtk_combo_box_set_active(GTK_COMBO_BOX(apptw->File_insert_cb), 0);
+    for (i = 0; i < g_par.foreign_count; i++) {
+        if (!g_par.foreign_data[i].read_only) { /* do not add to RO files */
+            gtk_combo_box_append_text(GTK_COMBO_BOX(apptw->File_insert_cb)
+                    , g_par.foreign_data[i].name);
+            use_list = TRUE;
+        }
+    }
+
+    if (!use_list) { /* it is not needed after all */
+        gtk_widget_destroy(apptw->File_insert_cb);
+        apptw->File_insert_cb = NULL;
+    }
+
+    /* Add insert file combobox to toolbar */
+    toolbar_separator = orage_toolbar_append_separator(apptw->Toolbar, -1);
+    tool_item = GTK_WIDGET(gtk_tool_item_new());
+    gtk_container_add(GTK_CONTAINER(tool_item), apptw->File_insert_cb);
+    gtk_toolbar_insert(GTK_TOOLBAR(apptw->Toolbar), GTK_TOOL_ITEM(tool_item), -1);
+}
+
+static void remove_file_select_cb(appt_win *apptw)
+{
+    if (apptw->File_insert_cb)
+        gtk_widget_destroy(apptw->File_insert_cb);
+}
+
 static gboolean save_xfical_from_appt_win(appt_win *apptw)
 {
 #undef P_N
 #define P_N "save_xfical_from_appt_win: "
-    gint result;
-    gboolean ok = FALSE;
+    gint result, i;
+    gboolean ok = FALSE, found = FALSE;
     xfical_appt *appt = (xfical_appt *)apptw->xf_appt;
+    char *xf_file_id, *tmp;
 
     if (fill_appt_from_apptw(appt, apptw)) {
+        ok = TRUE;
         /* Here we try to save the event... */
         if (!xfical_file_open(TRUE)) {
             orage_message(150, P_N "file open and update failed: %s", apptw->xf_uid);
             return(FALSE);
         }
         if (apptw->appointment_add) {
-            apptw->xf_uid = g_strdup(xfical_appt_add(appt));
-            ok = (apptw->xf_uid ? TRUE : FALSE);
+            /* first check which file we are adding to */
+            if (apptw->File_insert_cb) {
+                tmp = gtk_combo_box_get_active_text(
+                        GTK_COMBO_BOX(apptw->File_insert_cb));
+                for (i = 0; i < g_par.foreign_count && !found; i++) {
+                    if (strcmp(g_par.foreign_data[i].file, tmp) == 0 ||
+                        strcmp(g_par.foreign_data[i].name, tmp) == 0) {
+                        found = TRUE;
+                    }
+                }
+                if (found) { /* it should always been found */
+                    xf_file_id = g_strdup_printf("F%02d.", i-1);
+                }
+                else { /* error! */
+                    orage_message(150, P_N "Matching foreign file not found: %s", tmp);
+                    ok = FALSE;
+                }
+            }
+            else {
+                xf_file_id = g_strdup("O00.");
+            }
+            if (ok) {
+                apptw->xf_uid = g_strdup(xfical_appt_add(xf_file_id, appt));
+                g_free(xf_file_id);
+                ok = (apptw->xf_uid ? TRUE : FALSE);
+            }
             if (ok) {
                 apptw->appointment_add = FALSE;
                 gtk_widget_set_sensitive(apptw->Duplicate, TRUE);
                 gtk_widget_set_sensitive(apptw->File_menu_duplicate, TRUE);
                 orage_message(10, "Added: %s", apptw->xf_uid);
+                remove_file_select_cb(apptw);
             }
             else {
                 orage_message(150, P_N "Addition failed: %s", apptw->xf_uid);
@@ -2368,6 +2439,9 @@ static gboolean fill_appt_window(appt_win *apptw, char *action, char *par)
         apptw->xf_appt = NULL;
         return(FALSE);
     }
+    if (apptw->appointment_add) {
+        add_file_select_cb(apptw);
+    }
     if (!appt->completed) { /* some nice default */
         t = orage_localtime(); /* probably completed today? */
         g_sprintf(appt->completedtime, XFICAL_APPT_TIME_FORMAT
diff --git a/src/appointment.h b/src/appointment.h
index 7f0a1f2..9a8d010 100644
--- a/src/appointment.h
+++ b/src/appointment.h
@@ -46,6 +46,7 @@ typedef struct _appt_win
     GtkWidget *Duplicate;
     GtkWidget *Save;
     GtkWidget *SaveClose;
+    GtkWidget *File_insert_cb;
 
     GtkWidget *Notebook;
     GtkWidget *General_notebook_page;
diff --git a/src/ical-code.c b/src/ical-code.c
index 0679fad..7b8464c 100644
--- a/src/ical-code.c
+++ b/src/ical-code.c
@@ -1486,7 +1486,7 @@ static char *appt_add_internal(xfical_appt *appt, gboolean add, char *uid
     dtstamp = icaltime_current_time_with_zone(utc_icaltimezone);
     if (add) {
         int_uid = ic_generate_uid();
-        ext_uid = g_strconcat("O00.", int_uid, NULL);
+        ext_uid = g_strconcat(uid, int_uid, NULL);
         appt->uid = ext_uid;
         create_time = dtstamp;
     }
@@ -1596,10 +1596,9 @@ static char *appt_add_internal(xfical_appt *appt, gboolean add, char *uid
   *           This ical id is owned by the routine. Do not deallocate it.
   *           It will be overwrittewritten by next invocation of this function.
   */
-char *xfical_appt_add(xfical_appt *appt)
+char *xfical_appt_add(char *ical_file_id, xfical_appt *appt)
 {
-    /* FIXME: make it possible to add events into foreign files */
-    return(appt_add_internal(appt, TRUE, NULL, icaltime_null_time()));
+    return(appt_add_internal(appt, TRUE, ical_file_id, icaltime_null_time()));
 }
 
 static gboolean get_alarm_trigger(icalcomponent *ca,  xfical_appt *appt)
@@ -2530,7 +2529,7 @@ gboolean xfical_appt_del(char *ical_uid)
          c != 0;
          c = icalcomponent_get_next_component(base, ICAL_ANY_COMPONENT)) {
         uid = (char *)icalcomponent_get_uid(c);
-        if (strcmp(uid, int_uid) == 0) {
+        if (ORAGE_STR_EXISTS(uid) && strcmp(uid, int_uid) == 0) {
             icalcomponent_remove_component(base, c);
             icalset_mark(fbase);
             xfical_alarm_build_list_internal(FALSE);
@@ -3112,7 +3111,7 @@ static void process_alarm_data(icalcomponent *ca, alarm_struct *new_alarm)
 }
 
 static void xfical_alarm_build_list_internal_real(gboolean first_list_today
-        , icalcomponent *base, char *file_type)
+        , icalcomponent *base, char *file_type, char *file_name)
 {
 #undef P_N
 #define P_N "xfical_alarm_build_list_internal_real: "
@@ -3179,21 +3178,13 @@ static void xfical_alarm_build_list_internal_real(gboolean first_list_today
         if (strcmp(file_type, "O00.") == 0)
             orage_message(60, _("Created alarm list for main Orage file:"));
         else 
-            orage_message(60, _("Created alarm list for foreign file: %s")
-                    , file_type);
+            orage_message(60, _("Created alarm list for foreign file: %s (%s)")
+                    , file_name, file_type);
         orage_message(60, _("\tAdded %d alarms. Processed %d events.")
                 , cnt_alarm_add, cnt_event);
         orage_message(60, _("\tFound %d alarms of which %d are active. (Searched %d recurring alarms.)")
                 , cnt_alarm, cnt_act_alarm, cnt_repeat);
     }
-/*
-    else {
-        orage_message(60, _("Build alarm list: Added %d alarms. Processed %d events.")
-                , cnt_alarm_add, cnt_event);
-        orage_message(60, _("\tFound %d alarms of which %d are active. (Searched %d recurring alarms.)")
-                , cnt_alarm, cnt_act_alarm, cnt_repeat);
-    }
-*/
 }
 
 static void xfical_alarm_build_list_internal(gboolean first_list_today)
@@ -3211,12 +3202,13 @@ static void xfical_alarm_build_list_internal(gboolean first_list_today)
 
     /* first search base orage file */
     strcpy(file_type, "O00.");
-    xfical_alarm_build_list_internal_real(first_list_today, ic_ical, file_type);
+    xfical_alarm_build_list_internal_real(first_list_today, ic_ical, file_type
+            , NULL);
     /* then process all foreign files */
     for (i = 0; i < g_par.foreign_count; i++) {
         g_sprintf(file_type, "F%02d.", i);
-        xfical_alarm_build_list_internal_real(first_list_today, ic_f_ical[i].ical
-                , file_type);
+        xfical_alarm_build_list_internal_real(first_list_today
+                , ic_f_ical[i].ical, file_type, g_par.foreign_data[i].name);
     }
     setup_orage_alarm_clock(); /* keep reminders upto date */
     build_mainbox_info();      /* refresh main calendar window lists */
diff --git a/src/ical-code.h b/src/ical-code.h
index f479c85..155a90d 100644
--- a/src/ical-code.h
+++ b/src/ical-code.h
@@ -138,7 +138,7 @@ void xfical_file_close(gboolean foreign);
 void xfical_file_close_force(void);
 
 xfical_appt *xfical_appt_alloc();
-char *xfical_appt_add(xfical_appt *appt);
+char *xfical_appt_add(char *ical_file_id, xfical_appt *appt);
 xfical_appt *xfical_appt_get(char *ical_id);
 void xfical_appt_free(xfical_appt *appt);
 gboolean xfical_appt_mod(char *ical_id, xfical_appt *appt);
diff --git a/src/interface.c b/src/interface.c
index 9fcbea9..3acdffc 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -522,7 +522,7 @@ static void for_open_button_clicked(GtkButton *button, gpointer user_data)
     intf_win *intf_w = (intf_win *)user_data;
     GtkWidget *f_chooser;
     gchar *entry_filename, *file_path=NULL;
-    gchar *cal_file;
+    gchar *cal_file, *cal_name;
 
     entry_filename = g_strdup(gtk_entry_get_text(
             (GtkEntry *)intf_w->for_new_entry));
@@ -538,8 +538,12 @@ static void for_open_button_clicked(GtkButton *button, gpointer user_data)
         cal_file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(f_chooser));
         if (cal_file) {
             gtk_entry_set_text(GTK_ENTRY(intf_w->for_new_entry), cal_file);
-            gtk_widget_grab_focus(intf_w->for_new_entry);
-            gtk_editable_set_position(GTK_EDITABLE(intf_w->for_new_entry), -1);
+            cal_name = g_path_get_basename(cal_file);
+            gtk_entry_set_text(GTK_ENTRY(intf_w->for_new_name_entry), cal_name);
+            gtk_widget_grab_focus(intf_w->for_new_name_entry);
+            gtk_editable_set_position(GTK_EDITABLE(intf_w->for_new_name_entry)
+                    , -1);
+            g_free(cal_name);
             g_free(cal_file);
         }
     }
@@ -552,13 +556,16 @@ static void orage_foreign_file_remove_line(gint del_line)
     int i;
 
     g_free(g_par.foreign_data[del_line].file);
+    g_free(g_par.foreign_data[del_line].name);
     g_par.foreign_count--;
     for (i = del_line; i < g_par.foreign_count; i++) {
         g_par.foreign_data[i].file = g_par.foreign_data[i+1].file;
         g_par.foreign_data[i].read_only = g_par.foreign_data[i+1].read_only;
         g_par.foreign_data[i].latest_file_change = g_par.foreign_data[i+1].latest_file_change;
+        g_par.foreign_data[i].name = g_par.foreign_data[i+1].name;
     }
     g_par.foreign_data[i].file = NULL;
+    g_par.foreign_data[i].name = NULL;
 
     write_parameters();
     orage_mark_appointments();
@@ -579,7 +586,8 @@ gboolean orage_foreign_file_remove(gchar *filename)
         return(FALSE);
     }
     for (i = 0; i < g_par.foreign_count && !found; i++) {
-        if (strcmp(g_par.foreign_data[i].file, filename) == 0) {
+        if (strcmp(g_par.foreign_data[i].file, filename) == 0 ||
+            strcmp(g_par.foreign_data[i].name, filename) == 0) {
             found = TRUE;
         }
     }
@@ -594,9 +602,13 @@ gboolean orage_foreign_file_remove(gchar *filename)
 
 static void for_remove_button_clicked(GtkButton *button, gpointer user_data)
 {
+#undef P_N
+#define P_N "for_remove_button_clicked: "
     gint del_line = GPOINTER_TO_INT(user_data);
 
+    orage_message(90, P_N "Removing foreign file %s (%s).", g_par.foreign_data[del_line].name, g_par.foreign_data[del_line].file);
     orage_foreign_file_remove_line(del_line);
+    orage_message(90, P_N "Foreign file removed and Orage alarms refreshed.");
 }
 
 static void for_remove_button_clicked2(GtkButton *button, gpointer user_data)
@@ -624,7 +636,12 @@ static void refresh_foreign_files(intf_win *intf_w, gboolean first)
     if (g_par.foreign_count) {
         for (i = 0; i < g_par.foreign_count; i++) {
             hbox = gtk_hbox_new(FALSE, 0);
-            label = gtk_label_new(g_par.foreign_data[i].file);
+            if (g_par.foreign_data[i].name) {
+                label = gtk_label_new(g_par.foreign_data[i].name);
+                gtk_widget_set_tooltip_text(label, g_par.foreign_data[i].file);
+            }
+            else
+                label = gtk_label_new(g_par.foreign_data[i].file);
             gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
             gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 5);
             if (g_par.foreign_data[i].read_only)
@@ -639,6 +656,7 @@ static void refresh_foreign_files(intf_win *intf_w, gboolean first)
             orage_table_add_row(intf_w->for_cur_table
                     , label, hbox
                     , i, (GTK_EXPAND | GTK_FILL), (0));
+
             g_signal_connect((gpointer)button, "clicked"
                     , G_CALLBACK(for_remove_button_clicked),GINT_TO_POINTER(i));
             g_signal_connect_after((gpointer)button, "clicked"
@@ -654,31 +672,68 @@ static void refresh_foreign_files(intf_win *intf_w, gboolean first)
     gtk_widget_show_all(intf_w->for_cur_frame);
 }
 
-static gboolean orage_foreign_file_add_internal(gchar *filename, gboolean read_only)
+static gboolean orage_foreign_file_add_internal(gchar *filename
+        , gchar *name, gboolean read_only, GtkWidget *main_window)
 {
+#undef P_N
+#define P_N "orage_foreign_file_add_internal: "
     gint i = 0;
+    gint result;
+    char *add_failed = _("Foreign file add failed");
 
     if (g_par.foreign_count > 9) {
-        g_warning("Orage can only handle 10 foreign files. Limit reached. New file not added.");
+        orage_message(150, P_N "Orage can only handle 10 foreign files. Limit reached. New file not added.");
+        if (main_window)
+            result = orage_error_dialog(GTK_WINDOW(main_window)
+                    , add_failed
+                    , _("Orage can only handle 10 foreign files. Limit reached."));
         return(FALSE);
     }
     if (!ORAGE_STR_EXISTS(filename)) {
-        g_warning("File is empty. New file not added.");
+        orage_message(150, P_N "File is empty. New file not added.");
+        if (main_window)
+            result = orage_error_dialog(GTK_WINDOW(main_window)
+                    , add_failed
+                    , _("Filename is empty."));
+        return(FALSE);
+    }
+    if (!ORAGE_STR_EXISTS(name)) {
+        orage_message(150, P_N "Name is empty. New file not added.");
+        if (main_window)
+            result = orage_error_dialog(GTK_WINDOW(main_window)
+                    , add_failed
+                    , _("Name is empty."));
         return(FALSE);
     }
     if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
-        g_warning("New file %s does not exist. New file not added."
-                , filename);
+        orage_message(150, P_N "New file %s does not exist. New file not added.", filename);
+        if (main_window)
+            result = orage_error_dialog(GTK_WINDOW(main_window)
+                    , add_failed
+                    , _("File does not exist."));
         return(FALSE);
     }
     for (i = 0; i < g_par.foreign_count; i++) {
         if (strcmp(g_par.foreign_data[i].file, filename) == 0) {
-            g_warning("Foreign file already exists.");
+            orage_message(150, P_N "Foreign file already exists. New file not added");
+            if (main_window)
+                result = orage_error_dialog(GTK_WINDOW(main_window)
+                        , add_failed
+                        , _("Same filename already exists in Orage."));
+                return(FALSE);
+        }
+        if (strcmp(g_par.foreign_data[i].name, name) == 0) {
+            orage_message(150, P_N "Foreign file name already exists. New file not added");
+            if (main_window)
+                result = orage_error_dialog(GTK_WINDOW(main_window)
+                        , add_failed
+                        , _("Same name already exists in Orage."));
             return(FALSE);
         }
     }
 
     g_par.foreign_data[g_par.foreign_count].file = g_strdup(filename);
+    g_par.foreign_data[g_par.foreign_count].name = g_strdup(name);
     g_par.foreign_data[g_par.foreign_count].read_only = read_only;
     g_par.foreign_data[g_par.foreign_count].latest_file_change = (time_t)0;
     g_par.foreign_count++;
@@ -690,26 +745,35 @@ static gboolean orage_foreign_file_add_internal(gchar *filename, gboolean read_o
 }
 
 /* this is used from command line */
-gboolean orage_foreign_file_add(gchar *filename, gboolean read_only)
+gboolean orage_foreign_file_add(gchar *filename, gboolean read_only
+        , gchar *name)
 {
     if (interface_lock) {
         g_warning("Exchange window active, can't add files from cmd line\n");
         return(FALSE);
     }
-    return(orage_foreign_file_add_internal(filename, read_only));
+    return(orage_foreign_file_add_internal(filename, name, read_only, NULL));
 }
 
 static void for_add_button_clicked(GtkButton *button, gpointer user_data)
 {
+#undef P_N
+#define P_N "for_add_button_clicked: "
     intf_win *intf_w = (intf_win *)user_data;
     const gchar *entry_filename;
+    const gchar *entry_name;
     gboolean read_only;
 
     entry_filename = gtk_entry_get_text((GtkEntry *)intf_w->for_new_entry);
+    entry_name = gtk_entry_get_text((GtkEntry *)intf_w->for_new_name_entry);
     read_only = gtk_toggle_button_get_active(
             GTK_TOGGLE_BUTTON(intf_w->for_new_read_only));
-    if (orage_foreign_file_add_internal((char *)entry_filename, read_only))
+    if (orage_foreign_file_add_internal((char *)entry_filename
+                , (char *)entry_name, read_only, intf_w->main_window)) {
         refresh_foreign_files(intf_w, FALSE);
+        orage_message(80, P_N "New foreign file %s (%s) added.", entry_name
+                , entry_filename);
+    }
 }
 
 static void close_intf_w(gpointer user_data)
@@ -1054,14 +1118,14 @@ static void create_orage_file_tab(intf_win *intf_w)
             , intf_w->orage_file_frame, FALSE, FALSE, 5);
 
     hbox = gtk_hbox_new(FALSE, 0);
-    label = gtk_label_new(_("Current file"));
+    label = gtk_label_new(_("Current file:"));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
     label = gtk_label_new((const gchar *)g_par.orage_file);
     gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 5);
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
 
     hbox = gtk_hbox_new(FALSE, 0);
-    label = gtk_label_new(_("New file"));
+    label = gtk_label_new(_("New file:"));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
     intf_w->orage_file_entry = gtk_entry_new();
     gtk_entry_set_text(GTK_ENTRY(intf_w->orage_file_entry)
@@ -1077,7 +1141,7 @@ static void create_orage_file_tab(intf_win *intf_w)
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
 
     hbox = gtk_hbox_new(FALSE, 0);
-    label = gtk_label_new(_("Action options"));
+    label = gtk_label_new(_("Action options:"));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
     intf_w->orage_file_rename_rb = 
             gtk_radio_button_new_with_label(NULL, _("Rename"));
@@ -1119,14 +1183,14 @@ static void create_orage_file_tab(intf_win *intf_w)
             , intf_w->archive_file_frame, FALSE, FALSE, 5);
 
     hbox = gtk_hbox_new(FALSE, 0);
-    label = gtk_label_new(_("Current file"));
+    label = gtk_label_new(_("Current file:"));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
     label = gtk_label_new((const gchar *)g_par.archive_file);
     gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 5);
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
 
     hbox = gtk_hbox_new(FALSE, 0);
-    label = gtk_label_new(_("New file"));
+    label = gtk_label_new(_("New file:"));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
     intf_w->archive_file_entry = gtk_entry_new();
     gtk_entry_set_text(GTK_ENTRY(intf_w->archive_file_entry)
@@ -1143,7 +1207,7 @@ static void create_orage_file_tab(intf_win *intf_w)
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
 
     hbox = gtk_hbox_new(FALSE, 0);
-    label = gtk_label_new(_("Action options"));
+    label = gtk_label_new(_("Action options:"));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
     intf_w->archive_file_rename_rb = 
             gtk_radio_button_new_with_label(NULL, _("Rename"));
@@ -1208,17 +1272,26 @@ static void create_foreign_file_tab(intf_win *intf_w)
             , G_CALLBACK(for_add_button_clicked), intf_w);
 
     hbox = gtk_hbox_new(FALSE, 0);
-    label = gtk_label_new(_("Options"));
+    /*
+    label = gtk_label_new(_("Options:"));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+    */
+    label = gtk_label_new(_("Visible name:"));
+    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
+    intf_w->for_new_name_entry = gtk_entry_new();
+    gtk_box_pack_start(GTK_BOX(hbox), intf_w->for_new_name_entry
+            , TRUE, TRUE, 0);
+    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
     intf_w->for_new_read_only = gtk_check_button_new_with_label(_("Read only"));
     gtk_toggle_button_set_active(
             GTK_TOGGLE_BUTTON(intf_w->for_new_read_only), TRUE);
     gtk_box_pack_start(GTK_BOX(hbox), intf_w->for_new_read_only
             , FALSE, FALSE, 5);
-    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
 
     gtk_widget_set_tooltip_text(intf_w->for_new_read_only
             , _("Set this if you want to make sure that this file is never modified by Orage.\nNote that modifying foreign files may make them incompatible with the original tool, where they came from!"));
+    gtk_widget_set_tooltip_text(intf_w->for_new_name_entry
+            , _("This internal name is displayed to user instead of file name."));
 
     /***** Current files *****/
     refresh_foreign_files(intf_w, TRUE);
diff --git a/src/interface.h b/src/interface.h
index 679a564..7ab5caf 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -77,7 +77,7 @@ typedef struct _intf_win
     GtkWidget *archive_file_copy_rb;
     GtkWidget *archive_file_move_rb;
 
-        /* Foreign tab */
+        /* Foreign files tab */
     GtkWidget *for_notebook_page;
     GtkWidget *for_tab_label;
     GtkWidget *for_tab_main_vbox;
@@ -87,6 +87,7 @@ typedef struct _intf_win
     GtkWidget *for_new_open_button;
     GtkWidget *for_new_save_button;
     GtkWidget *for_new_read_only;
+    GtkWidget *for_new_name_entry;
     /* currrent files */
     GtkWidget *for_cur_frame;
     GtkWidget *for_cur_table;
@@ -97,7 +98,8 @@ typedef struct _intf_win
 void orage_external_interface(CalWin *xfcal);
 
 gboolean orage_external_update_check(gpointer user_data);
-gboolean orage_foreign_file_add(gchar *filename, gboolean read_only);
+gboolean orage_foreign_file_add(gchar *filename, gboolean read_only
+        , gchar *name);
 gboolean orage_foreign_file_remove(gchar *filename);
 gboolean orage_import_file(gchar *entry_filename);
 gboolean orage_export_file(gchar *entry_filename, gint type, gchar *uids);
diff --git a/src/main.c b/src/main.c
index 08da96e..f704e68 100644
--- a/src/main.c
+++ b/src/main.c
@@ -316,7 +316,7 @@ static void print_help(void)
     g_print(_("--help (-h) \t\tprint this text\n"));
     g_print(_("--preferences (-p) \tshow preferences form\n"));
     g_print(_("--toggle (-t) \t\tmake orage visible/unvisible\n"));
-    g_print(_("--add-foreign (-a) file [RW] \tadd a foreign file\n"));
+    g_print(_("--add-foreign (-a) file [RW] [name] \tadd a foreign file\n"));
     g_print(_("--remove-foreign (-r) file \tremove a foreign file\n"));
     g_print(_("--export (-e) file [appointment...] \texport appointments from Orage to file\n"));
     g_print("\n");
@@ -379,24 +379,25 @@ static void export_file(gboolean running, char *file_name, gboolean initialized
 }
 
 static void add_foreign(gboolean running, char *file_name, gboolean initialized
-        , gboolean read_only)
+        , gboolean read_only, char *name)
 {
+    g_print("\nadd_foreign: file_name%s name:%s\n\n", file_name, name);
     if (running && !initialized) {
         /* let's use dbus since server is running there already */
 #ifdef HAVE_DBUS
-        if (orage_dbus_foreign_add(file_name, read_only))
-            orage_message(40, "add done foreign file=%s", file_name);
+        if (orage_dbus_foreign_add(file_name, read_only, name))
+            orage_message(40, "Add done online foreign file=%s", file_name);
         else
-            g_warning("add failed foreign file=%s\n", file_name);
+            orage_message(140, "Add failed online foreign file=%s\n", file_name);
 #else
-        g_warning("Can not do add foreign file without dbus. failed file=%s\n", file_name);
+        orage_message(140, "Can not do add foreign file to running Orage without dbus. Add failed foreign file=%s\n", file_name);
 #endif
     }
     else if (!running && initialized) { /* do it self directly */
-        if (orage_foreign_file_add(file_name, read_only))
-            orage_message(40, "add done foreign file=%s", file_name);
+        if (orage_foreign_file_add(file_name, read_only, name))
+            orage_message(40, "Add done foreign file=%s", file_name);
         else
-            g_warning("add failed foreign file=%s\n", file_name);
+            orage_message(140, "Add failed foreign file=%s\n", file_name);
     }
 }
 
@@ -406,18 +407,18 @@ static void remove_foreign(gboolean running, char *file_name, gboolean initializ
         /* let's use dbus since server is running there already */
 #ifdef HAVE_DBUS
         if (orage_dbus_foreign_remove(file_name))
-            orage_message(40, "remove done foreign file=%s", file_name);
+            orage_message(40, "Remove done foreign file=%s", file_name);
         else
-            g_warning("remove failed foreign file=%s\n", file_name);
+            orage_message(140, "Remove failed foreign file=%s\n", file_name);
 #else
-        g_warning("Can not do remove foreign file without dbus. failed file=%s\n", file_name);
+        orage_message(140, "Can not do remove foreign file without dbus. Remove failed foreign file=%s\n", file_name);
 #endif
     }
     else if (!running && initialized) { /* do it self directly */
         if (orage_foreign_file_remove(file_name))
-            orage_message(40, "remove done foreign file=%s", file_name);
+            orage_message(40, "Remove done foreign file=%s", file_name);
         else
-            g_warning("remove failed foreign file=%s\n", file_name);
+            orage_message(140, "Remove failed foreign file=%s\n", file_name);
     }
 }
 
@@ -427,6 +428,7 @@ static gboolean process_args(int argc, char *argv[], gboolean running
     int argi;
     gboolean end = FALSE;
     gboolean foreign_file_read_only = TRUE;
+    gboolean foreign_file_name_parameter = FALSE;
     gchar *export_uid_list = NULL;
     gchar *file_name = NULL;
 
@@ -481,11 +483,26 @@ static gboolean process_args(int argc, char *argv[], gboolean running
                     !strcmp(argv[argi+2], "RW") ||
                     !strcmp(argv[argi+2], "READWRITE"))) {
                     foreign_file_read_only = FALSE;
+                    if (argi+3 < argc) {
+                        file_name = g_strdup(argv[argi+3]);
+                        foreign_file_name_parameter = TRUE;
+                    }
+                }
+                else if (argi+2 < argc) { /* take argi+2 as name of file */
+                    file_name = g_strdup(argv[argi+2]);
+                    foreign_file_name_parameter = TRUE;
+                }
+                if (!file_name) {
+                    file_name = g_path_get_basename(argv[argi+1]);
                 }
                 add_foreign(running, argv[++argi], initialized
-                        , foreign_file_read_only);
+                        , foreign_file_read_only, file_name);
                 if (!foreign_file_read_only)
                     ++argi;
+                if (foreign_file_name_parameter) {
+                    ++argi;
+                }
+                g_free(file_name);
             }
         }
         else if (!strcmp(argv[argi], "--remove-foreign") ||
diff --git a/src/orage-dbus-client.c b/src/orage-dbus-client.c
index bd7cb85..49fdd7a 100644
--- a/src/orage-dbus-client.c
+++ b/src/orage-dbus-client.c
@@ -99,7 +99,8 @@ gboolean orage_dbus_export_file(gchar *file_name, gint type, gchar *uids)
     };
 }
 
-gboolean orage_dbus_foreign_add(gchar *file_name, gboolean read_only)
+gboolean orage_dbus_foreign_add(gchar *file_name, gboolean read_only
+        , gchar *name)
 {
     DBusGConnection *connection;
     GError *error = NULL;
@@ -118,6 +119,7 @@ gboolean orage_dbus_foreign_add(gchar *file_name, gboolean read_only)
     if (dbus_g_proxy_call(proxy, "AddForeign", &error
                 , G_TYPE_STRING, file_name
                 , G_TYPE_BOOLEAN, read_only
+                , G_TYPE_STRING, name
                 , G_TYPE_INVALID, G_TYPE_INVALID)) {
         return(TRUE);
     }
diff --git a/src/orage-dbus-client.h b/src/orage-dbus-client.h
index 3da3ecc..b4a0f3e 100644
--- a/src/orage-dbus-client.h
+++ b/src/orage-dbus-client.h
@@ -92,10 +92,10 @@ static
 inline
 #endif
 gboolean
-org_xfce_calendar_add_foreign (DBusGProxy *proxy, const char * IN_file, const gboolean IN_mode, GError **error)
+org_xfce_calendar_add_foreign (DBusGProxy *proxy, const char * IN_file, const gboolean IN_mode, const char * IN_name, GError **error)
 
 {
-  return dbus_g_proxy_call (proxy, "AddForeign", error, G_TYPE_STRING, IN_file, G_TYPE_BOOLEAN, IN_mode, G_TYPE_INVALID, G_TYPE_INVALID);
+  return dbus_g_proxy_call (proxy, "AddForeign", error, G_TYPE_STRING, IN_file, G_TYPE_BOOLEAN, IN_mode, G_TYPE_STRING, IN_name, G_TYPE_INVALID, G_TYPE_INVALID);
 }
 
 typedef void (*org_xfce_calendar_add_foreign_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
@@ -115,14 +115,14 @@ static
 inline
 #endif
 DBusGProxyCall*
-org_xfce_calendar_add_foreign_async (DBusGProxy *proxy, const char * IN_file, const gboolean IN_mode, org_xfce_calendar_add_foreign_reply callback, gpointer userdata)
+org_xfce_calendar_add_foreign_async (DBusGProxy *proxy, const char * IN_file, const gboolean IN_mode, const char * IN_name, org_xfce_calendar_add_foreign_reply callback, gpointer userdata)
 
 {
   DBusGAsyncData *stuff;
   stuff = g_new (DBusGAsyncData, 1);
   stuff->cb = G_CALLBACK (callback);
   stuff->userdata = userdata;
-  return dbus_g_proxy_begin_call (proxy, "AddForeign", org_xfce_calendar_add_foreign_async_callback, stuff, g_free, G_TYPE_STRING, IN_file, G_TYPE_BOOLEAN, IN_mode, G_TYPE_INVALID);
+  return dbus_g_proxy_begin_call (proxy, "AddForeign", org_xfce_calendar_add_foreign_async_callback, stuff, g_free, G_TYPE_STRING, IN_file, G_TYPE_BOOLEAN, IN_mode, G_TYPE_STRING, IN_file, G_TYPE_INVALID);
 }
 
 
diff --git a/src/orage-dbus-object.c b/src/orage-dbus-object.c
index ba58eca..b4ab0a9 100644
--- a/src/orage-dbus-object.c
+++ b/src/orage-dbus-object.c
@@ -34,7 +34,8 @@
 /* defined in interface.c */
 gboolean orage_import_file(gchar *entry_filename);
 gboolean orage_export_file(gchar *filename, gint type, gchar *uids);
-gboolean orage_foreign_file_add(gchar *filename, gboolean read_only);
+gboolean orage_foreign_file_add(gchar *filename, gboolean read_only
+                , gchar *name);
 gboolean orage_foreign_file_remove(gchar *filename);
 
 struct _OrageDBusClass
@@ -119,10 +120,11 @@ gboolean orage_dbus_service_export_file(DBusGProxy *proxy
 }
 
 gboolean orage_dbus_service_add_foreign(DBusGProxy *proxy
-        , const char *IN_file, const gboolean IN_mode
+        , const char *IN_file, const gboolean IN_mode, const char *IN_name
         , GError **error)
 {
-    if (orage_foreign_file_add((char *)IN_file, (gboolean)IN_mode)) {
+    if (orage_foreign_file_add((char *)IN_file, (gboolean)IN_mode
+                , (char *)IN_name)) {
         g_message("Orage **: DBUS Foreign file added %s", IN_file);
         return(TRUE);
     }
diff --git a/src/orage-dbus-object.h b/src/orage-dbus-object.h
index 8eba47f..0535973 100644
--- a/src/orage-dbus-object.h
+++ b/src/orage-dbus-object.h
@@ -47,7 +47,7 @@ gboolean orage_dbus_service_export_file(DBusGProxy *proxy
                 , const char *IN_file, const gint IN_type, const char *IN_uids
                 , GError **error);
 gboolean orage_dbus_service_add_foreign(DBusGProxy *proxy
-                , const char *IN_file, const gboolean IN_mode
+                , const char *IN_file, const gboolean IN_mode, const char *IN_name
                 , GError **error);
 gboolean orage_dbus_service_remove_foreign(DBusGProxy *proxy
                 , const char *IN_file
diff --git a/src/orage-dbus-service.h b/src/orage-dbus-service.h
index 645695d..6ede8fe 100644
--- a/src/orage-dbus-service.h
+++ b/src/orage-dbus-service.h
@@ -53,33 +53,34 @@ G_BEGIN_DECLS
 #endif /* !G_ENABLE_DEBUG */
 
 
-/* BOOLEAN:STRING,BOOLEAN,POINTER */
-extern void dbus_glib_marshal_orage_BOOLEAN__STRING_BOOLEAN_POINTER (GClosure     *closure,
-                                                                     GValue       *return_value,
-                                                                     guint         n_param_values,
-                                                                     const GValue *param_values,
-                                                                     gpointer      invocation_hint,
-                                                                     gpointer      marshal_data);
+/* BOOLEAN:STRING,BOOLEAN,STRING,POINTER */
+extern void dbus_glib_marshal_orage_BOOLEAN__STRING_BOOLEAN_STRING_POINTER (GClosure     *closure,
+                                                                            GValue       *return_value,
+                                                                            guint         n_param_values,
+                                                                            const GValue *param_values,
+                                                                            gpointer      invocation_hint,
+                                                                            gpointer      marshal_data);
 void
-dbus_glib_marshal_orage_BOOLEAN__STRING_BOOLEAN_POINTER (GClosure     *closure,
-                                                         GValue       *return_value G_GNUC_UNUSED,
-                                                         guint         n_param_values,
-                                                         const GValue *param_values,
-                                                         gpointer      invocation_hint G_GNUC_UNUSED,
-                                                         gpointer      marshal_data)
+dbus_glib_marshal_orage_BOOLEAN__STRING_BOOLEAN_STRING_POINTER (GClosure     *closure,
+                                                                GValue       *return_value G_GNUC_UNUSED,
+                                                                guint         n_param_values,
+                                                                const GValue *param_values,
+                                                                gpointer      invocation_hint G_GNUC_UNUSED,
+                                                                gpointer      marshal_data)
 {
-  typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_BOOLEAN_POINTER) (gpointer     data1,
-                                                                    gpointer     arg_1,
-                                                                    gboolean     arg_2,
-                                                                    gpointer     arg_3,
-                                                                    gpointer     data2);
-  register GMarshalFunc_BOOLEAN__STRING_BOOLEAN_POINTER callback;
+  typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_BOOLEAN_STRING_POINTER) (gpointer     data1,
+                                                                           gpointer     arg_1,
+                                                                           gboolean     arg_2,
+                                                                           gpointer     arg_3,
+                                                                           gpointer     arg_4,
+                                                                           gpointer     data2);
+  register GMarshalFunc_BOOLEAN__STRING_BOOLEAN_STRING_POINTER callback;
   register GCClosure *cc = (GCClosure*) closure;
   register gpointer data1, data2;
   gboolean v_return;
 
   g_return_if_fail (return_value != NULL);
-  g_return_if_fail (n_param_values == 4);
+  g_return_if_fail (n_param_values == 5);
 
   if (G_CCLOSURE_SWAP_DATA (closure))
     {
@@ -91,12 +92,13 @@ dbus_glib_marshal_orage_BOOLEAN__STRING_BOOLEAN_POINTER (GClosure     *closure,
       data1 = g_value_peek_pointer (param_values + 0);
       data2 = closure->data;
     }
-  callback = (GMarshalFunc_BOOLEAN__STRING_BOOLEAN_POINTER) (marshal_data ? marshal_data : cc->callback);
+  callback = (GMarshalFunc_BOOLEAN__STRING_BOOLEAN_STRING_POINTER) (marshal_data ? marshal_data : cc->callback);
 
   v_return = callback (data1,
                        g_marshal_value_peek_string (param_values + 1),
                        g_marshal_value_peek_boolean (param_values + 2),
-                       g_marshal_value_peek_pointer (param_values + 3),
+                       g_marshal_value_peek_string (param_values + 3),
+                       g_marshal_value_peek_pointer (param_values + 4),
                        data2);
 
   g_value_set_boolean (return_value, v_return);
@@ -208,14 +210,14 @@ G_END_DECLS
 static const DBusGMethodInfo dbus_glib_orage_methods[] = {
   { (GCallback) orage_dbus_service_load_file, dbus_glib_marshal_orage_BOOLEAN__STRING_POINTER, 0 },
   { (GCallback) orage_dbus_service_export_file, dbus_glib_marshal_orage_BOOLEAN__STRING_INT_STRING_POINTER, 39 },
-  { (GCallback) orage_dbus_service_add_foreign, dbus_glib_marshal_orage_BOOLEAN__STRING_BOOLEAN_POINTER, 98 },
-  { (GCallback) orage_dbus_service_remove_foreign, dbus_glib_marshal_orage_BOOLEAN__STRING_POINTER, 148 },
+  { (GCallback) orage_dbus_service_add_foreign, dbus_glib_marshal_orage_BOOLEAN__STRING_BOOLEAN_STRING_POINTER, 98 },
+  { (GCallback) orage_dbus_service_remove_foreign, dbus_glib_marshal_orage_BOOLEAN__STRING_POINTER, 157 },
 };
 
 const DBusGObjectInfo dbus_glib_orage_object_info = {  1,
   dbus_glib_orage_methods,
   4,
-"org.xfce.calendar\0LoadFile\0S\0file\0I\0s\0\0org.xfce.calendar\0ExportFile\0S\0file\0I\0s\0type\0I\0i\0uids\0I\0s\0\0org.xfce.calendar\0AddForeign\0S\0file\0I\0s\0mode\0I\0b\0\0org.xfce.calendar\0RemoveForeign\0S\0file\0I\0s\0\0\0",
+"org.xfce.calendar\0LoadFile\0S\0file\0I\0s\0\0org.xfce.calendar\0ExportFile\0S\0file\0I\0s\0type\0I\0i\0uids\0I\0s\0\0org.xfce.calendar\0AddForeign\0S\0file\0I\0s\0mode\0I\0b\0name\0I\0s\0\0org.xfce.calendar\0RemoveForeign\0S\0file\0I\0s\0\0\0",
 "\0",
 "\0"
 };
diff --git a/src/orage-dbus-service.xml b/src/orage-dbus-service.xml
index a9f6dcd..88a86cd 100644
--- a/src/orage-dbus-service.xml
+++ b/src/orage-dbus-service.xml
@@ -38,6 +38,7 @@
     <method name="AddForeign">
       <arg type="s" name="file" direction="in" />
       <arg type="b" name="mode" direction="in" />
+      <arg type="s" name="name" direction="in" />
     </method>
     <method name="RemoveForeign">
       <arg type="s" name="file" direction="in" />
diff --git a/src/orage-dbus.h b/src/orage-dbus.h
index 1b7c28e..583555b 100644
--- a/src/orage-dbus.h
+++ b/src/orage-dbus.h
@@ -26,7 +26,8 @@
 void orage_dbus_start(void);
 gboolean orage_dbus_import_file(gchar *file_name);
 gboolean orage_dbus_export_file(gchar *file_name, gint type, gchar *uids);
-gboolean orage_dbus_foreign_add(gchar *file_name, gboolean read_only);
+gboolean orage_dbus_foreign_add(gchar *file_name, gboolean read_only
+        , gchar *name);
 gboolean orage_dbus_foreign_remove(gchar *file_name);
 
 #endif /* !__ORAGE_DBUS_H__ */
diff --git a/src/parameters.c b/src/parameters.c
index c9fdaf5..088a4de 100644
--- a/src/parameters.c
+++ b/src/parameters.c
@@ -1252,6 +1252,8 @@ void read_parameters(void)
         g_par.foreign_data[i].file = orage_rc_get_str(orc, f_par, NULL);
         g_sprintf(f_par, "Foreign file %02d read-only", i);
         g_par.foreign_data[i].read_only = orage_rc_get_bool(orc, f_par, TRUE);
+        g_sprintf(f_par, "Foreign file %02d visible name", i);
+        g_par.foreign_data[i].name = orage_rc_get_str(orc, f_par, g_par.foreign_data[i].file);
     }
     g_par.use_foreign_display_alarm_notify = orage_rc_get_bool(orc
             , "Use notify foreign alarm", FALSE);
@@ -1298,8 +1300,7 @@ void write_parameters(void)
     orage_rc_put_int(orc, "Dayview window Y", g_par.dw_size_y);
     orage_rc_put_bool(orc, "Dayview week mode", g_par.dw_week_mode);
     orage_rc_put_bool(orc, "Show Main Window Menu", g_par.show_menu);
-    orage_rc_put_bool(orc, "Select Always Today"
-            , g_par.select_always_today);
+    orage_rc_put_bool(orc, "Select Always Today", g_par.select_always_today);
     orage_rc_put_bool(orc, "Show borders", g_par.show_borders);
     orage_rc_put_bool(orc, "Show heading", g_par.show_heading);
     orage_rc_put_bool(orc, "Show day names", g_par.show_day_names);
@@ -1316,28 +1317,24 @@ void write_parameters(void)
     orage_rc_put_bool(orc, "Use dynamic icon", g_par.use_dynamic_icon);
     orage_rc_put_bool(orc, "Use own dynamic icon", g_par.use_own_dynamic_icon);
     orage_rc_put_str(orc, "Own icon file", g_par.own_icon_file);
-    orage_rc_put_str(orc, "Own icon row1 data"
-            , g_par.own_icon_row1_data);
+    orage_rc_put_str(orc, "Own icon row1 data", g_par.own_icon_row1_data);
     orage_rc_put_str(orc, "Own icon row1 color", g_par.own_icon_row1_color);
     orage_rc_put_str(orc, "Own icon row1 font", g_par.own_icon_row1_font);
     orage_rc_put_int(orc, "Own icon row1 x", g_par.own_icon_row1_x);
     orage_rc_put_int(orc, "Own icon row1 y", g_par.own_icon_row1_y);
-    orage_rc_put_str(orc, "Own icon row2 data"
-            , g_par.own_icon_row2_data);
+    orage_rc_put_str(orc, "Own icon row2 data", g_par.own_icon_row2_data);
     orage_rc_put_str(orc, "Own icon row2 color", g_par.own_icon_row2_color);
     orage_rc_put_str(orc, "Own icon row2 font", g_par.own_icon_row2_font);
     orage_rc_put_int(orc, "Own icon row2 x", g_par.own_icon_row2_x);
     orage_rc_put_int(orc, "Own icon row2 y", g_par.own_icon_row2_y);
-    orage_rc_put_str(orc, "Own icon row3 data"
-            , g_par.own_icon_row3_data);
+    orage_rc_put_str(orc, "Own icon row3 data", g_par.own_icon_row3_data);
     orage_rc_put_str(orc, "Own icon row3 color", g_par.own_icon_row3_color);
     orage_rc_put_str(orc, "Own icon row3 font", g_par.own_icon_row3_font);
     orage_rc_put_int(orc, "Own icon row3 x", g_par.own_icon_row3_x);
     orage_rc_put_int(orc, "Own icon row3 y", g_par.own_icon_row3_y);
     /* we write this with X so that we do not read it back unless
      * it is manually changed. It should need changes really seldom. */
-    orage_rc_put_int(orc, "XIcal week start day"
-            , g_par.ical_weekstartday);
+    orage_rc_put_int(orc, "XIcal week start day", g_par.ical_weekstartday);
     orage_rc_put_bool(orc, "Show days", g_par.show_days);
     orage_rc_put_int(orc, "Foreign file count", g_par.foreign_count);
     /* add what we have and remove the rest */
@@ -1346,6 +1343,8 @@ void write_parameters(void)
         orage_rc_put_str(orc, f_par, g_par.foreign_data[i].file);
         g_sprintf(f_par, "Foreign file %02d read-only", i);
         orage_rc_put_bool(orc, f_par, g_par.foreign_data[i].read_only);
+        g_sprintf(f_par, "Foreign file %02d visible name", i);
+        orage_rc_put_str(orc, f_par, g_par.foreign_data[i].name);
     }
     for (i = g_par.foreign_count; i < 10;  i++) {
         g_sprintf(f_par, "Foreign file %02d name", i);
@@ -1354,6 +1353,8 @@ void write_parameters(void)
         orage_rc_del_item(orc, f_par);
         g_sprintf(f_par, "Foreign file %02d read-only", i);
         orage_rc_del_item(orc, f_par);
+        g_sprintf(f_par, "Foreign file %02d visible name", i);
+        orage_rc_del_item(orc, f_par);
     }
     orage_rc_put_bool(orc, "Use notify foreign alarm"
             , g_par.use_foreign_display_alarm_notify);
diff --git a/src/parameters.h b/src/parameters.h
index 849ef2e..66b0c50 100644
--- a/src/parameters.h
+++ b/src/parameters.h
@@ -30,6 +30,7 @@ typedef struct _foreign_file
     char *file;
     gboolean read_only;
     time_t latest_file_change;
+    char *name;
 } foreign_file;
 
 
diff --git a/src/reminder.c b/src/reminder.c
index 6829f1e..a14557d 100644
--- a/src/reminder.c
+++ b/src/reminder.c
@@ -1132,8 +1132,10 @@ static gboolean orage_tooltip_update(gpointer user_data)
             if (cur_alarm->temporary) { /* let's add a small mark */
                 g_string_append_c(tooltip_highlight_helper, '[');
             }
-            tmp = g_markup_escape_text(cur_alarm->title
-                    , strlen(cur_alarm->title));
+            tmp = cur_alarm->title 
+                ? g_markup_escape_text(cur_alarm->title
+                        , strlen(cur_alarm->title))
+                : g_strdup(_("No title defined"));
             g_string_append_printf(tooltip_highlight_helper, "%s", tmp);
             g_free(tmp);
             if (cur_alarm->temporary) { /* let's add a small mark */


More information about the Xfce4-commits mailing list