class Mylist::MyListHolder
Attributes
caller[R]
child_placement[RW]
gantt[R]
info[R]
list[RW]
list_id[RW]
list_panel[RW]
list_scroller[RW]
notebook[RW]
parentM[R]
widget[R]
Public Class Methods
new(caller)
click to toggle source
Calls superclass method
# File lib/ListHolder.rb, line 38 def initialize(caller) @caller=caller @list_id=nil @parentM=nil @single_mode_child=nil @info=Gtk::Label.new('initializing') @list=MyEditableList.new(self) @list.signal_connect('size-allocate'){|me,alloc| me.columns.each{|col| list_panel.list_filter.columns[col.data].set_width_request(col.width) unless list_panel.list_filter.columns[col.data].nil? || list_panel.list_filter.columns[col.data].destroyed? list_panel.list_sum.renderers[col.data].set_width_request(col.width) unless list_panel.list_sum.renderers[col.data].nil? || list_panel.list_sum.renderers[col.data].destroyed? } } @flistbox=Gtk::VBox.new(false).pack_start(@list_scroller=Gtk::ScrolledWindow.new.add(@list),true,true,0) @list_scroller.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_ALWAYS) @list_panel=ListPanel.new(self) @flistbox.pack_end(Gtk::HBox.new.pack_start(list_panel).pack_end(@placeholder_button=Gtk::Button.new.set_relief(Gtk::ReliefStyle::NONE),false,false),false,true,0) placeholder_button.set_no_show_all(true) @list_scroller.vscrollbar.signal_connect("size-allocate",placeholder_button){|me,alloc,pl| pl.set_width_request(alloc.width) } @buttonholder=ListButtonHolder.new(self,Gtk::ORIENTATION_HORIZONTAL) @placeholder_button. signal_connect('clicked'){|me| menuw=Gtk::Window.new(Gtk::Window::POPUP).add(bar=Gtk::VBox.new. add(refresh=Gtk::Button.new.set_image(Gtk::Image.new(Gtk::Stock::REFRESH,Gtk::IconSize::MENU))). add(history=Gtk::Button.new.set_image(Gtk::Image.new(Gtk::Stock::INDEX,Gtk::IconSize::MENU))). add(cancel=Gtk::Button.new.set_image(Gtk::Image.new(Gtk::Stock::CANCEL,Gtk::IconSize::MENU))) ) refresh.set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw,self){|button,menuw,me| ManqodDB.instance.manqod_db.reload_moditem(me.list.list_id) menuw.hide unless menuw.destroyed? } history.set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw,self){|button,menuw,me| history_window menuw.hide unless menuw.destroyed? } cancel.set_relief(Gtk::ReliefStyle::NONE).signal_connect('clicked',menuw,self){|button,menuw,me| menuw.hide } menuw.set_modal(true).set_window_position(Gtk::Window::POS_MOUSE).show_all =begin #disabled per current compiz is generating the leave notify event in the wrong order =end menuw.signal_connect('leave-notify-event'){|me,e| # me.destroy if e.window == me.window me.hide if e.window == me.window } } super() set_shadow_type(Gtk::SHADOW_NONE) signal_connect('destroy'){|me| @notebook.wipe unless @notebook.nil? @list.wipe unless @list.nil? || @list.destroyed? unless @listbox.nil? list_panel.destroy unless list_panel.destroyed? @flistbox.destroy unless @flistbox.destroyed? @listbox.destroy unless @listbox.destroyed? @buttonholder.holder.destroy unless @buttonholder.holder.destroyed? @list_panel.destroy unless @list_panel.destroyed? end @info.destroy unless @info.destroyed? } end
Public Instance Methods
advanced_filter()
click to toggle source
# File lib/ListHolder.rb, line 220 def advanced_filter @buttonholder.advanced_filter end
child1()
click to toggle source
# File lib/ListHolder.rb, line 238 def child1 @widget.child1 end
child2()
click to toggle source
# File lib/ListHolder.rb, line 241 def child2 @widget.child2 end
embedd?()
click to toggle source
# File lib/ListHolder.rb, line 110 def embedd? @list.embedd? end
history_window()
click to toggle source
# File lib/ListHolder.rb, line 205 def history_window HistoryWindow.new(self) end
pack1(widget_to_pack)
click to toggle source
# File lib/ListHolder.rb, line 229 def pack1(widget_to_pack) @widget.pack1(widget_to_pack,true,true) end
pack2(widget_to_pack)
click to toggle source
# File lib/ListHolder.rb, line 232 def pack2(widget_to_pack) @widget.pack2(widget_to_pack,true,true) end
pack_child(child_id)
click to toggle source
# File lib/ListHolder.rb, line 189 def pack_child(child_id) remove(@widget) @single_mode_child=Mylist::MyListHolder.new(self) @single_mode_child.set_parentM(list) @single_mode_child.list.set_back_button(true).set_id(child_id) @single_mode_child.update(self) add(@single_mode_child) end
position()
click to toggle source
# File lib/ListHolder.rb, line 235 def position @widget.position end
progress()
click to toggle source
# File lib/ListHolder.rb, line 217 def progress SB.instance.progress end
repack_self()
click to toggle source
# File lib/ListHolder.rb, line 199 def repack_self remove(@single_mode_child) @single_mode_child.destroy unless @single_mode_child.nil? || @single_mode_child.destroyed? add(@widget) end
repack_widget()
click to toggle source
# File lib/ListHolder.rb, line 186 def repack_widget end
set_id(new_list_id)
click to toggle source
# File lib/ListHolder.rb, line 209 def set_id(new_list_id) @list_id=new_list_id end
set_parentM(parentM)
click to toggle source
# File lib/ListHolder.rb, line 212 def set_parentM(parentM) @parentM=parentM list.set_parentM(parentM) end
set_position(pos)
click to toggle source
# File lib/ListHolder.rb, line 247 def set_position(pos) @widget.set_position(pos) end
set_position_set(set_pos)
click to toggle source
# File lib/ListHolder.rb, line 244 def set_position_set(set_pos) @widget.set_position_set(set_pos) end
title()
click to toggle source
# File lib/ListHolder.rb, line 250 def title @list.title || 'none' end
to_s()
click to toggle source
# File lib/ListHolder.rb, line 254 def to_s "Holder of #{@list}" end
update(notifier)
click to toggle source
# File lib/ListHolder.rb, line 114 def update(notifier) case notifier.class.name when 'BarMenuItem', 'ButtonMenuItem', 'MyRendererButton' list.set_id(@list_id=notifier.target) when 'MyEditableList', 'Mylist::MyListHolder' list.set_id(@list_id) #preserve the last id else edebug("unknown routing: #{notifier.class.name}","list","warning") end @child_placement=list.gtk_attribute('child_placement') || 'bottom' @button_placement=list.gtk_attribute('button_placement') || 'bottom' @gantt_start=list.gtk_attribute('gantt_start') @gantt_duration=list.gtk_attribute('gantt_duration') @listbox.remove(@flistbox).remove(@buttonholder.holder) unless @listbox.nil? @gantt.destroy unless @gantt.nil? @gantt=nil unless @widget.nil? @widget.remove(child1) unless child1.nil? @widget.remove(child2) unless child2.nil? @widget.destroy end @buttonholder.set_orientation((@button_placement == 'right' ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL)) @widget=if @child_placement == 'right' then HHolder.new(self) else VHolder.new(self) end @listbox=if @button_placement == 'right' then Gtk::HBox.new else Gtk::VBox.new end @listbox.pack_start(@flistbox,true,true,0).pack_start(@buttonholder.holder,false,false,0) if @gantt_start.nil? gantt_box=@listbox else gantt_box=Gtk::HPaned.new.add1(@listbox).add2(@gantt=GanttHolder.new(self)) if gpos=get_conf(@list.get_id,0,"gantt_position") gantt_box.set_position(gpos.to_i).set_position_set(true) end gantt_box.signal_connect("size-allocate"){|me,alloc| set_conf(@list.get_id,0,"gantt_position",me.position) } end @widget.pack1(gantt_box,true,true) @widget.signal_connect("size_allocate"){|me,alloc| set_conf(@list.get_id,0,"position",me.position) unless me.position == 0 } add(@widget) #children @submodules=list.list_model.drbmodel.childs.size if @submodules>0 && !list.single_list_mode @notebook=MyNotebook.new(self) @notebook.show_all pack2(@notebook) if (position=get_conf(list_id,0,"position")||0) !=0 widget.set_position(position.to_i) widget.set_position_set(true) end else @notebook.wipe if @notebook @notebook=nil @widget.remove(child2) unless child2.nil? end show_all list_panel.set_visibility @notebook.update(@list) if @submodules>0 && !list.single_list_mode @list.load_data(notifier) @gantt.update unless @gantt.nil? end