gnome-python-desktop r486 - in trunk: . evolution examples/evolution



Author: jstowers
Date: Thu May  8 12:24:04 2008
New Revision: 486
URL: http://svn.gnome.org/viewvc/gnome-python-desktop?rev=486&view=rev

Log:
2008-05-09  John Stowers  <john stowers gmail com>

	* evolution/ebook.defs:
	* evolution/ecal.defs:
	* evolution/evo-addressbook.c (evo_addressbook_get_uid):
	* evolution/evo-addressbook.h:
	* evolution/evo-calendar.c (evo_cal_source_get_uid):
	* evolution/evo-calendar.h:
	* examples/evolution/evo-test.py: Wrap e_source_peek_uid() as
	ebook.get_uid() and ecalsource.get_uid(). Fixes #519258



Modified:
   trunk/ChangeLog
   trunk/evolution/ebook.defs
   trunk/evolution/ecal.defs
   trunk/evolution/evo-addressbook.c
   trunk/evolution/evo-addressbook.h
   trunk/evolution/evo-calendar.c
   trunk/evolution/evo-calendar.h
   trunk/examples/evolution/evo-test.py

Modified: trunk/evolution/ebook.defs
==============================================================================
--- trunk/evolution/ebook.defs	(original)
+++ trunk/evolution/ebook.defs	Thu May  8 12:24:04 2008
@@ -231,6 +231,14 @@
   )
 )
 
+(define-method get_uid
+  (of-object "EBook")
+  (c-name "evo_addressbook_get_uid")
+  (return-type "char*")
+  (parameters
+  )
+)
+
 (define-method get_contact
   (of-object "EBook")
   (c-name "evo_addressbook_get_contact")

Modified: trunk/evolution/ecal.defs
==============================================================================
--- trunk/evolution/ecal.defs	(original)
+++ trunk/evolution/ecal.defs	Thu May  8 12:24:04 2008
@@ -119,6 +119,13 @@
   )
 )
 
+(define-method get_uid
+  (of-object "ECal")
+  (c-name "evo_cal_source_get_uid")
+  (return-type "char*")
+  (parameters
+  )
+)
 
 ;;------------------------------------------------------------------------------
 ;; ECalComponent

Modified: trunk/evolution/evo-addressbook.c
==============================================================================
--- trunk/evolution/evo-addressbook.c	(original)
+++ trunk/evolution/evo-addressbook.c	Thu May  8 12:24:04 2008
@@ -286,3 +286,17 @@
 	}
     return evo_contact_get_uid(contact);
 }
+
+char *
+evo_addressbook_get_uid(EBook *book)
+{
+    ESource *source = NULL;
+    const char *uid = NULL;
+    
+    source = e_book_get_source(book);
+    if (source)
+        uid = e_source_peek_uid(source);
+        if (uid)
+            return g_strdup(uid);
+    return NULL;
+}

Modified: trunk/evolution/evo-addressbook.h
==============================================================================
--- trunk/evolution/evo-addressbook.h	(original)
+++ trunk/evolution/evo-addressbook.h	Thu May  8 12:24:04 2008
@@ -41,7 +41,7 @@
                                                 EContact    *contact);
 gboolean  evo_addressbook_remove_contact       (EBook       *book,
                                                 EContact    *contact);
-
+char *    evo_addressbook_get_uid              (EBook       *book);
 
 G_END_DECLS
 

Modified: trunk/evolution/evo-calendar.c
==============================================================================
--- trunk/evolution/evo-calendar.c	(original)
+++ trunk/evolution/evo-calendar.c	Thu May  8 12:24:04 2008
@@ -194,6 +194,20 @@
 }
 
 char *
+evo_cal_source_get_uid(ECal *ecal)
+{
+    ESource *source = NULL;
+    const char *uid = NULL;
+    
+    source = e_cal_get_source(ecal);
+    if (source)
+        uid = e_source_peek_uid(source);
+        if (uid)
+            return g_strdup(uid);
+    return NULL;
+}
+
+char *
 evo_cal_component_get_uid(ECalComponent *obj)
 {
     const char *uid = NULL;

Modified: trunk/evolution/evo-calendar.h
==============================================================================
--- trunk/evolution/evo-calendar.h	(original)
+++ trunk/evolution/evo-calendar.h	Thu May  8 12:24:04 2008
@@ -45,6 +45,7 @@
 ECalComponent* evo_cal_source_get_object                 (ECal           *ecal,
                                                           const char     *uid,
                                                           const char     *rid);
+char *         evo_cal_source_get_uid                    (ECal           *ecal);
 char *         evo_cal_component_get_url                 (ECalComponent  *obj);
 void           evo_cal_component_set_url                 (ECalComponent  *obj,
                                                           const char     *url);

Modified: trunk/examples/evolution/evo-test.py
==============================================================================
--- trunk/examples/evolution/evo-test.py	(original)
+++ trunk/examples/evolution/evo-test.py	Thu May  8 12:24:04 2008
@@ -97,40 +97,45 @@
                         combobox.get_active_iter(),
                         URI_IDX)
 
-        print "Opening Addressbook: %s" % uri
-
         self.addressBook = evolution.ebook.open_addressbook(uri)
 
         if self.addressBook != None:
+            print "Opened Addressbook: %s (uid:%s)" % (uri, self.addressBook.get_uid())
             self.addressBookModel.clear()
             for c in self.addressBook.get_all_contacts():
                 self.addressBookModel.append( (c.get_uid(), c.get_name(), c.get_photo(16), c) )
+        else:
+            print "Error Opening Addressbook: %s" % uri
 
     def _open_memo_clicked(self, sender, combobox):
         model = combobox.get_model()
         uri = model.get_value(
                         combobox.get_active_iter(),
                         URI_IDX)
-        print "Opending Memo Source: %s" % uri
 
         self.memoSource = evolution.ecal.open_calendar_source(uri, evolution.ecal.CAL_SOURCE_TYPE_JOURNAL)
         if self.memoSource != None:
+            print "Opened Memo Source: %s (uid:%s)" % (uri, self.memoSource.get_uid())
             self.memoSourceModel.clear()
             for c in self.memoSource.get_all_objects():
                 self.memoSourceModel.append( (c.get_uid(), c.get_summary(), c.get_description(), c) )
+        else:
+            print "Error Opening Memo Source: %s" % uri
 
     def _open_task_clicked(self, sender, combobox):
         model = combobox.get_model()
         uri = model.get_value(
                         combobox.get_active_iter(),
                         URI_IDX)
-        print "Opending Task Source: %s" % uri
 
         self.taskSource = evolution.ecal.open_calendar_source(uri, evolution.ecal.CAL_SOURCE_TYPE_TODO)
         if self.taskSource != None:
+            print "Opened Task Source: %s (uid:%s)" % (uri, self.taskSource.get_uid())
             self.taskSourceModel.clear()
             for c in self.taskSource.get_all_objects():
                 self.taskSourceModel.append( (c.get_uid(), c.get_summary(), c.get_description(), c) )
+        else:
+            print "Error Opening Task Source: %s" % uri
 
     def _populate_combobox(self, sourceList, comboBox):
         #make a combobox with the addressbooks



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]