Revision: 1765
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1765&view=rev
Author:   phantom_sf
Date:     2007-11-08 12:02:42 -0800 (Thu, 08 Nov 2007)

Log Message:
-----------
2007-11-07 P.G. Richardson <phantom_sf at users.sourceforge.net>

  * data/gphoto*.png
  * data/Makefile.am
  
  New icons for menu items in photo window.
  
  * data/gtkpod.glade
  
  Components of photo window changed around to make more sense from
  a user perspective.
  
  * src/display.c
  * src/display.h
  
  Generic display_image_dialog function added for displaying a bare
  transient dialog with only the required pixbuf image in it. Used
  for coverart display and photo window.
  
  * src/display_photo.c
  
  View full size action added to menus.
  Rename selected album added to menus.

Modified Paths:
--------------
    gtkpod/trunk/ChangeLog_detailed
    gtkpod/trunk/data/Makefile.am
    gtkpod/trunk/data/gtkpod.glade
    gtkpod/trunk/src/display.c
    gtkpod/trunk/src/display.h
    gtkpod/trunk/src/display_coverart.c
    gtkpod/trunk/src/display_photo.c

Modified: gtkpod/trunk/ChangeLog_detailed
===================================================================
--- gtkpod/trunk/ChangeLog_detailed     2007-11-08 09:16:25 UTC (rev 1764)
+++ gtkpod/trunk/ChangeLog_detailed     2007-11-08 20:02:42 UTC (rev 1765)
@@ -1,3 +1,27 @@
+2007-11-07 P.G. Richardson <phantom_sf at users.sourceforge.net>
+
+  * data/gphoto*.png
+  * data/Makefile.am
+  
+  New icons for menu items in photo window.
+  
+  * data/gtkpod.glade
+  
+  Components of photo window changed around to make more sense from
+  a user perspective.
+  
+  * src/display.c
+  * src/display.h
+  
+  Generic display_image_dialog function added for displaying a bare
+  transient dialog with only the required pixbuf image in it. Used
+  for coverart display and photo window.
+  
+  * src/display_photo.c
+  
+  View full size action added to menus.
+  Rename selected album added to menus.
+    
 2007-11-05 Jorg Schuler <jcsjcs at users.sourceforge.net>
 
   * src/display_playlists.c (pm_set_renderer_pix): display a different

Modified: gtkpod/trunk/data/Makefile.am
===================================================================
--- gtkpod/trunk/data/Makefile.am       2007-11-08 09:16:25 UTC (rev 1764)
+++ gtkpod/trunk/data/Makefile.am       2007-11-08 20:02:42 UTC (rev 1765)
@@ -20,7 +20,13 @@
        gtkpod-logo.png                 \
        gtkpod-new-playlist.png         \
        gtkpod-read.png                 \
-       gtkpod-sync.png
+       gtkpod-sync.png     \
+       gphoto_album_menuitem-32.png   \
+       gphoto_album_menuitem-48.png   \
+       gphoto_images_menuitem-32.png  \
+       gphoto_images_menuitem-48.png  \
+       gphoto_tools_menuitem-32.png   \
+       gphoto_tools_menuitem-48.png
 
 EXTRA_DIST =                           \
        $(desktop_in_files)             \

Modified: gtkpod/trunk/data/gtkpod.glade
===================================================================
--- gtkpod/trunk/data/gtkpod.glade      2007-11-08 09:16:25 UTC (rev 1764)
+++ gtkpod/trunk/data/gtkpod.glade      2007-11-08 20:02:42 UTC (rev 1765)
@@ -20560,251 +20560,301 @@
 
   <child>
     <widget class="GtkViewport" id="photo_viewport">
+      <property name="border_width">5</property>
       <property name="visible">True</property>
-      <property name="shadow_type">GTK_SHADOW_IN</property>
+      <property name="shadow_type">GTK_SHADOW_ETCHED_OUT</property>
 
       <child>
-  <widget class="GtkVBox" id="vbox182">
-    <property name="visible">True</property>
-    <property name="homogeneous">False</property>
-    <property name="spacing">0</property>
+       <widget class="GtkHPaned" id="hpaned1">
+         <property name="visible">True</property>
+         <property name="can_focus">True</property>
 
-    <child>
-      <widget class="GtkMenuBar" id="menubar1">
-        <property name="visible">True</property>
-        <property name="pack_direction">GTK_PACK_DIRECTION_LTR</property>
-        <property name="child_pack_direction">GTK_PACK_DIRECTION_LTR</property>
+         <child>
+           <widget class="GtkVBox" id="vbox185">
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">0</property>
 
-        <child>
-    <widget class="GtkImageMenuItem" id="menuitem14">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">_Add</property>
-      <property name="use_underline">True</property>
+             <child>
+               <widget class="GtkMenuBar" id="menubar1">
+                 <property name="visible">True</property>
+                 <property 
name="pack_direction">GTK_PACK_DIRECTION_LTR</property>
+                 <property 
name="child_pack_direction">GTK_PACK_DIRECTION_LTR</property>
 
-      <child internal-child="image">
-        <widget class="GtkImage" id="image4095">
-          <property name="visible">True</property>
-          <property name="stock">gtk-add</property>
-          <property name="icon_size">1</property>
-          <property name="xalign">0.5</property>
-          <property name="yalign">0.5</property>
-          <property name="xpad">0</property>
-          <property name="ypad">0</property>
-        </widget>
-      </child>
+                 <child>
+                   <widget class="GtkImageMenuItem" id="photo_album_menuItem">
+                     <property name="visible">True</property>
+                     <property name="label" 
translatable="yes">_Album</property>
+                     <property name="use_underline">True</property>
+                     <signal name="activate" 
handler="on_photo_album_menuItem_activate" last_modification_time="Mon, 05 Nov 
2007 23:53:52 GMT"/>
 
-      <child>
-        <widget class="GtkMenu" id="menuitem14_menu">
+                     <child internal-child="image">
+                       <widget class="GtkImage" id="image4266">
+                         <property name="visible">True</property>
+                         <property 
name="pixbuf">gphoto_album_menuitem-32.png</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                     </child>
 
-          <child>
-      <widget class="GtkImageMenuItem" id="photo_add_album_menuItem">
-        <property name="visible">True</property>
-        <property name="label" translatable="yes">Add _Album</property>
-        <property name="use_underline">True</property>
+                     <child>
+                       <widget class="GtkMenu" id="photo_album_menuItem_menu">
 
-        <child internal-child="image">
-          <widget class="GtkImage" id="image4096">
-            <property name="visible">True</property>
-            <property name="stock">gtk-justify-fill</property>
-            <property name="icon_size">1</property>
-            <property name="xalign">0.5</property>
-            <property name="yalign">0.5</property>
-            <property name="xpad">0</property>
-            <property name="ypad">0</property>
-          </widget>
-        </child>
-      </widget>
-          </child>
+                         <child>
+                           <widget class="GtkImageMenuItem" 
id="photo_add_album_menuItem">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">_Add 
Album</property>
+                             <property name="use_underline">True</property>
 
-          <child>
-      <widget class="GtkImageMenuItem" id="photo_add_image_menuItem">
-        <property name="visible">True</property>
-        <property name="label" translatable="yes">Add _Image</property>
-        <property name="use_underline">True</property>
+                             <child internal-child="image">
+                               <widget class="GtkImage" id="image4267">
+                                 <property name="visible">True</property>
+                                 <property 
name="stock">gtk-justify-fill</property>
+                                 <property name="icon_size">1</property>
+                                 <property name="xalign">0.5</property>
+                                 <property name="yalign">0.5</property>
+                                 <property name="xpad">0</property>
+                                 <property name="ypad">0</property>
+                               </widget>
+                             </child>
+                           </widget>
+                         </child>
 
-        <child internal-child="image">
-          <widget class="GtkImage" id="image4097">
-            <property name="visible">True</property>
-            <property name="stock">gtk-file</property>
-            <property name="icon_size">1</property>
-            <property name="xalign">0.5</property>
-            <property name="yalign">0.5</property>
-            <property name="xpad">0</property>
-            <property name="ypad">0</property>
-          </widget>
-        </child>
-      </widget>
-          </child>
+                         <child>
+                           <widget class="GtkImageMenuItem" 
id="photo_remove_album_menuItem">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">_Remove 
_Album</property>
+                             <property name="use_underline">True</property>
 
-          <child>
-      <widget class="GtkImageMenuItem" id="photo_add_image_dir_menuItem">
-        <property name="visible">True</property>
-        <property name="tooltip" translatable="yes">Add Images from a 
Directory</property>
-        <property name="label" translatable="yes">Add Image_s</property>
-        <property name="use_underline">True</property>
+                             <child internal-child="image">
+                               <widget class="GtkImage" id="image4268">
+                                 <property name="visible">True</property>
+                                 <property name="stock">gtk-remove</property>
+                                 <property name="icon_size">1</property>
+                                 <property name="xalign">0.5</property>
+                                 <property name="yalign">0.5</property>
+                                 <property name="xpad">0</property>
+                                 <property name="ypad">0</property>
+                               </widget>
+                             </child>
+                           </widget>
+                         </child>
 
-        <child internal-child="image">
-          <widget class="GtkImage" id="image4098">
-            <property name="visible">True</property>
-            <property name="stock">gtk-directory</property>
-            <property name="icon_size">1</property>
-            <property name="xalign">0.5</property>
-            <property name="yalign">0.5</property>
-            <property name="xpad">0</property>
-            <property name="ypad">0</property>
-          </widget>
-        </child>
-      </widget>
-          </child>
-        </widget>
-      </child>
-    </widget>
-        </child>
+                         <child>
+                           <widget class="GtkMenuItem" 
id="photo_rename_album_menuItem">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">R_ename 
Album</property>
+                             <property name="use_underline">True</property>
+                           </widget>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
 
-        <child>
-    <widget class="GtkImageMenuItem" id="menuitem15">
-      <property name="visible">True</property>
-      <property name="label" translatable="yes">_Remove</property>
-      <property name="use_underline">True</property>
+                 <child>
+                   <widget class="GtkImageMenuItem" id="menuitem14">
+                     <property name="visible">True</property>
+                     <property name="label" 
translatable="yes">_Image</property>
+                     <property name="use_underline">True</property>
 
-      <child internal-child="image">
-        <widget class="GtkImage" id="image4099">
-          <property name="visible">True</property>
-          <property name="stock">gtk-delete</property>
-          <property name="icon_size">1</property>
-          <property name="xalign">0.5</property>
-          <property name="yalign">0.5</property>
-          <property name="xpad">0</property>
-          <property name="ypad">0</property>
-        </widget>
-      </child>
+                     <child internal-child="image">
+                       <widget class="GtkImage" id="image4269">
+                         <property name="visible">True</property>
+                         <property 
name="pixbuf">gphoto_images_menuitem-32.png</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                     </child>
 
-      <child>
-        <widget class="GtkMenu" id="menuitem15_menu">
+                     <child>
+                       <widget class="GtkMenu" id="menuitem14_menu">
 
-          <child>
-      <widget class="GtkImageMenuItem" id="photo_remove_album_menuItem">
-        <property name="visible">True</property>
-        <property name="label" translatable="yes">Remove _Album</property>
-        <property name="use_underline">True</property>
+                         <child>
+                           <widget class="GtkImageMenuItem" 
id="photo_add_image_menuItem">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">_Add 
Image</property>
+                             <property name="use_underline">True</property>
 
-        <child internal-child="image">
-          <widget class="GtkImage" id="image4100">
-            <property name="visible">True</property>
-            <property name="stock">gtk-remove</property>
-            <property name="icon_size">1</property>
-            <property name="xalign">0.5</property>
-            <property name="yalign">0.5</property>
-            <property name="xpad">0</property>
-            <property name="ypad">0</property>
-          </widget>
-        </child>
-      </widget>
-          </child>
+                             <child internal-child="image">
+                               <widget class="GtkImage" id="image4270">
+                                 <property name="visible">True</property>
+                                 <property name="stock">gtk-file</property>
+                                 <property name="icon_size">1</property>
+                                 <property name="xalign">0.5</property>
+                                 <property name="yalign">0.5</property>
+                                 <property name="xpad">0</property>
+                                 <property name="ypad">0</property>
+                               </widget>
+                             </child>
+                           </widget>
+                         </child>
 
-          <child>
-      <widget class="GtkImageMenuItem" id="photo_remove_image_menuItem">
-        <property name="visible">True</property>
-        <property name="label" translatable="yes">Remove _Images</property>
-        <property name="use_underline">True</property>
+                         <child>
+                           <widget class="GtkImageMenuItem" 
id="photo_add_image_dir_menuItem">
+                             <property name="visible">True</property>
+                             <property name="tooltip" translatable="yes">Add 
Images from a Directory</property>
+                             <property name="label" translatable="yes">Add 
Image_s</property>
+                             <property name="use_underline">True</property>
 
-        <child internal-child="image">
-          <widget class="GtkImage" id="image4101">
-            <property name="visible">True</property>
-            <property name="stock">gtk-missing-image</property>
-            <property name="icon_size">1</property>
-            <property name="xalign">0.5</property>
-            <property name="yalign">0.5</property>
-            <property name="xpad">0</property>
-            <property name="ypad">0</property>
-          </widget>
-        </child>
-      </widget>
-          </child>
-        </widget>
-      </child>
-    </widget>
-        </child>
-      </widget>
-      <packing>
-        <property name="padding">0</property>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-      </packing>
-    </child>
+                             <child internal-child="image">
+                               <widget class="GtkImage" id="image4271">
+                                 <property name="visible">True</property>
+                                 <property 
name="stock">gtk-directory</property>
+                                 <property name="icon_size">1</property>
+                                 <property name="xalign">0.5</property>
+                                 <property name="yalign">0.5</property>
+                                 <property name="xpad">0</property>
+                                 <property name="ypad">0</property>
+                               </widget>
+                             </child>
+                           </widget>
+                         </child>
 
-    <child>
-      <widget class="GtkHBox" id="hbox214">
-        <property name="visible">True</property>
-        <property name="homogeneous">True</property>
-        <property name="spacing">0</property>
+                         <child>
+                           <widget class="GtkImageMenuItem" 
id="photo_remove_image_menuItem">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">_Remove 
Images</property>
+                             <property name="use_underline">True</property>
 
-        <child>
-    <widget class="GtkScrolledWindow" id="photo_album_window">
-      <property name="visible">True</property>
-      <property name="can_focus">True</property>
-      <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-      <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-      <property name="shadow_type">GTK_SHADOW_IN</property>
-      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+                             <child internal-child="image">
+                               <widget class="GtkImage" id="image4272">
+                                 <property name="visible">True</property>
+                                 <property 
name="stock">gtk-missing-image</property>
+                                 <property name="icon_size">1</property>
+                                 <property name="xalign">0.5</property>
+                                 <property name="yalign">0.5</property>
+                                 <property name="xpad">0</property>
+                                 <property name="ypad">0</property>
+                               </widget>
+                             </child>
+                           </widget>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
 
-      <child>
-        <placeholder/>
-      </child>
-    </widget>
-    <packing>
-      <property name="padding">0</property>
-      <property name="expand">True</property>
-      <property name="fill">True</property>
-    </packing>
-        </child>
+                 <child>
+                   <widget class="GtkImageMenuItem" id="menuitem15">
+                     <property name="visible">True</property>
+                     <property name="label" 
translatable="yes">_Tools</property>
+                     <property name="use_underline">True</property>
 
-        <child>
-    <widget class="GtkImage" id="photo_preview_image">
-      <property name="width_request">230</property>
-      <property name="height_request">186</property>
-      <property name="visible">True</property>
-      <property name="xalign">0.5</property>
-      <property name="yalign">0.5</property>
-      <property name="xpad">0</property>
-      <property name="ypad">0</property>
-    </widget>
-    <packing>
-      <property name="padding">2</property>
-      <property name="expand">False</property>
-      <property name="fill">True</property>
-    </packing>
-        </child>
-      </widget>
-      <packing>
-        <property name="padding">0</property>
-        <property name="expand">False</property>
-        <property name="fill">False</property>
-      </packing>
-    </child>
+                     <child internal-child="image">
+                       <widget class="GtkImage" id="image4273">
+                         <property name="visible">True</property>
+                         <property 
name="pixbuf">gphoto_tools_menuitem-32.png</property>
+                         <property name="xalign">0.5</property>
+                         <property name="yalign">0.5</property>
+                         <property name="xpad">0</property>
+                         <property name="ypad">0</property>
+                       </widget>
+                     </child>
 
-    <child>
-      <widget class="GtkScrolledWindow" id="photo_thumbnail_window">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-        <property name="shadow_type">GTK_SHADOW_NONE</property>
-        <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+                     <child>
+                       <widget class="GtkMenu" id="menuitem15_menu">
 
-        <child>
-    <placeholder/>
-        </child>
-      </widget>
-      <packing>
-        <property name="padding">2</property>
-        <property name="expand">True</property>
-        <property name="fill">True</property>
-      </packing>
-    </child>
-  </widget>
+                         <child>
+                           <widget class="GtkImageMenuItem" 
id="photo_view_full_size_menuItem">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">View 
Full Size</property>
+                             <property name="use_underline">True</property>
+
+                             <child internal-child="image">
+                               <widget class="GtkImage" id="image4274">
+                                 <property name="visible">True</property>
+                                 <property name="stock">gtk-zoom-fit</property>
+                                 <property name="icon_size">1</property>
+                                 <property name="xalign">0.5</property>
+                                 <property name="yalign">0.5</property>
+                                 <property name="xpad">0</property>
+                                 <property name="ypad">0</property>
+                               </widget>
+                             </child>
+                           </widget>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkScrolledWindow" id="photo_album_window">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property 
name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                 <property 
name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                 <property name="shadow_type">GTK_SHADOW_IN</property>
+                 <property 
name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+                 <child>
+                   <placeholder/>
+                 </child>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">True</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkImage" id="photo_preview_image">
+                 <property name="width_request">250</property>
+                 <property name="height_request">176</property>
+                 <property name="visible">True</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="padding">1</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="shrink">False</property>
+             <property name="resize">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkScrolledWindow" id="photo_thumbnail_window">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="shadow_type">GTK_SHADOW_NONE</property>
+             <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+             <child>
+               <placeholder/>
+             </child>
+           </widget>
+           <packing>
+             <property name="shrink">True</property>
+             <property name="resize">True</property>
+           </packing>
+         </child>
+       </widget>
       </child>
     </widget>
   </child>
 </widget>
+
 </glade-interface>

Modified: gtkpod/trunk/src/display.c
===================================================================
--- gtkpod/trunk/src/display.c  2007-11-08 09:16:25 UTC (rev 1764)
+++ gtkpod/trunk/src/display.c  2007-11-08 20:02:42 UTC (rev 1765)
@@ -45,6 +45,7 @@
 #include "tools.h"
 #include <stdlib.h>
 #include <string.h>
+#include <glib/gprintf.h>
 
 
 GtkWidget *gtkpod_window = NULL;
@@ -442,8 +443,98 @@
     file_convert_update_default_sizes ();
 }
 
+/**
+ * display_image_dialog
+ * 
+ * @GdkPixbuf: image
+ * 
+ * function to load a transient dialog displaying the provided image at either
+ * it maximum size or the size of the screen (whichever is smallest).
+ * 
+ */
+void display_image_dialog (GdkPixbuf *image)
+{
+       g_return_if_fail (image);
+       
+       GladeXML *preview_xml;
+       GtkWidget *dialog;
+       GtkWidget *canvasbox;
+       GtkWidget *res_label;
+       GdkPixbuf *scaled = NULL;
+       gchar *text;
+               
+       preview_xml = glade_xml_new (xml_file, "coverart_preview_dialog", NULL);
+               
+       dialog = gtkpod_xml_get_widget (preview_xml, "coverart_preview_dialog");
+       canvasbox = gtkpod_xml_get_widget (preview_xml, 
"coverart_preview_dialog_vbox");
+       res_label = gtkpod_xml_get_widget (preview_xml, 
"coverart_preview_dialog_res_lbl");
+       g_return_if_fail (dialog);
+       g_return_if_fail (canvasbox);
+       g_return_if_fail (res_label);
+               
+       /* Set the dialog parent */
+       gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW 
(gtkpod_window));
+                       
+       gint pixheight = gdk_pixbuf_get_height (image);
+       gint pixwidth = gdk_pixbuf_get_width (image);
+               
+       /* Set the resolution in the label */
+       gchar *resvalues = (gchar *) g_malloc (sizeof(gint) + (sizeof(gchar) * 
3) + sizeof(gint));
+       g_sprintf (resvalues, "%d x %d", pixwidth, pixheight);
+       text = g_markup_printf_escaped ("<b>Image Dimensions: %s</b>", 
resvalues);
+       gtk_label_set_markup (GTK_LABEL (res_label), text);
+       g_free (text);
+       
+       gint scrheight = gdk_screen_height() - 100;
+       gint scrwidth = gdk_screen_width() - 100;
+               
+       gdouble ratio = (gdouble) pixwidth / (gdouble) pixheight;
+       if (pixwidth > scrwidth)
+       {
+               pixwidth = scrwidth;
+               pixheight = pixwidth / ratio;
+       }
+               
+       if (pixheight > scrheight)
+       {
+               pixheight = scrheight;
+               pixwidth = pixheight * ratio;
+       }
+               
+       GnomeCanvas *canvas;
+       canvas = GNOME_CANVAS (gnome_canvas_new());
+       gtk_widget_set_size_request ( GTK_WIDGET(canvas),
+                       pixwidth,
+                       pixheight);
+       
+       gnome_canvas_set_scroll_region (        canvas,
+                                                                               
                                                                                
                                                                                
0.0, 0.0, 
+                                                                               
                                                                                
                                                                                
pixwidth,
+                                                                               
                                                                                
                                                                                
pixheight);
+       GnomeCanvasItem *canvasitem;                                            
                                        
+       canvasitem = gnome_canvas_item_new(     gnome_canvas_root(canvas),
+                                                                               
                                                                                
                                                                                
                                        GNOME_TYPE_CANVAS_PIXBUF, NULL);
+               
+       scaled = gdk_pixbuf_scale_simple (image, pixwidth, pixheight, 
GDK_INTERP_NEAREST);
+               
+       /* Apply the image to the canvas */
+       gnome_canvas_item_set ( canvasitem,
+                                                                               
                                                                                
                        "pixbuf", scaled);
 
+       gtk_box_pack_start_defaults (GTK_BOX(canvasbox), GTK_WIDGET (canvas));
+               
+       /* Display the dialog and block everything else until the
+        * dialog is closed.
+        */
+       gtk_widget_show_all (dialog);
+       gtk_dialog_run (GTK_DIALOG(dialog));
+                       
+       /* Destroy the dialog as no longer required */
+       gdk_pixbuf_unref (scaled);
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+}
 
+
 /* Utility function: returns a copy of the tracks currently
    selected. This means:
 

Modified: gtkpod/trunk/src/display.h
===================================================================
--- gtkpod/trunk/src/display.h  2007-11-08 09:16:25 UTC (rev 1764)
+++ gtkpod/trunk/src/display.h  2007-11-08 20:02:42 UTC (rev 1765)
@@ -295,6 +295,7 @@
 GList *display_get_selected_members (gint inst);
 void display_remove_autoscroll_row_timeout (GtkWidget *widget);
 void display_install_autoscroll_row_timeout (GtkWidget *widget);
+void display_image_dialog (GdkPixbuf *image);
 
 Playlist* pm_get_selected_playlist (void);
 gint pm_get_position_for_itdb (iTunesDB *itdb);

Modified: gtkpod/trunk/src/display_coverart.c
===================================================================
--- gtkpod/trunk/src/display_coverart.c 2007-11-08 09:16:25 UTC (rev 1764)
+++ gtkpod/trunk/src/display_coverart.c 2007-11-08 20:02:42 UTC (rev 1765)
@@ -38,7 +38,6 @@
 #include "context_menus.h"
 #include "details.h"
 #include "fileselection.h"
-#include <glib/gprintf.h>
 #include "fetchcover.h"
 #include "info.h"
 
@@ -687,38 +686,14 @@
 {
        Cover_Item *cover;
        ExtraTrackData *etd;
+       GdkPixbuf *imgbuf = NULL;
        
        cover = g_ptr_array_index(cdwidget->cdcovers, IMG_MAIN);
        g_return_if_fail (cover);
        
        if (cover->album == NULL)
                return;
-       
-       GladeXML *preview_xml;
-       GtkWidget *dialog;
-       GtkWidget *canvasbox;
-       GtkWidget *res_label;
-       GdkPixbuf *imgbuf = NULL;
-       GdkPixbuf *scaled = NULL;
-       gchar *text;
-       
-       preview_xml = glade_xml_new (xml_file, "coverart_preview_dialog", NULL);
-       
-       dialog = gtkpod_xml_get_widget (preview_xml, "coverart_preview_dialog");
-       canvasbox = gtkpod_xml_get_widget (preview_xml, 
"coverart_preview_dialog_vbox");
-       res_label = gtkpod_xml_get_widget (preview_xml, 
"coverart_preview_dialog_res_lbl");
-       g_return_if_fail (dialog);
-       g_return_if_fail (canvasbox);
-       g_return_if_fail (res_label);
-       
-       /* Set the dialog parent */
-       gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW 
(gtkpod_window));
-       
-       /* Set the dialog title */
-       text = g_strconcat (cover->album->artist, ": ", 
cover->album->albumname, NULL);
-       gtk_window_set_title (GTK_WINDOW(dialog), text);
-       g_free (text);
-               
+                               
        Track *track;
        track = g_list_nth_data (cover->album->tracks, 0);
        etd = track->userdata;
@@ -738,72 +713,17 @@
         */
        if (imgbuf ==  NULL)
        {
-               /* Could not get a viable thumbnail so get default pixbuf */
-               imgbuf = coverart_get_default_track_thumb (256);
+               /* Could not get a viable thumbnail so get default pixbuf */
+               imgbuf = coverart_get_default_track_thumb (256);
        }
        
-       gint pixheight = gdk_pixbuf_get_height (imgbuf);
-       gint pixwidth = gdk_pixbuf_get_width (imgbuf);
-       
-       /* Set the resolution in the label */
-       gchar *resvalues = (gchar *) g_malloc (sizeof(gint) + (sizeof(gchar) * 
3) + sizeof(gint));
-       g_sprintf (resvalues, "%d x %d", pixwidth, pixheight);
-       text = g_markup_printf_escaped ("<b>Image Dimensions: %s</b>", 
resvalues);
-       gtk_label_set_markup (GTK_LABEL (res_label), text);
-       g_free (text);
-       
-       gint scrheight = gdk_screen_height() - 100;
-       gint scrwidth = gdk_screen_width() - 100;
-       
-       gdouble ratio = (gdouble) pixwidth / (gdouble) pixheight;
-       if (pixwidth > scrwidth)
-       {
-               pixwidth = scrwidth;
-               pixheight = pixwidth / ratio;
-       }
-       
-       if (pixheight > scrheight)
-       {
-               pixheight = scrheight;
-               pixwidth = pixheight * ratio;
-       }
-       
-       GnomeCanvas *canvas;
-       canvas = GNOME_CANVAS (gnome_canvas_new());
-       gtk_widget_set_size_request ( GTK_WIDGET(canvas),
-                                                                               
                                                                                
                                        pixwidth,
-                                                                               
                                                                                
                                        pixheight);
-       gnome_canvas_set_scroll_region (        canvas,
-                                                                               
                                                                                
                                                                        0.0, 
0.0, 
-                                                                               
                                                                                
                                                                        
pixwidth,
-                                                                               
                                                                                
                                                                        
pixheight);
-       GnomeCanvasItem *canvasitem;                                            
                                        
-       canvasitem = gnome_canvas_item_new(     gnome_canvas_root(canvas),
-                                                                               
                                                                                
                                                                                
                                GNOME_TYPE_CANVAS_PIXBUF, NULL);
-       
-       scaled = gdk_pixbuf_scale_simple (imgbuf, pixwidth, pixheight, 
GDK_INTERP_NEAREST);
-       
-       /* Apply the image to the canvas */
-       gnome_canvas_item_set ( canvasitem,
-                                                                               
                                                                                
                "pixbuf", scaled);
-
-       gtk_box_pack_start_defaults (GTK_BOX(canvasbox), GTK_WIDGET (canvas));
-       
+       display_image_dialog (imgbuf);
+               
        /* Unreference pixbuf if it is not pointing to
         * the album's artwork
         */
        if (cover->album->albumart == NULL)
                gdk_pixbuf_unref (imgbuf);
-       
-       /* Display the dialog and block everything else until the
-        * dialog is closed.
-        */
-       gtk_widget_show_all (dialog);
-       gtk_dialog_run (GTK_DIALOG(dialog));
-       
-       /* Destroy the dialog as no longer required */
-       gdk_pixbuf_unref (scaled);
-       gtk_widget_destroy (GTK_WIDGET (dialog));
 }
 
 /**

Modified: gtkpod/trunk/src/display_photo.c
===================================================================
--- gtkpod/trunk/src/display_photo.c    2007-11-08 09:16:25 UTC (rev 1764)
+++ gtkpod/trunk/src/display_photo.c    2007-11-08 20:02:42 UTC (rev 1765)
@@ -34,6 +34,7 @@
 #include <glib/gprintf.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <string.h>
+#include "display.h"
 
 
 #define DEBUG 0
@@ -62,11 +63,13 @@
 /* pointer to the gtkimage that holds the preview image */
 static GtkImage *photo_preview_image= NULL;
 /* Menu Items */
-static GtkMenuItem *photo_add_album_menuItem= NULL;
-static GtkMenuItem *photo_add_image_menuItem= NULL;
-static GtkMenuItem *photo_add_image_dir_menuItem= NULL;
-static GtkMenuItem *photo_remove_album_menuItem= NULL;
-static GtkMenuItem *photo_remove_image_menuItem= NULL;
+static GtkMenuItem *photo_add_album_menuItem = NULL;
+static GtkMenuItem *photo_add_image_menuItem = NULL;
+static GtkMenuItem *photo_add_image_dir_menuItem = NULL;
+static GtkMenuItem *photo_remove_album_menuItem = NULL;
+static GtkMenuItem *photo_remove_image_menuItem = NULL;
+static GtkMenuItem *photo_view_full_size_menuItem = NULL;
+static GtkMenuItem *photo_rename_album_menuItem = NULL;
 
 /* Drag n Drop Definitions */
 static GtkTargetEntry photo_drag_types [] = {
@@ -102,6 +105,8 @@
 void on_photodb_add_image_dir_menuItem_activate(GtkMenuItem *menuItem, 
gpointer user_data);
 void on_photodb_remove_album_menuItem_activate(GtkMenuItem *menuItem, gpointer 
user_data);
 void on_photodb_remove_image_menuItem_activate(GtkMenuItem *menuItem, gpointer 
user_data);
+void on_photodb_view_full_size_menuItem_activate (GtkMenuItem *menuItem, 
gpointer user_data);
+void on_photodb_rename_album_menuItem_activate (GtkMenuItem *menuItem, 
gpointer user_data);
 static void signal_data_changed();
 static gchar *gphoto_get_selected_album_name();
 static void gphoto_add_image_to_database(gchar *photo_filename);
@@ -323,7 +328,9 @@
                        photo_add_image_dir_menuItem = GTK_MENU_ITEM 
(gtkpod_xml_get_widget (photo_xml, "photo_add_image_dir_menuItem"));
                        photo_remove_album_menuItem = GTK_MENU_ITEM 
(gtkpod_xml_get_widget (photo_xml, "photo_remove_album_menuItem"));
                        photo_remove_image_menuItem = GTK_MENU_ITEM 
(gtkpod_xml_get_widget (photo_xml, "photo_remove_image_menuItem"));
-
+                       photo_view_full_size_menuItem = GTK_MENU_ITEM 
(gtkpod_xml_get_widget (photo_xml, "photo_view_full_size_menuItem"));
+                       photo_rename_album_menuItem = GTK_MENU_ITEM 
(gtkpod_xml_get_widget (photo_xml, "photo_rename_album_menuItem"));
+                       
                        photo_viewport = gtkpod_xml_get_widget (photo_xml, 
"photo_viewport");
                        g_object_ref (photo_album_window);
                        g_object_ref (photo_thumb_window);
@@ -348,6 +355,11 @@
                NULL);
                g_signal_connect (G_OBJECT(photo_remove_image_menuItem), 
"activate", G_CALLBACK(on_photodb_remove_image_menuItem_activate), 
                NULL);
+               g_signal_connect (G_OBJECT(photo_view_full_size_menuItem), 
"activate", G_CALLBACK(on_photodb_view_full_size_menuItem_activate), 
+                               NULL);
+               g_signal_connect (G_OBJECT(photo_rename_album_menuItem), 
"activate", G_CALLBACK(on_photodb_rename_album_menuItem_activate),
+                               NULL);
+               
        } else
        {
                if (!GTK_WIDGET_VISIBLE (paned1))
@@ -431,7 +443,7 @@
                g_return_if_fail (album);
 
                gchar *name = album->name ? album->name : _("<Unnamed>");
-               printf ("name of album: %s\n", name);
+               /*printf ("name of album: %s\n", name);*/
                /* Add a new row to the model */
                gtk_list_store_append (model, &iter);
                gtk_list_store_set (model, &iter, COL_ALBUM_NAME, name, -1);
@@ -471,8 +483,6 @@
        g_signal_connect ((gpointer) album_view, "drag-data-received",
                        G_CALLBACK (dnd_album_drag_data_received), 
                        NULL);
-
-
 }
 
 /* Create thumbnail view */
@@ -558,12 +568,17 @@
 
        /* Disable the remove image menu item until an image is selected */
        gtk_widget_set_sensitive (GTK_WIDGET(photo_remove_image_menuItem), 
FALSE);
+       /* Disable the view full size menu item until an image is selected */
+       gtk_widget_set_sensitive (GTK_WIDGET(photo_view_full_size_menuItem), 
FALSE);
+       /* Disable the rename menu item untill an album is selected */
+       gtk_widget_set_sensitive (GTK_WIDGET(photo_rename_album_menuItem), 
FALSE);
 }
 
 /* Callback when the selection of the album is changed */
 static void gphoto_album_selection_changed(GtkTreeSelection *selection, 
gpointer user_data)
 {
        gchar *album_name= NULL;
+       PhotoAlbum *selected_album = NULL;
 
        album_name = gphoto_get_selected_album_name (selection);
 
@@ -574,7 +589,17 @@
        {
                /* Enable the remove album menu item now that one is selected */
                gtk_widget_set_sensitive 
(GTK_WIDGET(photo_remove_album_menuItem), TRUE);
+               
+               selected_album = itdb_photodb_photoalbum_by_name (photodb, 
album_name);
+               if (selected_album->album_type != 0x01)
+               {
+                       /* Only allow renaming of album if not the Photo 
Library */
+                       gtk_widget_set_sensitive 
(GTK_WIDGET(photo_rename_album_menuItem), TRUE);
+                       return;
+               }
        }
+       gtk_widget_set_sensitive (GTK_WIDGET(photo_rename_album_menuItem), 
FALSE);
+       return;
 }
 
 /* Callback when the selection of a thumbnail image is changed */
@@ -598,6 +623,8 @@
 
        /* Enable the remove image menu item until an album is selected */
        gtk_widget_set_sensitive (GTK_WIDGET(photo_remove_image_menuItem), 
TRUE);
+       /* Enable the view full size menu item */
+       gtk_widget_set_sensitive (GTK_WIDGET(photo_view_full_size_menuItem), 
TRUE);
 }
 
 /* Display the selected thumbnail image in the preview window */
@@ -646,6 +673,7 @@
        gdk_pixbuf_unref (pixbuf);
 
        gtk_image_set_from_pixbuf (photo_preview_image, scaled);
+       gtk_misc_set_padding (GTK_MISC(photo_preview_image), 20, 20);
 }
 
 /* Convenience function that sets the flags on the Extra iTunes Database
@@ -959,10 +987,12 @@
        GtkTreeIter iter;
        GtkListStore *model;
 
-       gchar *album_name = get_user_string (_("New Photo Album"), _("Please 
enter a name for the new photo album"), 
-       NULL, 
-       NULL, 
-       NULL);
+       gchar *album_name = get_user_string (
+                       _("New Photo Album"),
+                       _("Please enter a name for the new photo album"), 
+                       NULL, 
+                       NULL, 
+                       NULL);
 
        if (album_name == NULL|| strlen (album_name) == 0)
                return;
@@ -1078,6 +1108,122 @@
        gphoto_remove_selected_photos_from_album (TRUE);
 }
 
+/**
+ * on_photodb_view_full_size_menuItem_activate
+ *
+ * Callback used to display a dialog contain a full size / screen size version 
of the selected image. Same as
+ * that used in coverart display.
+ * 
+ */
+void on_photodb_view_full_size_menuItem_activate (GtkMenuItem *menuItem, 
gpointer user_data)
+{
+       GList * selected_images;
+       GtkTreeModel *model;
+       GtkTreePath *treePath = NULL;
+       GtkTreeIter iter;
+       Artwork *artwork = NULL;
+       GdkPixbuf * pixbuf;
+       gint i;
+       Thumb *thumb = NULL;
+       
+       /* Find which images are selected */
+       selected_images = gtk_icon_view_get_selected_items 
(GTK_ICON_VIEW(thumbnail_view));
+       if (selected_images == NULL|| g_list_length (selected_images) == 0)
+               return;
+
+       /* Using the model find the first Artwork object from the selected 
images list
+        * Should only be one in the list if the toolbar button is being 
enabled/disabled
+        * correctly.
+        */
+       model = gtk_icon_view_get_model (GTK_ICON_VIEW(thumbnail_view));
+                               
+       treePath = g_list_nth_data (selected_images, 0);
+       gtk_tree_model_get_iter (model, &iter, treePath);
+       gtk_tree_model_get (model, &iter, COL_THUMB_ARTWORK, &artwork, -1);
+       
+       /* Find the biggest thumb that exists on the pod */
+       for (i = (PHOTO_TYPES_SIZE - 1); i >= 0 && thumb == NULL; --i)
+       {
+               /* Start from biggest photo type and go smaller */
+               thumb = itdb_artwork_get_thumb_by_type (artwork, 
photo_types[i]);
+       }
+       /* should have a thumb now but check anyway and fire off a warning if 
it is still null */
+       g_return_if_fail (thumb);
+               
+       pixbuf = itdb_thumb_get_gdk_pixbuf (device, thumb);
+       g_return_if_fail (pixbuf);
+       
+       display_image_dialog (pixbuf);
+
+}
+
+/**
+ * on_photodb_rename_album_menuItem_activate
+ *
+ * Callback used to rename an album.
+ * 
+ */
+void on_photodb_rename_album_menuItem_activate (GtkMenuItem *menuItem, 
gpointer user_data)
+{
+       gchar *album_name= NULL;
+       PhotoAlbum *selected_album;
+       GtkTreeSelection *selection;
+
+       /* Get the currently selected album */
+       selection = gtk_tree_view_get_selection (album_view);
+       album_name= gphoto_get_selected_album_name (selection);
+
+       /* Find the selected album. If no selection then returns the Main Album 
*/
+       selected_album = itdb_photodb_photoalbum_by_name (photodb, album_name);
+       g_return_if_fail (selected_album);
+       
+       if (selected_album->album_type == 0x01)
+       {
+               /* Dont rename the Photo Library */
+               return;
+       }
+       
+       gchar *new_album_name = get_user_string (
+                       _("New Photo Album Name"),
+                       _("Please enter a new name for the photo album"), 
+                       NULL, 
+                       NULL, 
+                       NULL);
+
+       if (new_album_name == NULL|| strlen (new_album_name) == 0)
+               return;
+
+       /* Check an album with this name doesnt already exist */
+       PhotoAlbum *curr_album;
+       curr_album = itdb_photodb_photoalbum_by_name (photodb, new_album_name);
+       if (curr_album != NULL)
+       {
+               gtkpod_warning (_("An album with that name already exists."));
+               g_free (new_album_name);
+               return;
+       }
+       
+       /* Rename the album in the database */
+       selected_album->name = g_strdup (new_album_name);
+       
+       /* Update the row in the album view */
+       GtkTreeModel *album_model;
+       GtkTreeIter iter;
+       
+       album_model = gtk_tree_view_get_model (album_view);
+       if (gtk_tree_selection_get_selected (selection, &album_model, &iter) == 
TRUE)
+       {
+               gtk_list_store_set (GTK_LIST_STORE(album_model), &iter, 
COL_ALBUM_NAME, new_album_name, -1);;
+       }
+       
+       g_free (new_album_name);
+       
+       signal_data_changed();
+       
+       /* Using the existing selection, reselect the album so it reloads the 
preview of the first image */
+       gphoto_album_selection_changed (selection, NULL);
+}
+
 /* -----------------------------------------------------------*/
 /* Section for album display                                  */
 /* drag and drop                                                   */


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to