gnome-commander r1500 - in branches/gcmd-1-3: . src



Author: epiotr
Date: Thu Jan 10 00:07:15 2008
New Revision: 1500
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1500&view=rev

Log:
Add missing "umount" cross to close-connection toolbar button

Modified:
   branches/gcmd-1-3/ChangeLog
   branches/gcmd-1-3/src/gnome-cmd-con-device.cc
   branches/gcmd-1-3/src/gnome-cmd-con-ftp.cc

Modified: branches/gcmd-1-3/src/gnome-cmd-con-device.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-con-device.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-con-device.cc	Thu Jan 10 00:07:15 2008
@@ -463,35 +463,41 @@
     if (con->open_pixmap)
         gnome_cmd_pixmap_free (con->open_pixmap);
     if (con->close_pixmap)
-    {
         gnome_cmd_pixmap_free (con->close_pixmap);
-        con->close_pixmap = NULL;
-    }
 
-    if (!icon_path)
-        dev->priv->icon_path = NULL;
-    else
-    {
-        dev->priv->icon_path = g_strdup (icon_path);
+    con->go_pixmap = NULL;
+    con->open_pixmap = NULL;
+    con->close_pixmap = NULL;
+
+    dev->priv->icon_path = g_strdup (icon_path);
 
+    if (icon_path)
+    {
         guint dev_icon_size = gnome_cmd_data_get_dev_icon_size ();
 
         con->go_pixmap = gnome_cmd_pixmap_new_from_file (icon_path, dev_icon_size, dev_icon_size);
         con->open_pixmap = gnome_cmd_pixmap_new_from_file (icon_path, dev_icon_size, dev_icon_size);
-        if (con->open_pixmap)
+        con->close_pixmap = gnome_cmd_pixmap_new_from_file (icon_path, dev_icon_size, dev_icon_size);
+
+        if (con->close_pixmap)
         {
-            GdkPixbuf *tmp = IMAGE_get_pixbuf(PIXMAP_OVERLAY_UMOUNT);
-            if (tmp)
+            GdkPixbuf *overlay = gdk_pixbuf_copy (con->close_pixmap->pixbuf);
+
+            if (overlay)
             {
-                GdkPixbuf *overlay = gdk_pixbuf_copy (con->open_pixmap->pixbuf);
+                GdkPixbuf *umount = IMAGE_get_pixbuf (PIXMAP_OVERLAY_UMOUNT);
 
-                int w = gdk_pixbuf_get_width (tmp);
-                int h = gdk_pixbuf_get_height (tmp);
-                if (w > 14)  w = 14;
-                if (h > 14)  h = 14;
+                if (umount)
+                {
+                    gdk_pixbuf_copy_area (umount, 0, 0,
+                                          MIN (gdk_pixbuf_get_width (umount), dev_icon_size),
+                                          MIN (gdk_pixbuf_get_height (umount), dev_icon_size),
+                                          overlay, 0, 0);
+                    // FIXME: free con->close_pixmap here
+                    con->close_pixmap = gnome_cmd_pixmap_new_from_pixbuf (overlay);
+                }
 
-                gdk_pixbuf_copy_area (tmp, 0, 0, w, h, overlay, 0, 0);
-                con->close_pixmap = gnome_cmd_pixmap_new_from_pixbuf (overlay);
+                g_object_unref (overlay);
             }
         }
     }

Modified: branches/gcmd-1-3/src/gnome-cmd-con-ftp.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-con-ftp.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-con-ftp.cc	Thu Jan 10 00:07:15 2008
@@ -204,6 +204,9 @@
 static void init (GnomeCmdConFtp *ftp_con)
 {
     guint dev_icon_size = gnome_cmd_data_get_dev_icon_size ();
+    gint icon_size;
+
+    g_assert (gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, &icon_size, NULL));
 
     GnomeCmdCon *con = GNOME_CMD_CON (ftp_con);
 
@@ -214,9 +217,31 @@
     con->can_show_free_space = FALSE;
     con->is_local = FALSE;
     con->is_closeable = TRUE;
-    con->go_pixmap = gnome_cmd_pixmap_new_from_icon ("gnome-fs-ftp", dev_icon_size);
-    con->open_pixmap = gnome_cmd_pixmap_new_from_icon ("gnome-fs-ftp", dev_icon_size);
-    con->close_pixmap = gnome_cmd_pixmap_new_from_icon ("gnome-fs-ftp", dev_icon_size);
+    con->go_pixmap = gnome_cmd_pixmap_new_from_icon (gnome_cmd_con_get_icon_name (con), dev_icon_size);
+    con->open_pixmap = gnome_cmd_pixmap_new_from_icon (gnome_cmd_con_get_icon_name (con), dev_icon_size);
+    con->close_pixmap = gnome_cmd_pixmap_new_from_icon (gnome_cmd_con_get_icon_name (con), icon_size);
+
+    if (con->close_pixmap)
+    {
+        GdkPixbuf *overlay = gdk_pixbuf_copy (con->close_pixmap->pixbuf);
+
+        if (overlay)
+        {
+            GdkPixbuf *umount = IMAGE_get_pixbuf (PIXMAP_OVERLAY_UMOUNT);
+
+            if (umount)
+            {
+                gdk_pixbuf_copy_area (umount, 0, 0,
+                                      MIN (gdk_pixbuf_get_width (umount), icon_size),
+                                      MIN (gdk_pixbuf_get_height (umount), icon_size),
+                                      overlay, 0, 0);
+                // FIXME: free con->close_pixmap here
+                con->close_pixmap = gnome_cmd_pixmap_new_from_pixbuf (overlay);
+            }
+
+            g_object_unref (overlay);
+        }
+    }
 
     ftp_con->priv = g_new0 (GnomeCmdConFtpPrivate, 1);
 



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