conduit r1329 - in trunk: . conduit/modules/GmailModule



Author: jstowers
Date: Mon Feb 18 20:30:04 2008
New Revision: 1329
URL: http://svn.gnome.org/viewvc/conduit?rev=1329&view=rev

Log:
2008-02-19  John Stowers  <john stowers gmail com>

	* conduit/modules/GmailModule/GmailModule.py:
	* conduit/modules/GmailModule/config.glade: Add ability to specify your
	own labels when saving emails.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/conduit/modules/GmailModule/GmailModule.py
   trunk/conduit/modules/GmailModule/config.glade

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Mon Feb 18 20:30:04 2008
@@ -1,5 +1,6 @@
 NEW in 0.3.9:
 ==============
+* You can now specify your own labels when saving emails
 
 NEW in 0.3.8:
 ==============

Modified: trunk/conduit/modules/GmailModule/GmailModule.py
==============================================================================
--- trunk/conduit/modules/GmailModule/GmailModule.py	(original)
+++ trunk/conduit/modules/GmailModule/GmailModule.py	Mon Feb 18 20:30:04 2008
@@ -85,14 +85,12 @@
         DataProvider.TwoWay.__init__(self)
 
         #What emails should the source return??
+        self.saveWithLabel = "%s-%s" % (conduit.APPNAME,conduit.APPVERSION)
         self.getAllEmail = False
         self.getUnreadEmail = False
         self.getWithLabel = ""
         self.getInFolder = ""
         self.mails = {}
-
-        #For bookkeeping, always add a conduit label
-        self._label = "%s-%s" % (conduit.APPNAME,conduit.APPVERSION)
         
     def configure(self, window):
         """
@@ -155,6 +153,7 @@
         searchLabelEmailsCb = tree.get_widget("searchLabelEmails")
         searchFolderEmailsCb = tree.get_widget("searchFolderEmails")
         labelEntry = tree.get_widget("labels")
+        saveLabelEntry = tree.get_widget("saveLabel")
         usernameEntry = tree.get_widget("username")
         passwordEntry = tree.get_widget("password")
         
@@ -175,6 +174,7 @@
             folderComboBox.set_sensitive(False)
         usernameEntry.set_text(self.username)
         passwordEntry.set_text(self.password)
+        saveLabelEntry.set_text(self.saveWithLabel)
         
         dlg = tree.get_widget("GmailSourceConfigDialog")
         
@@ -197,6 +197,7 @@
             self.username = usernameEntry.get_text()
             if passwordEntry.get_text() != self.password:
                 self.password = passwordEntry.get_text()
+        self.saveWithLabel = saveLabelEntry.get_text()
         dlg.destroy()
 
     def refresh(self):
@@ -263,12 +264,12 @@
 
         try:
             draftMsg = self.ga.sendMessage(msg, asDraft=True)
-            draftMsg.addLabel(self._label)
+            draftMsg.addLabel(self.saveWithLabel)
         except libgmail.GmailSendError:
             raise Exceptions.SyncronizeError("Error saving message")
         except Exception, err:
             traceback.print_exc()
-            raise Exceptions.SyncronizeError("Error adding label %s to message" % self._label)
+            raise Exceptions.SyncronizeError("Error adding label %s to message" % self.saveWithLabel)
             
         return Rid(uid=draftMsg.id)
 
@@ -282,7 +283,8 @@
                 "getAllEmail" : self.getAllEmail,
                 "getUnreadEmail" : self.getUnreadEmail,
                 "getWithLabel" : self.getWithLabel,
-                "getInFolder" : self.getInFolder})
+                "getInFolder" : self.getInFolder,
+                "saveWithLabel" : self.saveWithLabel})
         return conf
 
 class GmailContactSource(GmailBase, DataProvider.DataSource):

Modified: trunk/conduit/modules/GmailModule/config.glade
==============================================================================
--- trunk/conduit/modules/GmailModule/config.glade	(original)
+++ trunk/conduit/modules/GmailModule/config.glade	Mon Feb 18 20:30:04 2008
@@ -185,23 +185,18 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkCheckButton" id="saveLabelEmails">
+              <widget class="GtkLabel" id="label1">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="label" translatable="yes">Save with label:</property>
-                <property name="use_underline">True</property>
-                <property name="response_id">0</property>
-                <property name="draw_indicator">True</property>
-                <signal name="toggled" handler="on_searchLabelEmails_toggled"/>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Add Label:</property>
               </widget>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
                 <property name="position">13</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkEntry" id="saveLabels">
+              <widget class="GtkEntry" id="saveLabel">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
               </widget>



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