[Xfce4-commits] <orage:master> 4.8.2.7: Improvement to read-only handling

Juha Kautto noreply at xfce.org
Tue Nov 29 12:24:01 CET 2011


Updating branch refs/heads/master
         to cb6adc1b74e744b41ead4fe25b7626e676ce5d68 (commit)
       from ad3b9e2c597659742ddb90522dc7ad8a70800d08 (commit)

commit cb6adc1b74e744b41ead4fe25b7626e676ce5d68
Author: Juha Kautto <juha at xfce.org>
Date:   Tue Nov 29 13:20:20 2011 +0200

    4.8.2.7: Improvement to read-only handling
    
    It is now impossible to modify read-only appointments in appointment window.
    This is a lot better than allowing changes and then giving error on save.

 configure.in.in   |    2 +-
 src/appointment.c |   28 ++++++++++++++++++++++++++--
 src/ical-code.c   |   12 ++++++++----
 src/ical-code.h   |    1 +
 4 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index da69525..ec68bb3 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.8.2.6-git])
+m4_define([orage_version], [4.8.2.7-git])
 
 m4_define([gtk_minimum_version], [2.10.0])
 m4_define([xfce_minimum_version], [4.6.0])
diff --git a/src/appointment.c b/src/appointment.c
index a2b6596..f60f607 100644
--- a/src/appointment.c
+++ b/src/appointment.c
@@ -370,6 +370,27 @@ static void type_hide_show(appt_win *apptw)
     set_time_sensitivity(apptw); /* todo has different settings */
 }
 
+static void readonly_hide_show(appt_win *apptw)
+{
+    if (((xfical_appt *)apptw->xf_appt)->readonly) {
+        gtk_widget_set_sensitive(apptw->General_notebook_page, FALSE);
+        gtk_widget_set_sensitive(apptw->General_tab_label, FALSE);
+        gtk_widget_set_sensitive(apptw->Alarm_notebook_page, FALSE);
+        gtk_widget_set_sensitive(apptw->Alarm_tab_label, FALSE);
+        gtk_widget_set_sensitive(apptw->Recur_notebook_page, FALSE);
+        gtk_widget_set_sensitive(apptw->Recur_tab_label, FALSE);
+
+        gtk_widget_set_sensitive(apptw->Save, FALSE);
+        gtk_widget_set_sensitive(apptw->File_menu_save, FALSE);
+        gtk_widget_set_sensitive(apptw->SaveClose, FALSE);
+        gtk_widget_set_sensitive(apptw->File_menu_saveclose, FALSE);
+        gtk_widget_set_sensitive(apptw->Revert, FALSE);
+        gtk_widget_set_sensitive(apptw->File_menu_revert, FALSE);
+        gtk_widget_set_sensitive(apptw->Delete, FALSE);
+        gtk_widget_set_sensitive(apptw->File_menu_delete, FALSE);
+    }
+}
+
 static void set_sound_sensitivity(appt_win *apptw)
 {
     gboolean sound_act, repeat_act;
@@ -2301,10 +2322,12 @@ static void fill_appt_window(appt_win *apptw, char *action, char *par)
         apptw->appointment_new = FALSE;
     }
     else if (strcmp(action, "COPY") == 0) {
-            /* COPY uses old uid as base and adds new, so
-             * add == TRUE && new == FALSE */
+        /* COPY uses old uid as base and adds new, so
+         * add == TRUE && new == FALSE */
         apptw->appointment_add = TRUE;
         apptw->appointment_new = FALSE;
+        /* new copy is never readonly even though the original may have been */
+        appt->readonly = FALSE; 
     }
     else {
         g_error("fill_appt_window: unknown parameter\n");
@@ -3513,6 +3536,7 @@ appt_win *create_appt_win(char *action, char *par)
         gtk_widget_show_all(apptw->Window);
         recur_hide_show(apptw);
         type_hide_show(apptw);
+        readonly_hide_show(apptw);
         g_signal_connect((gpointer)apptw->Notebook, "switch-page"
                 , G_CALLBACK(on_notebook_page_switch), apptw);
         gtk_widget_grab_focus(apptw->Title_entry);
diff --git a/src/ical-code.c b/src/ical-code.c
index 52b0749..70181bf 100644
--- a/src/ical-code.c
+++ b/src/ical-code.c
@@ -1936,6 +1936,7 @@ static void appt_init(xfical_appt *appt)
     appt->title = NULL;
     appt->location = NULL;
     appt->allDay = FALSE;
+    appt->readonly = FALSE;
     appt->starttime[0] = '\0';
     appt->start_tz_loc = NULL;
     appt->use_due_time = FALSE;
@@ -2310,17 +2311,20 @@ xfical_appt *xfical_appt_get(char *uid)
     file_type[4] = '\0';
     ical_uid = uid+4; /* skip file id */
     if (uid[0] == 'O') {
-        return(appt_get_any(ical_uid, ic_ical, file_type));
+        appt = appt_get_any(ical_uid, ic_ical, file_type);
     }
 #ifdef HAVE_ARCHIVE
     else if (uid[0] == 'A') {
-        return(appt_get_any(ical_uid, ic_aical, file_type));
+        appt = appt_get_any(ical_uid, ic_aical, file_type);
     }
 #endif
     else if (uid[0] == 'F') {
         sscanf(uid, "F%02d", &i);
-        if (i < g_par.foreign_count && ic_f_ical[i].ical != NULL)
-            return(appt_get_any(ical_uid, ic_f_ical[i].ical, file_type));
+        if (i < g_par.foreign_count && ic_f_ical[i].ical != NULL) {
+            appt = appt_get_any(ical_uid, ic_f_ical[i].ical, file_type);
+            if (appt)
+                appt->readonly = g_par.foreign_data[i].read_only;
+        }
         else {
             orage_message(250, P_N "unknown foreign file number %s", uid);
             return(NULL);
diff --git a/src/ical-code.h b/src/ical-code.h
index 3e05f47..c412f9d 100644
--- a/src/ical-code.h
+++ b/src/ical-code.h
@@ -65,6 +65,7 @@ typedef struct _xfical_appt
     gchar *location;
 
     gboolean allDay;
+    gboolean readonly;
 
         /* time format must be:
          * yyyymmdd[Thhmiss[Z]] = %04d%02d%02dT%02d%02d%02d


More information about the Xfce4-commits mailing list