Commit c61efaa2 authored by Philipp Hörist's avatar Philipp Hörist

Replace deprecated Gdk.Cursor.new()

parent 6de3120d
......@@ -664,11 +664,11 @@ class ChatControl(ChatControlBase):
"""
Just moved the mouse so show the cursor
"""
cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)
cursor = gtkgui_helpers.get_cursor('LEFT_PTR')
self.parent_win.window.get_window().set_cursor(cursor)
def on_location_eventbox_enter_notify_event(self, widget, event):
cursor = Gdk.Cursor.new(Gdk.CursorType.HAND2)
cursor = gtkgui_helpers.get_cursor('HAND2')
self.parent_win.window.get_window().set_cursor(cursor)
def _on_window_motion_notify(self, widget, event):
......
......@@ -701,7 +701,7 @@ class ConversationTextview(GObject.GObject):
iter_ = iter_[1]
tags = iter_.get_tags()
if self.change_cursor:
w.set_cursor(Gdk.Cursor.new(Gdk.CursorType.XTERM))
w.set_cursor(gtkgui_helpers.get_cursor('XTERM'))
self.change_cursor = False
tag_table = self.tv.get_buffer().get_tag_table()
xep0184_warning = False
......@@ -709,7 +709,7 @@ class ConversationTextview(GObject.GObject):
for tag in tags:
if tag in (tag_table.lookup('url'), tag_table.lookup('mail'), \
tag_table.lookup('xmpp'), tag_table.lookup('sth_at_sth')):
w.set_cursor(Gdk.Cursor.new(Gdk.CursorType.HAND2))
w.set_cursor(gtkgui_helpers.get_cursor('HAND2'))
self.change_cursor = True
elif tag == tag_table.lookup('xep0184-warning'):
xep0184_warning = True
......@@ -723,7 +723,7 @@ class ConversationTextview(GObject.GObject):
if xep0184_warning and not self.xep0184_warning_tooltip.win:
self.xep0184_warning_tooltip.timeout = GLib.timeout_add(500,
self.show_xep0184_warning_tooltip)
w.set_cursor(Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR))
w.set_cursor(gtkgui_helpers.get_cursor('LEFT_PTR'))
self.change_cursor = True
def clear(self, tv = None):
......
......@@ -5723,5 +5723,5 @@ class BigAvatarWindow(Gtk.Window):
"""
Just moved the mouse so show the cursor
"""
cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR)
cursor = gtkgui_helpers.get_cursor('LEFT_PTR')
self.get_window().set_cursor(cursor)
......@@ -494,6 +494,11 @@ def get_invisible_cursor():
cursor_pixbuf, 0, 0)
return cursor
def get_cursor(attr):
display = Gdk.Display.get_default()
cursor = getattr(Gdk.CursorType, attr)
return Gdk.Cursor.new_for_display(display, cursor)
def get_current_desktop(window):
"""
Return the current virtual desktop for given window
......
......@@ -52,6 +52,7 @@ if __name__ == '__main__':
import common.configpaths
common.configpaths.gajimpaths.init(None)
from common import gajim
import gtkgui_helpers
from gtkgui_helpers import get_icon_pixmap
from common import helpers
from common.exceptions import GajimGeneralException
......@@ -896,18 +897,18 @@ class HtmlTextView(Gtk.TextView):
text = text[:47] + '…'
tooltip.set_text(text)
if not self._changed_cursor:
window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.HAND2))
window.set_cursor(gtkgui_helpers.get_cursor('HAND2'))
self._changed_cursor = True
return True
if self._changed_cursor:
window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.XTERM))
window.set_cursor(gtkgui_helpers.get_cursor('XTERM'))
self._changed_cursor = False
return False
def __leave_event(self, widget, event):
if self._changed_cursor:
window = widget.get_window(Gtk.TextWindowType.TEXT)
window.set_cursor(Gdk.Cursor.new(Gdk.CursorType.XTERM))
window.set_cursor(gtkgui_helpers.get_cursor('XTERM'))
self._changed_cursor = False
def on_open_link_activate(self, widget, kind, text):
......@@ -1125,13 +1126,13 @@ if __name__ == '__main__':
y = pointer[2]
tags = htmlview.tv.get_iter_at_location(x, y).get_tags()
if change_cursor:
w.set_cursor(Gdk.Cursor.new(Gdk.CursorType.XTERM))
w.set_cursor(gtkgui_helpers.get_cursor('XTERM'))
change_cursor = None
tag_table = htmlview.tv.get_buffer().get_tag_table()
for tag in tags:
try:
if tag.is_anchor:
w.set_cursor(Gdk.Cursor.new(Gdk.CursorType.HAND2))
w.set_cursor(gtkgui_helpers.get_cursor('HAND2'))
change_cursor = tag
elif tag == tag_table.lookup('focus-out-line'):
over_line = True
......@@ -1146,7 +1147,7 @@ if __name__ == '__main__':
# line_tooltip.timeout = GLib.timeout_add(500,
# show_line_tooltip)
# htmlview.tv.get_window(Gtk.TextWindowType.TEXT).set_cursor(
# Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR))
# gtkgui_helpers.get_cursor('LEFT_PTR'))
# change_cursor = tag
htmlview.tv.connect('motion_notify_event', on_textview_motion_notify_event)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment