Philipp Hörist pushed to branch gtk4 at gajim / gajim


Commits:
99145ce2 by Philipp Hörist at 2024-10-05T09:40:38+02:00
refacotr: Fix some things

- - - - -


3 changed files:

- gajim/data/gui/ssl_error_dialog.ui
- gajim/gtk/avatar.py
- gajim/gtk/start_chat.py


Changes:

=====================================
gajim/data/gui/ssl_error_dialog.ui
=====================================
@@ -2,7 +2,6 @@
 <interface>
   <requires lib="gtk" version="4.0"/>
   <object class="GtkBox" id="ssl_error_box">
-    <property name="border_width">18</property>
     <property name="orientation">vertical</property>
     <property name="spacing">6</property>
     <child>
@@ -43,7 +42,6 @@
         <property name="visible">0</property>
         <property name="label" translatable="1">Add this certificate to the 
list of _trusted certificates</property>
         <property name="focusable">1</property>
-        <property name="no_show_all">True</property>
         <property name="halign">start</property>
         <property name="margin_start">15</property>
         <property name="margin_end">15</property>


=====================================
gajim/gtk/avatar.py
=====================================
@@ -617,24 +617,23 @@ def surface_from_filename(self,
         if pixbuf is None:
             return None
 
-        return None # TODO GTK4
-
         if pixbuf.get_n_channels() == 3:
             cairo_format = cairo.Format.RGB24
         else:
             cairo_format = cairo.Format.ARGB32
 
-        width = pixbuf.get_width()
-        height = pixbuf.get_height()
-
-        surface = cairo.ImageSurface.create_for_data(
-            memoryview(pixbuf.get_pixels()),
+        surface = cairo.ImageSurface(
             cairo_format,
-            width,
-            height
+            pixbuf.get_width(),
+            pixbuf.get_height()
         )
 
-        return fit(surface, size)
+        context = cairo.Context(surface)
+
+        Gdk.cairo_set_source_pixbuf(context, pixbuf, 0, 0)
+        context.paint()
+
+        return fit(context.get_target(), size)
 
     def _get_avatar_from_storage(self,
                                  contact: (types.BareContact |


=====================================
gajim/gtk/start_chat.py
=====================================
@@ -564,12 +564,12 @@ def _on_search_changed(self, search_entry: 
Gtk.SearchEntry) -> None:
 
     def _show_search_entry_error(self, state: bool):
         icon_name = 'dialog-warning-symbolic' if state else None
-        self._ui.search_entry.set_icon_from_icon_name(
-            Gtk.EntryIconPosition.SECONDARY,
-            icon_name)
-        self._ui.search_entry.set_icon_tooltip_text(
-            Gtk.EntryIconPosition.SECONDARY,
-            _('Invalid Address'))
+        # self._ui.search_entry.set_icon_from_icon_name( TODO GTK4
+        #     Gtk.EntryIconPosition.SECONDARY,
+        #     icon_name)
+        # self._ui.search_entry.set_icon_tooltip_text(
+        #     Gtk.EntryIconPosition.SECONDARY,
+        #     _('Invalid Address'))
 
     def _update_new_contact_rows(self, search_text: str) -> None:
         for row in self.new_contact_rows.values():



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/99145ce24c408f0e1024ace72dd4ce89dfb64873

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/99145ce24c408f0e1024ace72dd4ce89dfb64873
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to