[shotwell/wip/gtk4: 87/88] Bring back slideshow transitions




commit f0b9141a26da5ea5632fa35da2d74bf574748d3f
Author: Jens Georg <mail jensge org>
Date:   Sat Apr 23 10:27:36 2022 +0200

    Bring back slideshow transitions

 meson.build                                        |  4 +-
 plugins/common/BuilderPane.vala                    |  6 +--
 plugins/common/RESTSupport.vala                    |  6 +--
 plugins/meson.build                                | 16 +++----
 plugins/shotwell-transitions/meson.build           |  2 +-
 .../org.gnome.Shotwell.Transitions.gresource.xml   |  2 +-
 .../shotwell-transitions/shotwell-transitions.vala |  9 +---
 src/Resources.vala                                 |  1 +
 src/plugins/ManifestWidget.vala                    | 52 +++++++++-------------
 9 files changed, 41 insertions(+), 57 deletions(-)
---
diff --git a/meson.build b/meson.build
index 58f5dd85..9455ca7e 100644
--- a/meson.build
+++ b/meson.build
@@ -3,6 +3,8 @@ project('shotwell', ['vala', 'c'],
         meson_version : '>= 0.43.0',
         default_options : ['buildtype=debugoptimized'])
 
+so_version = '0.33'
+
 gnome = import('gnome')
 i18n = import('i18n')
 
@@ -114,7 +116,7 @@ posix = valac.find_library('posix')
 
 subdir('data')
 subdir('src')
-#subdir('plugins')
+subdir('plugins')
 subdir('po')
 subdir('help')
 subdir('thumbnailer')
diff --git a/plugins/common/BuilderPane.vala b/plugins/common/BuilderPane.vala
index 72b4b6fa..d7456072 100644
--- a/plugins/common/BuilderPane.vala
+++ b/plugins/common/BuilderPane.vala
@@ -11,7 +11,6 @@ namespace Shotwell.Plugins.Common {
             get; construct; default = DialogPane.GeometryOptions.NONE;
         }
         public string resource_path { owned get; construct; }
-        public bool connect_signals { get; construct; default = false; }
         public string default_id {
             owned get; construct; default = "default";
         }
@@ -25,15 +24,12 @@ namespace Shotwell.Plugins.Common {
             debug ("Adding new builder from path %s", resource_path);
 
             this.builder = new Gtk.Builder.from_resource (resource_path);
-            if (this.connect_signals) {
-                this.builder.connect_signals (null);
-            }
 
             this.content = this.builder.get_object ("content") as Gtk.Widget;
 
             // Just to be sure, if we still use old-style Builder files
             if (this.content.parent != null) {
-                this.content.parent.remove (this.content);
+                this.content.unparent();
             }
         }
 
diff --git a/plugins/common/RESTSupport.vala b/plugins/common/RESTSupport.vala
index cb050189..c3a354c3 100644
--- a/plugins/common/RESTSupport.vala
+++ b/plugins/common/RESTSupport.vala
@@ -203,9 +203,9 @@ public class Transaction {
 
     private void on_wrote_body_data(Soup.Buffer written_data) {
         bytes_written += (int) written_data.length;
-        while (Gtk.events_pending()) {
-            Gtk.main_iteration();
-        }
+        //TODO: NEEDS TO GO
+        while (MainContext.default().pending())
+            MainContext.default().iteration(true);
         chunk_transmitted(bytes_written, (int) message.request_body.length);
     }
 
diff --git a/plugins/meson.build b/plugins/meson.build
index c1a1962e..5ec3cd3e 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -3,11 +3,11 @@
 sw_plugin_common = library('shotwell-plugin-common',
                           ['common/RESTSupport.vala',
                            'common/Resources.vala',
-                           'common/WebAuthenticationPane.vala',
+#                           'common/WebAuthenticationPane.vala',
                            'common/BuilderPane.vala',
                            'common/OAuth1Support.vala'],
-                          version: meson.project_version(),
-                          dependencies : [gtk, gee, webkit, soup, xml, sw_plugin],
+                          version: so_version,
+                          dependencies : [gtk, gee, soup, xml, sw_plugin],
                           vala_header : 'shotwell-plugin-common.h',
                           vala_vapi : 'shotwell-plugin-common.vapi',
                           include_directories : config_incdir,
@@ -16,9 +16,9 @@ sw_plugin_common = library('shotwell-plugin-common',
 sw_plugin_common_dep = declare_dependency(include_directories : include_directories('.'),
                                           link_with : sw_plugin_common)
 
-subdir('authenticator')
-subdir('shotwell-publishing')
-if get_option('extra_plugins')
-  subdir('shotwell-publishing-extras')
-endif
+#subdir('authenticator')
+#subdir('shotwell-publishing')
+#if get_option('extra_plugins')
+#  subdir('shotwell-publishing-extras')
+#endif
 subdir('shotwell-transitions')
diff --git a/plugins/shotwell-transitions/meson.build b/plugins/shotwell-transitions/meson.build
index e016f361..69f30627 100644
--- a/plugins/shotwell-transitions/meson.build
+++ b/plugins/shotwell-transitions/meson.build
@@ -20,7 +20,7 @@ libm = cc.find_library('m', required : false)
 shared_module('shotwell-transitions',
               shotwell_transitions_sources + shotwell_transitions_resources,
               dependencies : [gio, gdk_pixbuf, cairo, gtk, xml, sw_plugin,
-                              sw_plugin_common_dep, gee, soup, webkit, libm],
+                              sw_plugin_common_dep, gee, soup, libm],
               vala_args : [
                   '--gresources', 'org.gnome.Shotwell.Transitions.gresource.xml',
                   ],
diff --git a/plugins/shotwell-transitions/org.gnome.Shotwell.Transitions.gresource.xml 
b/plugins/shotwell-transitions/org.gnome.Shotwell.Transitions.gresource.xml
index 75456831..94376f85 100644
--- a/plugins/shotwell-transitions/org.gnome.Shotwell.Transitions.gresource.xml
+++ b/plugins/shotwell-transitions/org.gnome.Shotwell.Transitions.gresource.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/Shotwell/Transitions">
-    <file>slideshow-plugin.png</file>
+    <file alias="icons/slideshow-plugin.png">slideshow-plugin.png</file>
   </gresource>
 </gresources>
diff --git a/plugins/shotwell-transitions/shotwell-transitions.vala 
b/plugins/shotwell-transitions/shotwell-transitions.vala
index 6f2ccb99..84acbff0 100644
--- a/plugins/shotwell-transitions/shotwell-transitions.vala
+++ b/plugins/shotwell-transitions/shotwell-transitions.vala
@@ -52,14 +52,7 @@ public Spit.Module? spit_entry_point(Spit.EntryPointParams *params) {
 
 // Base class for all transition descriptors in this module
 public abstract class ShotwellTransitionDescriptor : Object, Spit.Pluggable, Spit.Transitions.Descriptor {
-    private const string ICON_FILENAME = "slideshow-plugin.png";
-
-    private static Gdk.Pixbuf[] icon_pixbuf_set = null;
-    
     protected ShotwellTransitionDescriptor(GLib.File resource_directory) {
-        if (icon_pixbuf_set == null)
-            icon_pixbuf_set =
-                Resources.load_from_resource(Resources.RESOURCE_PATH + "/" + ICON_FILENAME);
     }
 
     public int get_pluggable_interface(int min_host_interface, int max_host_interface) {
@@ -80,7 +73,7 @@ public abstract class ShotwellTransitionDescriptor : Object, Spit.Pluggable, Spi
         info.website_url = Resources.WEBSITE_URL;
         info.is_license_wordwrapped = false;
         info.license = Resources.LICENSE;
-        info.icons = icon_pixbuf_set;
+        info.icon = "slideshow-plugin";
     }
     
     public void activation(bool enabled) {
diff --git a/src/Resources.vala b/src/Resources.vala
index ff1f60b3..c5c009b9 100644
--- a/src/Resources.vala
+++ b/src/Resources.vala
@@ -1007,6 +1007,7 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
         Gtk.IconTheme icon_theme = Gtk.IconTheme.get_for_display(Gdk.Display.get_default());
         icon_theme.add_resource_path("/org/gnome/Shotwell/icons");
         icon_theme.add_resource_path("/org/gnome/Shotwell/icons/hicolor");
+        icon_theme.add_resource_path("/org/gnome/Shotwell/Transitions/icons");
     }
     
     // Get the directory where our help files live.  Returns a string
diff --git a/src/plugins/ManifestWidget.vala b/src/plugins/ManifestWidget.vala
index fdf8333e..68dc5e8d 100644
--- a/src/plugins/ManifestWidget.vala
+++ b/src/plugins/ManifestWidget.vala
@@ -58,25 +58,20 @@ public class ManifestWidgetMediator : Gtk.Box {
             }
         }
         
-        Gtk.AboutDialog about_dialog = new Gtk.AboutDialog();
-        about_dialog.authors = authors;
-        about_dialog.comments = info.brief_description;
-        about_dialog.copyright = info.copyright;
-        about_dialog.license = info.license;
-        about_dialog.wrap_license = info.is_license_wordwrapped;
-        #if 0
-        about_dialog.logo = (info.icons != null && info.icons.length > 0) ? info.icons[0] :
-            Resources.get_icon(Resources.ICON_GENERIC_PLUGIN);
-            #endif
-        about_dialog.program_name = get_pluggable_name(id);
-        about_dialog.translator_credits = info.translators;
-        about_dialog.version = info.version;
-        about_dialog.website = info.website_url;
-        about_dialog.website_label = info.website_name;
-        about_dialog.set_modal (true);
-        
-        // TODO about_dialog.run();
-        Gtk.show_about_dialog(about_dialog);
+        Gtk.show_about_dialog((Gtk.Window)this.get_native(),
+            "version", info.version,
+            "authors", authors,
+            "comments", info.brief_description,
+            "copyright", info.copyright,
+            "wrap-license", info.is_license_wordwrapped,
+            "program-name", get_pluggable_name(id),
+            "translator-credits", info.translators,
+            "version", info.version,
+            "website", info.website_url,
+            "website-label", info.website_name,
+            "logo-icon-name", info.icon,
+            null
+        );
     }
     
     private void on_selection_changed() {
@@ -110,7 +105,7 @@ private class ManifestListView : Gtk.TreeView {
     private Gtk.TreeStore store = new Gtk.TreeStore(Column.N_COLUMNS,
         typeof(bool),       // ENABLED
         typeof(bool),       // CAN_ENABLE
-        typeof(Gdk.Paintable), // ICON
+        typeof(string), // ICON
         typeof(string),     // NAME
         typeof(string)      // ID
     );
@@ -136,7 +131,7 @@ private class ManifestListView : Gtk.TreeView {
         
         column.add_attribute(checkbox_renderer, "active", Column.ENABLED);
         column.add_attribute(checkbox_renderer, "visible", Column.CAN_ENABLE);
-        column.add_attribute(icon_renderer, "pixbuf", Column.ICON);
+        column.add_attribute(icon_renderer, "icon-name", Column.ICON);
         column.add_attribute(text_renderer, "text", Column.NAME);
         
         append_column(column);
@@ -157,14 +152,10 @@ private class ManifestListView : Gtk.TreeView {
             Gtk.TreeIter category_iter;
             store.append(out category_iter, null);
             
-            Gdk.Paintable? icon = null;
-            if (extension_point.icon_name != null) {
-                icon = icon_theme.lookup_by_gicon(
-                    new ThemedIcon(extension_point.icon_name), ICON_SIZE, 1, Gtk.TextDirection.NONE, 0);
-            }
-            
             store.set(category_iter, Column.NAME, extension_point.name, Column.CAN_ENABLE, false,
-                Column.ICON, icon);
+                Column.ICON, extension_point.icon_name);
+
+            print ("%s\n", extension_point.icon_name);
             
             Gee.Collection<Spit.Pluggable> pluggables = get_pluggables_for_type(
                 extension_point.pluggable_type, compare_pluggable_names, true);
@@ -180,8 +171,9 @@ private class ManifestListView : Gtk.TreeView {
                 store.append(out plugin_iter, category_iter);
                 
                 store.set(plugin_iter, Column.ENABLED, enabled, Column.NAME, pluggable.get_pluggable_name(),
-                    Column.ID, pluggable.get_id(), Column.CAN_ENABLE, true, Column.ICON, icon);
-            }
+                    Column.ID, pluggable.get_id(), Column.CAN_ENABLE, true, Column.ICON, info.icon);
+                    print ("%s\n", info.icon);
+                }
         }
         
         expand_all();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]