Author: juha
Date: 2008-03-04 23:09:40 +0000 (Tue, 04 Mar 2008)
New Revision: 26663

Modified:
   xfcalendar/trunk/configure.in.in
   xfcalendar/trunk/src/functions.c
   xfcalendar/trunk/src/ical-code.c
   xfcalendar/trunk/src/mainbox.c
Log:
 Fixes to mainwindow handling
 4.5.13.4


Modified: xfcalendar/trunk/configure.in.in
===================================================================
--- xfcalendar/trunk/configure.in.in    2008-03-04 17:01:09 UTC (rev 26662)
+++ xfcalendar/trunk/configure.in.in    2008-03-04 23:09:40 UTC (rev 26663)
@@ -9,7 +9,7 @@
 dnl
 
 dnl Version information
-m4_define([orage_version], [4.5.13.3-svn])
+m4_define([orage_version], [4.5.13.4-svn])
 
 m4_define([gtk_minimum_version], [2.6.0])
 m4_define([xfce_minimum_version], [4.4.0])

Modified: xfcalendar/trunk/src/functions.c
===================================================================
--- xfcalendar/trunk/src/functions.c    2008-03-04 17:01:09 UTC (rev 26662)
+++ xfcalendar/trunk/src/functions.c    2008-03-04 23:09:40 UTC (rev 26663)
@@ -475,9 +475,17 @@
 void orage_select_date(GtkCalendar *cal
     , guint year, guint month, guint day)
 {
-    gtk_calendar_select_day(cal, 0); /* needed to avoid illegal day/month */
-    gtk_calendar_select_month(cal, month, year);
-    gtk_calendar_select_day(cal, day);
+    guint cur_year, cur_month, cur_mday;
+
+    gtk_calendar_get_date(cal, &cur_year, &cur_month, &cur_mday);
+
+    if (cur_year == year && cur_month == month)
+        gtk_calendar_select_day(cal, day);
+    else {
+        gtk_calendar_select_day(cal, 0); /* needed to avoid illegal day/month 
*/
+        gtk_calendar_select_month(cal, month, year);
+        gtk_calendar_select_day(cal, day);
+    }
 }
 
 void orage_select_today(GtkCalendar *cal)

Modified: xfcalendar/trunk/src/ical-code.c
===================================================================
--- xfcalendar/trunk/src/ical-code.c    2008-03-04 17:01:09 UTC (rev 26662)
+++ xfcalendar/trunk/src/ical-code.c    2008-03-04 23:09:40 UTC (rev 26663)
@@ -3040,7 +3040,7 @@
     /* order list */
     g_par.alarm_list = g_list_sort(g_par.alarm_list, alarm_order);
     setup_orage_alarm_clock(); /* keep reminders upto date */
-    build_mainbox_info();      /* refresh main calendar window todo list */
+    build_mainbox_info();      /* refresh main calendar window lists */
     /* moved to reminder in setup_orage_alarm_clock
     store_persistent_alarms(); / * keep track of alarms when orage is down * /
     */

Modified: xfcalendar/trunk/src/mainbox.c
===================================================================
--- xfcalendar/trunk/src/mainbox.c      2008-03-04 17:01:09 UTC (rev 26662)
+++ xfcalendar/trunk/src/mainbox.c      2008-03-04 23:09:40 UTC (rev 26663)
@@ -210,26 +210,6 @@
         create_el_win(NULL);
 }
 
-void orage_show_events_for_selected_date(void)
-{
-    /* rebuild the info for the selected date */
-    if (!xfical_file_open(TRUE))
-        return;
-    build_mainbox_info();
-    xfical_file_close(TRUE);   
-}
-
-static void mCalendar_day_selected_cb(GtkCalendar *calendar
-        , gpointer user_data)
-{
-#undef P_N
-#define P_N "mCalendar_day_selected_cb: "
-#ifdef ORAGE_DEBUG
-    orage_message(-100, P_N);
-#endif
-    orage_show_events_for_selected_date();
-}
-
 static gboolean upd_calendar(GtkCalendar *calendar)
 {
 #undef P_N
@@ -485,7 +465,7 @@
     xfical_appt_free(appt);
 }
 
-void create_mainbox_todo_info(void)
+static void create_mainbox_todo_info(void)
 {
 #undef P_N
 #define P_N "create_mainbox_todo_info: "
@@ -513,7 +493,7 @@
             GTK_SCROLLED_WINDOW(cal->mTodo_scrolledWin), cal->mTodo_rows_vbox);
 }
 
-void create_mainbox_event_info(void)
+static void create_mainbox_event_info(void)
 {
 #undef P_N
 #define P_N "create_mainbox_event_info: "
@@ -546,29 +526,22 @@
             GTK_SCROLLED_WINDOW(cal->mEvent_scrolledWin), 
cal->mEvent_rows_vbox);
 }
 
-/**********************************************************************
- * This routine is called from ical-code xfical_alarm_build_list_internal
- * and ical files are already open at that time. So make sure ical files
- * are opened before and closed after this call.
- **********************************************************************/
-void build_mainbox_info(void)
+static void build_mainbox_todo_info(void)
 {
 #undef P_N
-#define P_N "build_mainbox_info: "
+#define P_N "build_mainbox_todo_info: "
     CalWin *cal = g_par.xfcal;
     char      *s_time;
     char      a_day[9];  /* yyyymmdd */
-    struct tm *t, tt;
+    struct tm *t;
     xfical_type ical_type;
     gchar file_type[8];
     gint i;
     GList *todo_list=NULL;
-    GList *event_list=NULL;
 
 #ifdef ORAGE_DEBUG
     orage_message(-100, P_N);
 #endif
-
     if (g_par.show_todos) {
         t = orage_localtime();
         s_time = orage_tm_time_to_icaltime(t);
@@ -585,9 +558,42 @@
             insert_rows(&todo_list, a_day, ical_type, file_type);
         }
     }
+    if (todo_list) {
+        gtk_widget_destroy(cal->mTodo_vbox);
+        create_mainbox_todo_info();
+        todo_list = g_list_sort(todo_list, list_order);
+        g_list_foreach(todo_list, (GFunc)info_process
+                , cal->mTodo_rows_vbox);
+        g_list_free(todo_list);
+        todo_list = NULL;
+        gtk_widget_show_all(cal->mTodo_vbox);
+    }
+    else {
+        gtk_widget_hide_all(cal->mTodo_vbox);
+    }
+}
+
+static void build_mainbox_event_info(void)
+{
+#undef P_N
+#define P_N "build_mainbox_event_info: "
+    CalWin *cal = g_par.xfcal;
+    char      *s_time;
+    char      a_day[9];  /* yyyymmdd */
+    struct tm tt= {0,0,0,0,0,0,0,0,0};
+    xfical_type ical_type;
+    gchar file_type[8];
+    gint i;
+    GList *event_list=NULL;
+
+#ifdef ORAGE_DEBUG
+    orage_message(-100, P_N);
+#endif
     if (g_par.show_events) {
         gtk_calendar_get_date(GTK_CALENDAR(cal->mCalendar)
-                , &(tt.tm_year), &(tt.tm_mon), &(tt.tm_mday));
+                , (unsigned int *)&tt.tm_year
+                , (unsigned int *)&tt.tm_mon
+                , (unsigned int *)&tt.tm_mday);
         tt.tm_year -= 1900;
         s_time = orage_tm_time_to_icaltime(&tt);
         strncpy(a_day, s_time, 8);
@@ -601,19 +607,6 @@
             insert_rows(&event_list, a_day, ical_type, file_type);
         }
     }
-    if (todo_list) {
-        gtk_widget_destroy(cal->mTodo_vbox);
-        create_mainbox_todo_info();
-        todo_list = g_list_sort(todo_list, list_order);
-        g_list_foreach(todo_list, (GFunc)info_process
-                , cal->mTodo_rows_vbox);
-        g_list_free(todo_list);
-        todo_list = NULL;
-        gtk_widget_show_all(cal->mTodo_vbox);
-    }
-    else {
-        gtk_widget_hide_all(cal->mTodo_vbox);
-    }
     if (event_list) {
         gtk_widget_destroy(cal->mEvent_vbox);
         create_mainbox_event_info();
@@ -629,6 +622,39 @@
     }
 }
 
+static void mCalendar_day_selected_cb(GtkCalendar *calendar
+        , gpointer user_data)
+{
+#undef P_N
+#define P_N "mCalendar_day_selected_cb: "
+#ifdef ORAGE_DEBUG
+    orage_message(-100, P_N);
+#endif
+    /* rebuild the info for the selected date */
+    if (!xfical_file_open(TRUE))
+        return;
+    build_mainbox_event_info();
+    xfical_file_close(TRUE);   
+}
+
+/**********************************************************************
+ * This routine is called from ical-code xfical_alarm_build_list_internal
+ * and ical files are already open at that time. So make sure ical files
+ * are opened before and closed after this call.
+ **********************************************************************/
+void build_mainbox_info(void)
+{
+#undef P_N
+#define P_N "build_mainbox_info: "
+
+#ifdef ORAGE_DEBUG
+    orage_message(-100, P_N);
+#endif
+
+    build_mainbox_todo_info();
+    build_mainbox_event_info();
+}
+
 void build_mainWin()
 {
 #undef P_N

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to