Skip to content

Commit

Permalink
about dialog, doc skel
Browse files Browse the repository at this point in the history
& dont touch, it works !

git-svn-id: file:///comboy/svn/onim/trunk@18 ddd93275-964d-42a2-867a-75629c878e58
  • Loading branch information
comboy committed Dec 22, 2008
1 parent 1fc6711 commit 37f442f
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 21 deletions.
Binary file added doc/onim.odt
Binary file not shown.
Binary file added gui/about.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions gui/about.glade
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Mon Dec 22 17:34:50 2008 -->
<glade-interface>
<widget class="GtkWindow" id="window_about">
<property name="width_request">400</property>
<property name="height_request">200</property>
<property name="title" translatable="yes">ONIM - o nim :)</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<child>
<widget class="GtkFixed" id="fixed1">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="width_request">240</property>
<property name="height_request">84</property>
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;span size="xx-large"&gt;&lt;b&gt;ONIM&lt;/b&gt;&lt;/span&gt;
One Night Instant Mess&lt;span color="gray"&gt;enger&lt;/span&gt;

Autor: &lt;i&gt;Kacper Cieśla&lt;/i&gt;</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
</widget>
<packing>
<property name="x">160</property>
<property name="y">23</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button_ok">
<property name="width_request">136</property>
<property name="height_request">32</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="yes">Podoba mi się</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="x">206</property>
<property name="y">134</property>
</packing>
</child>
<child>
<widget class="GtkImage" id="image_about">
<property name="width_request">153</property>
<property name="height_request">159</property>
<property name="visible">True</property>
<property name="pixbuf">about.gif</property>
</widget>
<packing>
<property name="x">7</property>
<property name="y">21</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
7 changes: 2 additions & 5 deletions lib/onim/base.rb
Expand Up @@ -10,8 +10,6 @@ def initialize
@roster = Roster.new
@engine = Engine.new self
@gui = Gui.new self
# @gui.show_error "ueonth"
# @account = Gui::Account.new self

Thread.new do
@engine.connect
Expand All @@ -30,9 +28,8 @@ def roster_items=(items)

def message_received(jid,text)
puts "base: message received"
# XXX like this it's not possible for gui to tell which resorce sent it
strip_jid jid
@gui.message_received jid, text
# XXX like this it's not possible for gui to tell which resorce sent it
@gui.message_received strip_jid(jid), text
end

def send_message(jid,text)
Expand Down
38 changes: 24 additions & 14 deletions lib/onim/gui.rb
Expand Up @@ -46,6 +46,7 @@ def initialize(base)
}

@glade['menuitem_account'].signal_connect('activate') { Gui::Account.new @base }
@glade['menuitem_about'].signal_connect('activate') { show_about }


# Load status select
Expand Down Expand Up @@ -79,7 +80,12 @@ def show_error(text)
dialog.run
dialog.destroy
end



def show_about
About.new self
end

def show_account_configuration
bla = Account.new @base
puts "done #{bla}"
Expand Down Expand Up @@ -120,16 +126,27 @@ def item_update(item)
def set_roster_items(items)
@contacts_rows = {}

contacts_model = Gtk::TreeStore.new(Hash,Gdk::Pixbuf,String,Gdk::Color,String,Gdk::Pixbuf,String)
@contacts_model = Gtk::TreeStore.new(Hash,Gdk::Pixbuf,String,Gdk::Color,String,Gdk::Pixbuf,String)
#items = [{:name => 'ueoau', :jid => 'ueoueo'},{:name => 'ueoa', :jid => 'euooeu'}]
@groups_rows = {}
items.each do |item|
item.group = 'dupa' unless item.group
if item.group
add_item_to_roster(item)

end

@contacts_model.set_sort_column_id(6)
@contacts.model = @contacts_model

@contacts.expand_all
end

def add_item_to_roster(item)
if item.group
if @groups_rows[item.group]
parent = @groups_rows[item.group]
else
parent = contacts_model.append nil
else
parent = @contacts_model.append nil
parent.set_value(0,nil)
parent.set_value(1,nil)
parent.set_value(2,item.group)
Expand All @@ -143,18 +160,11 @@ def set_roster_items(items)
else
parent = nil
end
x = contacts_model.append parent

x = @contacts_model.append parent
@contacts_rows[item.jid] = x
fill_model_values_for_item item, x


end

contacts_model.set_sort_column_id(6)
@contacts.model = contacts_model

@contacts.expand_all
end

def debug(text)
Expand Down
18 changes: 18 additions & 0 deletions lib/onim/gui/about.rb
@@ -0,0 +1,18 @@
module Onim
class Gui
# About window
class About
# Show window and load garfield image :]
def initialize(gui)
@gui = gui
@glade = GladeXML.new(Onim::PATH+'gui/about.glade', nil, 'window_about')
@window = @glade['window_about']
@glade['button_ok'].signal_connect('clicked') { @window.hide }
@window.modify_bg(Gtk::STATE_NORMAL,Gdk::Color.new(255*255, 255*255, 255*255))
@image = @glade['image_about']
@image.pixbuf = Gdk::Pixbuf.new(File.join(Onim::PATH,"gui","images","about.gif"))
@window.show
end
end
end
end
2 changes: 2 additions & 0 deletions lib/onim/gui/account.rb
@@ -1,5 +1,7 @@
module Onim
class Gui

# Account configuration window
class Account
attr_accessor :base

Expand Down
7 changes: 5 additions & 2 deletions lib/onim/gui/message.rb
Expand Up @@ -13,6 +13,9 @@ def initialize(gui,contact)

def add_message(text,name=nil)
debug "add message"
puts "WWWTHUNHEOUTSN"
puts @glade['scrolledwindow1'].hadjustment.value
puts @glade['scrolledwindow1'].hadjustment.upper
@talk.buffer.insert @talk.buffer.end_iter,"#{name || @contact.name}: ", @nickname_tag
@talk.buffer.insert @talk.buffer.end_iter, "#{text}\n"
end
Expand Down Expand Up @@ -47,8 +50,8 @@ def create_window
if @contact.has_image?
@glade['image_avatar'].pixbuf = Gdk::Pixbuf.new(@contact.image_file)
end
@desc = @glade['textview_description']
@desc.buffer.text = "<b>#{@contact.name}</b>\n\n#{@contact.status}"
@desc = @glade['label_description']
@desc.markup = "<b>#{@contact.name}</b>\n\n#{@contact.status}"
@nickname_tag = @talk.buffer.create_tag('nickname', 'weight' => Pango::FontDescription::WEIGHT_BOLD)
@bla_tag = @input.buffer.create_tag('nickname', 'weight' => Pango::FontDescription::WEIGHT_BOLD)
@input.buffer.insert @input.buffer.end_iter,"eooeu",@bla_tag
Expand Down

0 comments on commit 37f442f

Please sign in to comment.