Guest User

Untitled

a guest
May 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 3.21 KB | None | 0 0
  1. === modified file 'lib/Items/ApplicationDockItem.vala'
  2. --- lib/Items/ApplicationDockItem.vala  2011-12-22 19:37:38 +0000
  3. +++ lib/Items/ApplicationDockItem.vala  2011-12-31 08:24:22 +0000
  4. @@ -302,7 +302,7 @@
  5.                        
  6.                         var pbuf = WindowControl.get_window_icon (window);
  7.                         if (pbuf == null)
  8. -                           DrawingService.load_icon (Icon, width, height);
  9. +                           pbuf = DrawingService.load_icon (Icon, width, height);
  10.                         else
  11.                             pbuf = DrawingService.ar_scale (pbuf, width, height);
  12.                        
  13. @@ -327,6 +327,7 @@
  14.             string icon, text;
  15.             parse_launcher (Prefs.Launcher, out icon, out text, shortcuts, shortcut_map);
  16.             Icon = icon;
  17. +           ForcePixbuf = null;
  18.             Text = text;
  19.            
  20.             start_monitor ();
  21.  
  22. === modified file 'lib/Items/DockItem.vala'
  23. --- lib/Items/DockItem.vala 2011-12-22 19:37:38 +0000
  24. +++ lib/Items/DockItem.vala 2011-12-31 08:42:03 +0000
  25. @@ -159,6 +159,8 @@
  26.          */
  27.         public string Icon { get; set; default = ""; }
  28.        
  29. +       protected Pixbuf? ForcePixbuf { get; set; default = null; }
  30. +      
  31.         /**
  32.          * The dock item's text.
  33.          */
  34. @@ -274,6 +276,7 @@
  35.             Prefs.deleted.connect (handle_deleted);
  36.             Gtk.IconTheme.get_default ().changed.connect (reset_icon_buffer);
  37.             Prefs.changed["Icon"].connect (reset_icon_buffer);
  38. +           Prefs.changed["ForcePixbuf"].connect (reset_icon_buffer);
  39.         }
  40.        
  41.         ~DockItem ()
  42. @@ -281,6 +284,7 @@
  43.             Prefs.deleted.disconnect (handle_deleted);
  44.             Gtk.IconTheme.get_default ().changed.disconnect (reset_icon_buffer);
  45.             Prefs.changed["Icon"].disconnect (reset_icon_buffer);
  46. +           Prefs.changed["ForcePixbuf"].disconnect (reset_icon_buffer);
  47.         }
  48.        
  49.         /**
  50. @@ -319,6 +323,8 @@
  51.         {
  52.             if (this.surface == null || surface.Width != this.surface.Width || surface.Height != this.surface.Height) {
  53.                 this.surface = new DockSurface.with_dock_surface (surface.Width, surface.Height, surface);
  54. +               if (ForcePixbuf != null)
  55. +                   ForcePixbuf = DrawingService.ar_scale (ForcePixbuf, surface.Width, surface.Height);
  56.                 draw_icon (this.surface);
  57.                
  58.                 AverageIconColor = this.surface.average_color ();
  59. @@ -333,8 +339,11 @@
  60.          */
  61.         protected virtual void draw_icon (DockSurface surface)
  62.         {
  63. -           var pbuf = DrawingService.load_icon (Icon, surface.Width, surface.Height);
  64. -           return_if_fail(pbuf != null);
  65. +           Pixbuf? pbuf = ForcePixbuf;
  66. +           if (pbuf == null) {
  67. +               pbuf = DrawingService.load_icon (Icon, surface.Width, surface.Height);
  68. +               return_if_fail(pbuf != null);
  69. +           }
  70.             cairo_set_source_pixbuf (surface.Context, pbuf, 0, 0);
  71.             surface.Context.paint ();
  72.         }
  73.  
  74. === modified file 'lib/Items/TransientDockItem.vala'
  75. --- lib/Items/TransientDockItem.vala    2011-09-06 09:09:44 +0000
  76. +++ lib/Items/TransientDockItem.vala    2011-12-31 08:41:09 +0000
  77. @@ -19,6 +19,7 @@
  78.  using Gtk;
  79.  
  80.  using Plank.Drawing;
  81. +using Plank.Services.Windows;
  82.  
  83.  namespace Plank.Items
  84.  {
  85. @@ -32,6 +33,9 @@
  86.             var launcher = app.get_desktop_file ();
  87.             if (launcher == "") {
  88.                 Text = app.get_name ();
  89. +               var windows = WindowControl.get_windows (app);
  90. +               for (var i = 0; i < windows.size && ForcePixbuf == null; i++)
  91. +                   ForcePixbuf = WindowControl.get_window_icon (windows.get (i));
  92.             } else {
  93.                 Prefs.Launcher = launcher;
  94.                 load_from_launcher ();
Add Comment
Please, Sign In to add comment