Made _moo_icon_view_selected_foreach() robust against selection changes during iterating
This commit is contained in:
parent
9339da4221
commit
7ae13cf245
4
moo.mprj
4
moo.mprj
@ -10,6 +10,7 @@
|
||||
<configure>
|
||||
<args>--enable-debug=full --enable-all-warnings --enable-libmoo --with-mooterm</args>
|
||||
<vars>
|
||||
<var name="CC">gcc-3.4</var>
|
||||
<var name="CFLAGS">-g</var>
|
||||
</vars>
|
||||
</configure>
|
||||
@ -31,12 +32,13 @@
|
||||
<configure>
|
||||
<args>--enable-all-warnings</args>
|
||||
<vars>
|
||||
<var name="CC">gcc-3.4</var>
|
||||
<var name="CFLAGS">-g -O2</var>
|
||||
</vars>
|
||||
</configure>
|
||||
</optimized>
|
||||
</configurations>
|
||||
<file_selector_dir>/home/muntyan/projects/moo/moo/mooapp/smclient/</file_selector_dir>
|
||||
<file_selector_dir>/home/muntyan/projects/moo/moo/mooedit/gtksourceview/upstream/</file_selector_dir>
|
||||
<run>
|
||||
<args>--g-fatal-warnings --new-app --mode=project</args>
|
||||
<exe>medit/medit</exe>
|
||||
|
16
moo/TODO
16
moo/TODO
@ -6,7 +6,6 @@
|
||||
Editor
|
||||
========
|
||||
|
||||
1. Make messages in xml parser include file name.
|
||||
2. File saving: permissions, backups, symlinks.
|
||||
3. moo_editor_save_tmp(), moo_editor_save_fake() ?
|
||||
|
||||
@ -17,18 +16,3 @@ Terminal
|
||||
0. FIX IT!
|
||||
1. Think about profiles, can they help?
|
||||
2. Terminal settings.
|
||||
|
||||
|
||||
App
|
||||
========
|
||||
|
||||
|
||||
Misc
|
||||
========
|
||||
|
||||
1. Make MooNotebook subclass GtkNotebook so stupid themes don't break.
|
||||
|
||||
|
||||
Bugs
|
||||
========
|
||||
1. HistoryList - make it load when needed.
|
||||
|
@ -17,7 +17,9 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "eggsmclient-private.h"
|
||||
#include <gtk/gtk.h>
|
||||
@ -43,7 +45,7 @@ struct _EggSMClientWin32 {
|
||||
char *state_dir;
|
||||
#endif
|
||||
|
||||
gboolean in_filter;
|
||||
guint in_filter;
|
||||
gboolean will_quit;
|
||||
gboolean will_quit_set;
|
||||
};
|
||||
@ -199,18 +201,35 @@ sm_client_win32_end_session (EggSMClient *client,
|
||||
static gboolean
|
||||
will_quit (EggSMClientWin32 *win32)
|
||||
{
|
||||
gboolean emit_quit_requested;
|
||||
|
||||
/* Will this really work? Or do we need to do something kinky like
|
||||
* arrange to have at least one WM_QUERYENDSESSION message delivered
|
||||
* to another thread and then have that thread wait for the main
|
||||
* thread to process the quit_requested signal asynchronously before
|
||||
* returning? FIXME
|
||||
*/
|
||||
win32->will_quit_set = FALSE;
|
||||
|
||||
win32->in_filter++;
|
||||
g_message ("hi there");
|
||||
|
||||
if (win32->in_filter == 1)
|
||||
{
|
||||
win32->will_quit_set = FALSE;
|
||||
g_message ("calling gtk_dialog_run in will_quit");
|
||||
gtk_dialog_run (gtk_dialog_new ());
|
||||
g_message ("done");
|
||||
egg_sm_client_quit_requested ((EggSMClient *)win32);
|
||||
}
|
||||
|
||||
while (!win32->will_quit_set)
|
||||
gtk_main_iteration ();
|
||||
|
||||
g_assert (win32->in_filter > 0);
|
||||
|
||||
if (--win32->in_filter == 0)
|
||||
win32->will_quit_set = FALSE;
|
||||
|
||||
return win32->will_quit;
|
||||
}
|
||||
|
||||
@ -224,35 +243,26 @@ egg_sm_client_win32_filter (GdkXEvent *xevent,
|
||||
MSG *msg = (MSG *)xevent;
|
||||
GdkFilterReturn retval;
|
||||
|
||||
if (win32->in_filter)
|
||||
{
|
||||
g_message ("win32->in_filter");
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
/* FIXME: I think these messages are delivered per-window, not
|
||||
* per-app, so we need to make sure we only act on them once. (Does
|
||||
* the win32 backend have client leader windows like x11?)
|
||||
*/
|
||||
|
||||
win32->in_filter = TRUE;
|
||||
|
||||
switch (msg->message)
|
||||
{
|
||||
case WM_QUERYENDSESSION:
|
||||
/* If we return GDK_FILTER_CONTINUE, the event will eventually
|
||||
* get passed on to DefWindowProc, which will return TRUE,
|
||||
* allowing the logout to continue. If we return
|
||||
* GDK_FILTER_REMOVE, then inner_window_procedure will return
|
||||
* its default value, 0, aka FALSE, causing the logout to be
|
||||
* aborted.
|
||||
*/
|
||||
retval = will_quit (win32) ? GDK_FILTER_CONTINUE : GDK_FILTER_REMOVE;
|
||||
break;
|
||||
return will_quit (win32) ? GDK_FILTER_CONTINUE : GDK_FILTER_REMOVE;
|
||||
|
||||
case WM_ENDSESSION:
|
||||
if (msg->wParam)
|
||||
{
|
||||
/* Make sure we don't spin main loop in will_quit() */
|
||||
if (win32->in_filter)
|
||||
{
|
||||
win32->will_quit_set = TRUE;
|
||||
win32->will_quit = TRUE;
|
||||
}
|
||||
|
||||
/* The session is ending */
|
||||
#ifdef VISTA
|
||||
if ((msg->lParam & ENDSESSION_CLOSEAPP) && win32->registered)
|
||||
@ -276,16 +286,11 @@ egg_sm_client_win32_filter (GdkXEvent *xevent,
|
||||
* to return, although the docs don't say what happens if you return
|
||||
* any other value.
|
||||
*/
|
||||
retval = GDK_FILTER_REMOVE;
|
||||
break;
|
||||
return GDK_FILTER_REMOVE;
|
||||
|
||||
default:
|
||||
retval = GDK_FILTER_CONTINUE;
|
||||
break;
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
win32->in_filter = FALSE;
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifdef VISTA
|
||||
|
@ -1175,10 +1175,9 @@ process_ice_messages (IceConn ice_conn)
|
||||
|
||||
case IceProcessMessagesConnectionClosed:
|
||||
return FALSE;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
g_return_val_if_reached (FALSE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -17,7 +17,9 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -2574,7 +2574,7 @@ _moo_icon_view_selected_foreach (MooIconView *view,
|
||||
gpointer data)
|
||||
{
|
||||
Selection *selection;
|
||||
GSList *link, *selected;
|
||||
GSList *l, *selected;
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
|
||||
@ -2585,15 +2585,15 @@ _moo_icon_view_selected_foreach (MooIconView *view,
|
||||
|
||||
selection = view->priv->selection;
|
||||
|
||||
for (link = selection->selected, selected = NULL; link != NULL; link = link->next)
|
||||
selected = g_slist_prepend (selected, gtk_tree_row_reference_copy (link->data));
|
||||
for (l = selection->selected, selected = NULL; l != NULL; l = l->next)
|
||||
selected = g_slist_prepend (selected, gtk_tree_row_reference_copy (l->data));
|
||||
selected = g_slist_reverse (selected);
|
||||
|
||||
while (selected)
|
||||
{
|
||||
if (gtk_tree_row_reference_valid (selected->data))
|
||||
{
|
||||
path = gtk_tree_row_reference_get_path (link->data);
|
||||
path = gtk_tree_row_reference_get_path (selected->data);
|
||||
gtk_tree_model_get_iter (view->priv->model, &iter, path);
|
||||
func (view->priv->model, path, &iter, data);
|
||||
gtk_tree_path_free (path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user