[billreminder] Make use of the new gconf handler.
- From: Og B. Maciel <ogmaciel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [billreminder] Make use of the new gconf handler.
- Date: Thu, 31 Dec 2009 03:20:05 +0000 (UTC)
commit 9edf0ce06d6e734523f0c3e770eb6d665e70af32
Author: Og B. Maciel <ogmaciel gnome org>
Date: Wed Dec 30 22:18:48 2009 -0500
Make use of the new gconf handler.
src/gui/adddialog.py | 15 ++++++++-------
src/gui/maindialog.py | 39 ++++++++++++++++++++-------------------
src/gui/prefdialog.py | 27 ++++++++++++---------------
3 files changed, 40 insertions(+), 41 deletions(-)
---
diff --git a/src/gui/adddialog.py b/src/gui/adddialog.py
index 232e3c7..6499bb7 100644
--- a/src/gui/adddialog.py
+++ b/src/gui/adddialog.py
@@ -20,7 +20,8 @@ from lib import i18n
from gui.widgets.datebutton import DateButton
from gui.widgets.datepicker import DatePicker
from gui.categoriesdialog import CategoriesDialog
-from lib.config import Configuration
+#from lib.config import Configuration
+from lib.Settings import Settings as Configuration
class AddDialog(object):
"""
@@ -28,7 +29,7 @@ class AddDialog(object):
"""
def __init__(self, title=None, parent=None, record=None, selectedDate=None):
self.ui = gtk.Builder()
- self.ui.add_from_file(os.path.join(DEFAULT_CFG_PATH, "add_bill.ui"))
+ self.ui.add_from_file(os.path.join(common.DEFAULT_CFG_PATH, "add_bill.ui"))
self.window = self.ui.get_object("add_bill_dialog")
@@ -122,9 +123,9 @@ class AddDialog(object):
self.dueDate.set_date(self.selectedDate)
self.endDate.set_date(self.selectedDate)
# Use alarm values from preferences
- showalarm = self.gconf_client.show_alarm()
- atime = self.gconf_client.show_alarm_at_time()
- adays = self.gconf_client.show_alarm_before_days()
+ showalarm = self.gconf_client.get('show_alarm')
+ atime = self.gconf_client.get('show_alarm_at_time')
+ adays = self.gconf_client.get('show_alarm_before_days')
if showalarm:
alarmDate = scheduler.get_alarm_timestamp(adays, atime, self.selectedDate)
@@ -423,7 +424,7 @@ class AddDialog(object):
def __get_alarm_date(self, date):
# Use alarm values from preferences
- atime = self.gconf_client.show_alarm_at_time()
- adays = self.gconf_client.show_alarm_before_days()
+ atime = self.gconf_client.get('show_alarm_at_time')
+ adays = self.gconf_client.get('show_alarm_before_days')
return scheduler.get_alarm_timestamp(adays, atime, date)
diff --git a/src/gui/maindialog.py b/src/gui/maindialog.py
index 223920a..1d71aa9 100644
--- a/src/gui/maindialog.py
+++ b/src/gui/maindialog.py
@@ -26,7 +26,8 @@ from lib.actions import Actions
from lib import common
from lib import dialogs
from lib import scheduler
-from lib.config import Configuration
+#from lib.config import Configuration
+from lib.Settings import Settings as Configuration
from lib.utils import Message
from lib.utils import get_dbus_interface
from lib.utils import force_string
@@ -88,10 +89,10 @@ class MainDialog:
self.ui.get_object("chart_box").add(self.chart)
# Restore position and size of window
- width = self.gconf_client.get_window_width()
- height = self.gconf_client.get_window_height()
- x = self.gconf_client.get_window_x()
- y = self.gconf_client.get_window_y()
+ width = self.gconf_client.get('window_width')
+ height = self.gconf_client.get('window_height')
+ x = self.gconf_client.get('window_position_x')
+ y = self.gconf_client.get('window_position_y')
if width and height:
self.window.resize(width, height)
if x and y:
@@ -103,7 +104,7 @@ class MainDialog:
self.on_showToolbar_toggled(self.ui.get_object("showToolbar"))
self.list.grab_focus()
- if self.gconf_client.start_in_tray():
+ if self.gconf_client.get('start_in_tray'):
self.window.hide()
self.toggle_buttons()
@@ -202,7 +203,7 @@ class MainDialog:
def reloadTreeView(self, *arg):
# Update list with updated record
- status = self.gconf_client.show_paid_bills()
+ status = self.gconf_client.get('show_paid_bills')
#month = self.timeline.value.month
#year = self.timeline.value.year
@@ -265,10 +266,10 @@ class MainDialog:
def _populate_menubar(self):
try:
- saved_view = self.gconf_client.show_paid_bills()
+ saved_view = self.gconf_client.get('show_paid_bills')
except:
saved_view = 1
- self.gconf_client.set_int(GCONF_GUI_PATH + "show_paid_bills", saved_view)
+ self.gconf_client.set("show_paid_bills", saved_view)
if saved_view == 0:
self.ui.get_object("showNotPaid").set_active(True)
@@ -278,7 +279,7 @@ class MainDialog:
self.ui.get_object("showAll").set_active(True)
# Check whether we display the toolbar or not
- self.ui.get_object("showToolbar").set_active(self.gconf_client.show_toolbar())
+ self.ui.get_object("showToolbar").set_active(self.gconf_client.get('show_toolbar'))
def add_bill(self):
@@ -351,18 +352,18 @@ class MainDialog:
def save_position(self):
x, y = self.window.get_position()
- self.gconf_client.set_int(GCONF_GUI_PATH + 'x', x)
- self.gconf_client.set_int(GCONF_GUI_PATH + 'y', y)
+ self.gconf_client.set('window_position_x', x)
+ self.gconf_client.set('window_position_y', y)
def save_size(self):
width, height = self.window.get_size()
- self.gconf_client.set_int(GCONF_GUI_PATH + 'width', width)
- self.gconf_client.set_int(GCONF_GUI_PATH + 'height', height)
+ self.gconf_client.set('window_width', width)
+ self.gconf_client.set('window_height', height)
def toggle_buttons(self, paid=None):
""" Toggles all buttons conform number of records present and
their state """
-
+
for widget in ["editBill", "removeBill", "markPaid", "markNotPaid"]:
self.ui.get_object(widget).set_sensitive(len(self.list.listStore) > 0)
@@ -450,10 +451,10 @@ class MainDialog:
def switch_view(self, view_number):
- self.gconf_client.set_int(GCONF_GUI_PATH + 'show_paid_bills', view_number)
+ self.gconf_client.set('show_paid_bills', view_number)
self.reloadTreeView()
self.reloadTimeline()
-
+
def on_showNotPaid_toggled(self, action):
if action.get_active():
self.switch_view(0)
@@ -473,7 +474,7 @@ class MainDialog:
else:
self.toolbar.hide_all()
- self.gconf_client.set_bool(GCONF_GUI_PATH + "show_toolbar", action.get_active())
+ self.gconf_client.set("show_toolbar", action.get_active())
def reloadTimeline(self, *args):
self._bullet_cache = {}
@@ -487,7 +488,7 @@ class MainDialog:
self._bullet_cache[date] = self.actions.get_bills(dueDate=date)
if self._bullet_cache[date]:
- status = self.gconf_client.show_paid_bills()
+ status = self.gconf_client.get('show_paid_bills')
amount = 0
tooltip = ''
bullet = Bullet()
diff --git a/src/gui/prefdialog.py b/src/gui/prefdialog.py
index 5742319..cd21849 100644
--- a/src/gui/prefdialog.py
+++ b/src/gui/prefdialog.py
@@ -16,7 +16,7 @@ from lib import common
from lib import utils
from lib import i18n
from widgets.timewidget import TimeWidget
-from lib.common import GCONF_PATH, GCONF_GUI_PATH, GCONF_ALARM_PATH
+from lib.Settings import Settings
class PrefDialog(gtk.Dialog):
"""
@@ -35,7 +35,7 @@ class PrefDialog(gtk.Dialog):
self.props.skip_taskbar_hint = True
- self.gconf_client = gconf.client_get_default()
+ self.gconf_client = Settings()
self._initialize_dialog_widgets()
self._populate_fields()
@@ -180,24 +180,21 @@ class PrefDialog(gtk.Dialog):
def _populate_fields(self):
- self.notifyCheckbox.set_active( \
- self.gconf_client.get_bool(GCONF_ALARM_PATH + 'show_before_alarm'))
- self.alertCheckbox.set_active( \
- self.gconf_client.get_bool(GCONF_ALARM_PATH + 'show_alarm'))
+ self.notifyCheckbox.set_active(self.gconf_client.get('show_before_alarm'))
+ self.alertCheckbox.set_active(self.gconf_client.get('show_alarm'))
- if not self.gconf_client.get_bool(GCONF_ALARM_PATH + 'use_alert_dialog'):
+ if not self.gconf_client.get('use_alert_dialog'):
self.alertBubble.set_active(True)
else:
self.alertDialog.set_active(True)
# Number of days before showing alarm
- adays = self.gconf_client.get_int(GCONF_ALARM_PATH + 'notification_days_limit')
+ adays = self.gconf_client.get('notification_days_limit')
self.notifySpinButton.set_value(adays and adays or 3)
- self.alertSpinButton.set_value(self.gconf_client.get_int(GCONF_ALARM_PATH + 'show_alarm_before_days'))
+ self.alertSpinButton.set_value(self.gconf_client.get('show_alarm_before_days'))
- atime = self.gconf_client.get_string(GCONF_ALARM_PATH + 'show_alarm_at_time')
- # Don't crash if running uninstalled and no gconf data
- atime = atime and atime.split(":") or ['13', '00']
+ atime = self.gconf_client.get('show_alarm_at_time')
+ atime = atime.split(":")
self.notificationTime.setHourMinute(atime[0], atime[1])
@@ -220,13 +217,13 @@ class PrefDialog(gtk.Dialog):
def _on_time_changed(self, spin):
alarm = self.notificationTime.getTime()
alarm = ":".join(["%.02d" % x for x in alarm])
- self.gconf_client.set_string(GCONF_ALARM_PATH + 'show_alarm_at_time', alarm)
+ self.gconf_client.set('show_alarm_at_time', alarm)
def _on_checkbox_toggled(self, togglebutton, item):
- self.gconf_client.set_bool(GCONF_ALARM_PATH + item, togglebutton.get_active())
+ self.gconf_client.set(item, togglebutton.get_active())
def _on_spin_changed(self, obj, item):
- self.gconf_client.set_int(GCONF_ALARM_PATH + item, int(obj.get_value()))
+ self.gconf_client.set(item, int(obj.get_value()))
def _launch_daemon(self, button):
Popen('billreminderd', shell=True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]