~macaco-dev/macaco/trunk

« back to all changes in this revision

Viewing changes to harmony/WebpageDialog.py

  • Committer: Manuel de la Pena
  • Date: 2009-11-29 19:08:43 UTC
  • Revision ID: mandel@themacaque.com-20091129190843-8lhfztis84gve221
Removed enum dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: utf-8 -*-
2
2
### BEGIN LICENSE
3
 
# This file is in the public domain
 
3
# Copyright (C) 2009 Manuel de la Pena <mandel@themacaque.com>
 
4
#This program is free software: you can redistribute it and/or modify it 
 
5
#under the terms of the GNU General Public License version 3, as published 
 
6
#by the Free Software Foundation.
 
7
#
 
8
#This program is distributed in the hope that it will be useful, but 
 
9
#WITHOUT ANY WARRANTY; without even the implied warranties of 
 
10
#MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
 
11
#PURPOSE.  See the GNU General Public License for more details.
 
12
#
 
13
#You should have received a copy of the GNU General Public License along 
 
14
#with this program.  If not, see <http://www.gnu.org/licenses/>.
4
15
### END LICENSE
5
16
 
6
17
import sys
8
19
import gtk
9
20
 
10
21
from harmony.harmonyconfig import getdatapath
11
 
from desktopcouch.contacts import Url
 
22
from desktopcouch.contacts import Url, URL_DESCRIPTIONS, HOME_PAGE_URL, BLOG_URL
12
23
from icons import get_url_icon
13
24
    
14
25
class WebpageDialog(gtk.Dialog):
47
58
        self.__type_box.pack_start(logo_cell, False)
48
59
        self.__type_box.add_attribute(logo_cell, 'pixbuf', 1)
49
60
        # we add the different columns to the combobox
50
 
        self.__type_store.append(["Home Page", get_url_icon(Url.Description.HomePage), 
51
 
            Url.Description.HomePage.index])
52
 
        self.__type_store.append(["Blog", get_url_icon(Url.Description.Blog), 
53
 
            Url.Description.Blog.index])
 
61
        self.__type_store.append(["Home Page", get_url_icon(HOME_PAGE_URL), 0])
 
62
        self.__type_store.append(["Blog", get_url_icon(BLOG_URL), 1])
54
63
        # set the default type
55
64
        self.__type_box.set_active_iter(self.__type_store.get_iter_first())
56
65
 
76
85
        self.object.url = self.__url_entry.get_text()
77
86
        item = self.__type_box.get_active_iter()
78
87
        index = self.__type_store.get_value(item, 2)
79
 
        self.object.description = Url.Description[index]
 
88
        self.object.description = URL_DESCRIPTIONS[index]
80
89
        self.destroy()
81
90
 
82
91
    def cancel(self, widget, data=None):