From b23b2eac9abce667b39d0306735d8bef9a9604a9 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Fri, 10 Jun 2005 20:06:01 +0000 Subject: [PATCH] commiting GC mockup and supporting code both by Dennis Craven --- src/chat.py | 26 ++ src/groupchat_window.py | 46 ++-- src/gtkgui.glade | 544 ++++++++++++++++++++++++++------------ src/roster_window.py | 2 + src/tabbed_chat_window.py | 14 - 5 files changed, 431 insertions(+), 201 deletions(-) diff --git a/src/chat.py b/src/chat.py index 71ce0d853..da4baa9ef 100644 --- a/src/chat.py +++ b/src/chat.py @@ -791,3 +791,29 @@ class Chat: self.sent_history_pos[jid] = self.sent_history_pos[jid] + 1 conv_buf.set_text(self.sent_history[jid][self.sent_history_pos[jid]]) + + def repaint_colored_widgets(self): + """Repaint widgets (banner) in the window/tab with theme color""" + # get the bg color of the bar from the current theme colors + bgcolor = gajim.config.get('accountbgcolor') + + # iterate through tabs/windows and repaint + for jid in self.xmls: + if self.widget_name == 'tabbed_chat_window': + banner_status_eventbox = self.xmls[jid].get_widget( + 'banner_status_eventbox') + banner_status_eventbox.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.color_parse(bgcolor)) + banner_name_eventbox = self.xmls[jid].get_widget( + 'banner_name_eventbox') + banner_name_eventbox.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.color_parse(bgcolor)) + banner_avatar_eventbox = self.xmls[jid].get_widget( + 'banner_avatar_eventbox') + banner_avatar_eventbox.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.color_parse(bgcolor)) + elif self.widget_name == 'groupchat_window': + banner_name_eventbox = self.xmls[jid].get_widget( + 'banner_name_eventbox') + banner_name_eventbox.modify_bg(gtk.STATE_NORMAL, + gtk.gdk.color_parse(bgcolor)) diff --git a/src/groupchat_window.py b/src/groupchat_window.py index 5233a9ef8..9f412bf7e 100644 --- a/src/groupchat_window.py +++ b/src/groupchat_window.py @@ -44,8 +44,8 @@ class Groupchat_window(chat.Chat): self.nicks = {} self.list_treeview = {} self.subjects = {} - self.subject_entry = {} - self.subject_entry_tooltip = {} + self.name_labels = {} +# self.subject_entry_tooltip = {} self.room_creation = {} self.nick_hits = {} self.last_key_tabs = {} @@ -122,9 +122,9 @@ class Groupchat_window(chat.Chat): new_jid = jid break subject = self.subjects[new_jid] - subject_entry = self.subject_entry[new_jid] - subject_entry.set_text(subject) - self.subject_entry_tooltip[new_jid].set_tip(subject_entry, subject) + name_label = self.name_labels[new_jid] + name_label.set_markup('%s\n%s' % (new_jid, subject)) +# self.subject_entry_tooltip[new_jid].set_tip(subject_entry, subject) chat.Chat.on_chat_notebook_switch_page(self, notebook, page, page_num) def get_role_iter(self, room_jid, role): @@ -280,13 +280,15 @@ class Groupchat_window(chat.Chat): def set_subject(self, room_jid, subject): self.subjects[room_jid] = subject - subject_entry = self.subject_entry[room_jid] - subject_entry.set_text(subject) - self.subject_entry_tooltip[room_jid].set_tip(subject_entry, subject) + name_label = self.name_labels[room_jid] + name_label.set_markup('%s\n%s' % (room_jid, subject)) + #self.subject_entry_tooltip[room_jid].set_tip(subject_entry, subject) def on_change_subject_menuitem_activate(self, widget): room_jid = self.get_active_jid() - subject = self.subject_entry[room_jid].get_text() + # I don't know how this works with markup... Let's find out! + label_text = self.name_labels[room_jid].get_text() # whole text (including JID) + subject = label_text[label_text.find('\n') + 1:] # just the text after the newline *shrug* instance = dialogs.Input_dialog('Changing the Subject', 'Please specify the new subject:', subject) response = instance.dialog.run() @@ -302,11 +304,11 @@ class Groupchat_window(chat.Chat): def on_add_bookmark_menuitem_activate(self, widget): room_jid = self.get_active_jid() bm = { 'name':"", - 'jid':self.get_active_jid(), - 'autojoin':"1", - 'password':"", - 'nick':self.nicks[self.get_active_jid()] - } + 'jid':self.get_active_jid(), + 'autojoin':"1", + 'password':"", + 'nick':self.nicks[self.get_active_jid()] + } for bookmark in gajim.connections[self.account].bookmarks: if bookmark['jid'] == bm['jid']: @@ -608,6 +610,7 @@ class Groupchat_window(chat.Chat): del self.nicks[room_jid] del self.list_treeview[room_jid] del self.subjects[room_jid] + del self.name_labels[room_jid] def new_room(self, room_jid, nick): self.names[room_jid] = room_jid.split('@')[0] @@ -623,9 +626,18 @@ class Groupchat_window(chat.Chat): 'list_treeview') conversation_textview = self.xmls[room_jid].get_widget( 'conversation_textview') - self.subject_entry[room_jid] = self.xmls[room_jid].get_widget( - 'subject_entry') - self.subject_entry_tooltip[room_jid] = gtk.Tooltips() + self.name_labels[room_jid] = self.xmls[room_jid].get_widget( + 'banner_name_label') + # set the fg colour of the label to white + self.name_labels[room_jid].modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('white')) + + banner_eventbox = self.xmls[room_jid].get_widget( + 'banner_name_eventbox') + # get the background color from the current theme + bgcolor = gajim.config.get('accountbgcolor') + banner_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor)) + +# self.subject_entry_tooltip[room_jid] = gtk.Tooltips() #status_image, nickname, real_jid, show store = gtk.TreeStore(gtk.Image, str, str, str) diff --git a/src/gtkgui.glade b/src/gtkgui.glade index 21e5de651..afc4c6d8a 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -8150,131 +8150,16 @@ Custom + 1 True False 6 - - - True - - - - True - _Actions - True - - - - - - - True - Click to change the subject of the room - Change _Subject - True - - - - - True - gtk-edit - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Click to configure the room options - Configure _Room - True - - - - - True - gtk-preferences - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Add _Bookmark - True - - - - - True - gtk-add - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - - - - - - True - Close _Window - True - - - - - True - gtk-close - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - - - 0 - False - False - - - True False - False + True GTK_POS_TOP True True @@ -8287,6 +8172,36 @@ Custom False 0 + + + + 3 + False + True + + + True @@ -8300,59 +8215,6 @@ Custom False 6 - - - True - False - 6 - - - - True - Subject: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - True - False - True - 0 - - True - * - False - - - 0 - True - True - - - - - 0 - False - True - - - True @@ -8370,6 +8232,7 @@ Custom + 3 True True False @@ -8410,6 +8273,7 @@ Custom + 3 True True True @@ -8459,6 +8323,7 @@ Custom + 3 True True False @@ -8485,6 +8350,342 @@ Custom True + + + + 2 + True + False + 0 + + + + True + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_ICONS + True + True + + + + True + True + True + True + + + False + False + + + + + + True + Bold + gtk-bold + True + True + False + False + + + False + True + + + + + + True + Italics + gtk-italic + True + True + False + False + + + False + True + + + + + + True + Underline + gtk-underline + True + True + False + False + + + False + True + + + + + 0 + True + True + + + + + + True + False + 2 + + + + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-preferences + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Actions + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + + + + + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-justify-fill + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _History + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + + + + + True + + + 2 + False + True + + + + + + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-jump-to + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Send + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + + + + 0 + False + True + + + + + 0 + False + True + + False @@ -9684,6 +9885,7 @@ JID: whatever@jabber.org True + Bold gtk-bold True True @@ -9699,6 +9901,7 @@ JID: whatever@jabber.org True + Italics gtk-italic True True @@ -9714,6 +9917,7 @@ JID: whatever@jabber.org True + Underine gtk-underline True True diff --git a/src/roster_window.py b/src/roster_window.py index 928434b80..8e3661244 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -1348,6 +1348,8 @@ class Roster_window: # Update opened chat windows/tabs for jid in self.plugin.windows[account]['chats']: self.plugin.windows[account]['chats'][jid].repaint_colored_widgets() + for jid in self.plugin.windows[account]['gc']: + self.plugin.windows[account]['gc'][jid].repaint_colored_widgets() def on_show_offline_contacts_menuitem_activate(self, widget): '''when show offline option is changed: diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index c22840766..dbc768c59 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -181,20 +181,6 @@ class Tabbed_chat_window(chat.Chat): banner_status_image.set_from_pixbuf(scaled_pix) status_image.set_from_pixbuf(pix) - def repaint_colored_widgets(self): - """Repaint widgets (banner) in the window/tab with theme color""" - # get the bg color of the bar from the current theme colors - bgcolor = gajim.config.get('accountbgcolor') - - # iterate through tabs/windows and repaint - for jid in self.xmls: - banner_status_eventbox = self.xmls[jid].get_widget('banner_status_eventbox') - banner_status_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor)) - banner_name_eventbox = self.xmls[jid].get_widget('banner_name_eventbox') - banner_name_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor)) - banner_avatar_eventbox = self.xmls[jid].get_widget('banner_avatar_eventbox') - banner_avatar_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor)) - def on_tabbed_chat_window_delete_event(self, widget, event): """close window""" for jid in self.users: