Revision: 1569
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1569&view=rev
Author:   nadvornik
Date:     2009-03-21 19:51:07 +0000 (Sat, 21 Mar 2009)

Log Message:
-----------
layout id "_current_" matches the currently active layout window

Modified Paths:
--------------
    trunk/src/layout.c
    trunk/src/layout.h

Modified: trunk/src/layout.c
===================================================================
--- trunk/src/layout.c  2009-03-21 18:22:04 UTC (rev 1568)
+++ trunk/src/layout.c  2009-03-21 19:51:07 UTC (rev 1569)
@@ -59,8 +59,8 @@
 
 
 GList *layout_window_list = NULL;
+LayoutWindow *current_lw = NULL;
 
-
 static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar 
*needle);
 
 
@@ -74,10 +74,10 @@
 {
        if (*lw == NULL)
                {
-               if (layout_window_list) *lw = layout_window_list->data;
+               if (current_lw) *lw = current_lw;
+               else if (layout_window_list) *lw = layout_window_list->data;
                return (*lw != NULL);
                }
-
        return (g_list_find(layout_window_list, *lw) != NULL);
 }
 
@@ -119,6 +119,14 @@
        GList *work;
 
        if (!id || !id[0]) return NULL;
+       
+       if (strcmp(id, LAYOUT_ID_CURRENT) == 0)
+               {
+               if (current_lw) return current_lw;
+               if (layout_window_list) return layout_window_list->data;
+               return NULL;
+               }
+
        work = layout_window_list;
        while (work)
                {
@@ -160,6 +168,13 @@
                }
 }
 
+static gboolean layout_set_current_cb(GtkWidget *widget, GdkEventFocus *event, 
gpointer data)
+{
+       LayoutWindow *lw = data;
+       current_lw = lw;
+       return FALSE;
+}
+
 /*
  *-----------------------------------------------------------------------------
  * menu, toolbar, and dir view
@@ -2203,6 +2218,7 @@
        if (!lw) return;
 
        layout_window_list = g_list_remove(layout_window_list, lw);
+       if (current_lw == lw) current_lw = NULL;
 
        if (lw->exif_window) 
g_signal_handlers_disconnect_matched(G_OBJECT(lw->exif_window), 
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, lw);
                
@@ -2321,6 +2337,9 @@
        g_signal_connect(G_OBJECT(lw->window), "delete_event",
                         G_CALLBACK(layout_delete_cb), lw);
 
+       g_signal_connect(G_OBJECT(lw->window), "focus-in-event",
+                        G_CALLBACK(layout_set_current_cb), lw);
+
        layout_keyboard_init(lw, lw->window);
 
 #ifdef HAVE_LIRC
@@ -2441,6 +2460,7 @@
 
 void layout_load_attributes(LayoutOptions *layout, const gchar 
**attribute_names, const gchar **attribute_values)
 {
+       gchar *id = NULL;
        
        while (*attribute_names)
                {
@@ -2448,7 +2468,7 @@
                const gchar *value = *attribute_values++;
 
                /* layout options */
-               if (READ_CHAR(*layout, id)) continue;
+               if (READ_CHAR_FULL("id", id)) continue;
 
                if (READ_INT(*layout, style)) continue;
                if (READ_CHAR(*layout, order)) continue;
@@ -2490,7 +2510,15 @@
 
                log_printf("unknown attribute %s = %s\n", option, value);
                }
-
+       if (id && strcmp(id, LAYOUT_ID_CURRENT) != 0)
+               {
+               g_free(layout->id);
+               layout->id = id;
+               }
+       else
+               {
+               g_free(id);
+               }
 }
 
 static void layout_config_commandline(LayoutOptions *lop, gchar **path)

Modified: trunk/src/layout.h
===================================================================
--- trunk/src/layout.h  2009-03-21 18:22:04 UTC (rev 1568)
+++ trunk/src/layout.h  2009-03-21 19:51:07 UTC (rev 1569)
@@ -13,6 +13,7 @@
 #ifndef LAYOUT_H
 #define LAYOUT_H
 
+#define LAYOUT_ID_CURRENT "_current_"
 
 extern GList *layout_window_list;
 


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

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to