GTK3: make sure clipboard opens correctly. Still crashes on use.

svn: r20070
This commit is contained in:
Benny Malengier 2012-07-24 19:34:28 +00:00
parent 768278d6a7
commit 8d29bb62e4
2 changed files with 49 additions and 33 deletions

View File

@ -36,8 +36,9 @@ from time import strftime as strftime
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
from gi.repository import Gtk
from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import GdkPixbuf
#-------------------------------------------------------------------------
@ -874,7 +875,7 @@ class ClipDropHandleList(ClipDropList):
class ClipboardListModel(Gtk.ListStore):
def __init__(self):
GObject.GObject.__init__(self,
Gtk.ListStore.__init__(self,
str, # 0: object type
object, # 1: object
object, # 2: tooltip callback
@ -892,7 +893,8 @@ class ClipboardListModel(Gtk.ListStore):
#-------------------------------------------------------------------------
class ClipboardListView(object):
LOCAL_DRAG_TARGET = ('MY_TREE_MODEL_ROW', Gtk.TargetFlags.SAME_WIDGET, 0)
LOCAL_DRAG_TARGET = Gtk.TargetEntry.new('MY_TREE_MODEL_ROW',
Gtk.TargetFlags.SAME_WIDGET, 0)
LOCAL_DRAG_TYPE = 'MY_TREE_MODEL_ROW'
def __init__(self, dbstate, widget):
@ -933,7 +935,7 @@ class ClipboardListView(object):
self._col4_cell = Gtk.CellRendererText()
# Add cells to view
self._col1.pack_start(self._col1_cellpb, False, True, 0)
self._col1.pack_start(self._col1_cellpb, False)
self._col1.pack_start(self._col1_cell, True)
self._col2.pack_start(self._col2_cell, True)
self._col3.pack_start(self._col3_cell, True)
@ -950,9 +952,9 @@ class ClipboardListView(object):
self._widget.set_enable_search(True)
#self._widget.set_search_column(3)
self._widget.drag_dest_set(Gtk.DestDefaults.ALL,
(ClipboardListView.LOCAL_DRAG_TARGET,) + \
DdTargets.all_targets(),
targ_data = (ClipboardListView.LOCAL_DRAG_TARGET,) + \
DdTargets.all_targets()
self._widget.drag_dest_set(Gtk.DestDefaults.ALL, targ_data,
Gdk.DragAction.COPY)
self._widget.connect('drag_data_get', self.object_drag_data_get)

View File

@ -1,48 +1,34 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual -->
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="clipboard">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Clipboard</property>
<property name="default_width">500</property>
<property name="default_height">300</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow86">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="objectlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="helpbutton1">
<property name="label">gtk-help</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_clicked"/>
<signal name="clicked" handler="on_help_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -53,10 +39,12 @@
<child>
<object class="GtkButton" id="btn_clear_all">
<property name="label" translatable="yes">Clear _All</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
</object>
<packing>
@ -68,12 +56,14 @@
<child>
<object class="GtkButton" id="btn_clear">
<property name="label">gtk-clear</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_clear_clicked"/>
<signal name="clicked" handler="on_clear_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -84,12 +74,14 @@
<child>
<object class="GtkButton" id="btn_close">
<property name="label">gtk-close</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_close_clipboard"/>
<signal name="clicked" handler="on_close_clipboard" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -100,10 +92,32 @@
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow86">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkTreeView" id="objectlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<action-widgets>