File:  [mozdev] / epiphany / eggpatch
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Jul 22 11:11:49 2003 UTC (16 years, 8 months ago) by mpeseng
Branches: MAIN
CVS tags: HEAD
*** empty log message ***

    1: ? libegg_diff
    2: ? libegg/dock
    3: ? libegg/combo/Makefile
    4: ? libegg/combo/Makefile.in
    5: ? libegg/recent-files/bonobo_view_test
    6: ? libegg/recent-files/gtk_view_test
    7: ? libegg/recent-files/populate_recent
    8: ? libegg/toolbar/test-drag
    9: ? libegg/treeviewutils/test-union
   10: Index: libegg/menu/Makefile.am
   11: ===================================================================
   12: RCS file: /cvs/gnome/libegg/libegg/menu/Makefile.am,v
   13: retrieving revision 1.11
   14: diff -u -r1.11 Makefile.am
   15: --- libegg/menu/Makefile.am	29 Jun 2003 18:11:35 -0000	1.11
   16: +++ libegg/menu/Makefile.am	22 Jul 2003 11:09:10 -0000
   17: @@ -3,8 +3,9 @@
   18:    $(EGG_CFLAGS) \
   19:    -DEGG_COMPILATION \
   20:    -DGDK_DISABLE_DEPRECATED \
   21: -  -DG_DISABLE_DEPRECATED
   22: -
   23: +  -DG_DISABLE_DEPRECATED \
   24: +  -I$(top_builddir)/libegg/toolbar \
   25: +  -I$(top_builddir)/libegg/util
   26:  
   27:  noinst_LTLIBRARIES = libegg-menu.la
   28:  
   29: Index: libegg/menu/egg-action-group.c
   30: ===================================================================
   31: RCS file: /cvs/gnome/libegg/libegg/menu/egg-action-group.c,v
   32: retrieving revision 1.6
   33: diff -u -r1.6 egg-action-group.c
   34: --- libegg/menu/egg-action-group.c	8 Jun 2002 13:00:48 -0000	1.6
   35: +++ libegg/menu/egg-action-group.c	22 Jul 2003 11:09:11 -0000
   36: @@ -1,10 +1,7 @@
   37:  #include "egg-action-group.h"
   38:  #include "egg-toggle-action.h"
   39:  #include "egg-radio-action.h"
   40: -
   41: -#ifndef _
   42: -# define _(s) (s)
   43: -#endif
   44: +#include "eggintl.h"
   45:  
   46:  static void egg_action_group_init       (EggActionGroup *self);
   47:  static void egg_action_group_class_init (EggActionGroupClass *class);
   48: Index: libegg/menu/egg-action-group.h
   49: ===================================================================
   50: RCS file: /cvs/gnome/libegg/libegg/menu/egg-action-group.h,v
   51: retrieving revision 1.3
   52: diff -u -r1.3 egg-action-group.h
   53: --- libegg/menu/egg-action-group.h	26 May 2002 09:13:37 -0000	1.3
   54: +++ libegg/menu/egg-action-group.h	22 Jul 2003 11:09:11 -0000
   55: @@ -2,7 +2,7 @@
   56:  #define EGG_ACTION_GROUP_H
   57:  
   58:  #include <gtk/gtk.h>
   59: -#include <libegg/menu/egg-action.h>
   60: +#include <egg-action.h>
   61:  
   62:  #define EGG_TYPE_ACTION_GROUP              (egg_action_group_get_type ())
   63:  #define EGG_ACTION_GROUP(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_ACTION_GROUP, EggActionGroup))
   64: Index: libegg/menu/egg-action.c
   65: ===================================================================
   66: RCS file: /cvs/gnome/libegg/libegg/menu/egg-action.c,v
   67: retrieving revision 1.17
   68: diff -u -r1.17 egg-action.c
   69: --- libegg/menu/egg-action.c	9 May 2003 15:15:27 -0000	1.17
   70: +++ libegg/menu/egg-action.c	22 Jul 2003 11:09:15 -0000
   71: @@ -1,9 +1,8 @@
   72:  #include "egg-action.h"
   73: -#include "../toolbar/eggtoolbutton.h"
   74: +#include "eggtoolbutton.h"
   75: +#include "eggtoolbar.h"
   76: +#include "eggintl.h"
   77:  
   78: -#ifndef _
   79: -# define _(s) (s)
   80: -#endif
   81:  
   82:  /* some code for making arbitrary GtkButtons that act like toolbar
   83:   * buttons */
   84: @@ -173,6 +172,8 @@
   85:  static void
   86:  egg_action_init (EggAction *action)
   87:  {
   88: +  static GtkTooltips *egg_action_tooltips = NULL;
   89: +
   90:    action->name = NULL;
   91:    action->label = NULL;
   92:    action->short_label = NULL;
   93: @@ -188,6 +189,17 @@
   94:    action->accel_quark = 0;
   95:  
   96:    action->proxies = NULL;
   97: +
   98: +  if (egg_action_tooltips == NULL)
   99: +  {
  100: +    egg_action_tooltips = gtk_tooltips_new ();
  101: +    action->tooltips = g_object_ref (egg_action_tooltips);
  102: +    gtk_object_sink (GTK_OBJECT (egg_action_tooltips));
  103: +  }
  104: +  else
  105: +  {
  106: +    action->tooltips = g_object_ref (egg_action_tooltips);
  107: +  }
  108:  }
  109:  
  110:  static void
  111: @@ -197,6 +209,8 @@
  112:  
  113:    action = EGG_ACTION (object);
  114:  
  115: +  g_object_unref (action->tooltips);
  116: +
  117:    g_free (action->name);
  118:    g_free (action->label);
  119:    g_free (action->short_label);
  120: @@ -370,6 +384,18 @@
  121:  }
  122:  
  123:  static void
  124: +egg_action_sync_tooltip (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
  125: +{
  126: +	if (action->tooltip != NULL)
  127: +	{
  128: +		egg_tool_item_set_tooltip (EGG_TOOL_ITEM (proxy),
  129: +					   action->tooltips,
  130: +					   action->tooltip,
  131: +					   NULL);
  132: +	}
  133: +}
  134: +
  135: +static void
  136:  egg_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
  137:  {
  138:    GtkWidget *label = NULL;
  139: @@ -536,6 +562,14 @@
  140:  			       G_CALLBACK (egg_action_activate), action,
  141:  			       G_CONNECT_SWAPPED);
  142:      }
  143: +
  144: +    if (EGG_IS_TOOL_ITEM (proxy))
  145: +    {
  146: +      egg_action_sync_tooltip (action, NULL, proxy);
  147: +      g_signal_connect_object (action, "notify::tooltip",
  148: +			       G_CALLBACK (egg_action_sync_tooltip),
  149: +			       proxy, 0);
  150: +    }
  151:  }
  152:  
  153:  static void
  154: @@ -566,6 +600,10 @@
  155:  
  156:    g_signal_handlers_disconnect_by_func (action,
  157:  				G_CALLBACK (egg_action_sync_stock_id), proxy);
  158: +
  159: +  g_signal_handlers_disconnect_by_func (proxy,
  160: +					G_CALLBACK (egg_action_sync_tooltip),
  161: +					action);			
  162:  
  163:    /* menu item specific synchronisers ... */
  164:    g_signal_handlers_disconnect_by_func (action,
  165: Index: libegg/menu/egg-action.h
  166: ===================================================================
  167: RCS file: /cvs/gnome/libegg/libegg/menu/egg-action.h,v
  168: retrieving revision 1.6
  169: diff -u -r1.6 egg-action.h
  170: --- libegg/menu/egg-action.h	8 Jun 2002 13:00:48 -0000	1.6
  171: +++ libegg/menu/egg-action.h	22 Jul 2003 11:09:15 -0000
  172: @@ -33,6 +33,8 @@
  173:  
  174:    /* list of proxy widgets */
  175:    GSList *proxies;
  176: +
  177: +  GtkTooltips *tooltips;
  178:  };
  179:  
  180:  struct _EggActionClass
  181: Index: libegg/menu/egg-menu-merge.c
  182: ===================================================================
  183: RCS file: /cvs/gnome/libegg/libegg/menu/egg-menu-merge.c,v
  184: retrieving revision 1.26
  185: diff -u -r1.26 egg-menu-merge.c
  186: --- libegg/menu/egg-menu-merge.c	20 Apr 2003 14:28:50 -0000	1.26
  187: +++ libegg/menu/egg-menu-merge.c	22 Jul 2003 11:09:20 -0000
  188: @@ -1,11 +1,8 @@
  189:  #include <string.h>
  190:  #include "egg-menu-merge.h"
  191: -#include "../toolbar/eggtoolbar.h"
  192: -#include "../toolbar/eggseparatortoolitem.h"
  193: -
  194: -#ifndef _
  195: -#  define _(string) (string)
  196: -#endif
  197: +#include "eggtoolbar.h"
  198: +#include "eggseparatortoolitem.h"
  199: +#include "eggintl.h"
  200:  
  201:  #define NODE_INFO(node) ((EggMenuMergeNode *)node->data)
  202:  
  203: @@ -75,9 +72,30 @@
  204:    return type;
  205:  }
  206:  
  207: +static GObjectClass *parent_class = NULL;
  208: +
  209: +static void
  210: +egg_menu_merge_finalize (GObject *object)
  211: +{
  212: +  EggMenuMerge *merge;
  213: +
  214: +  merge = EGG_MENU_MERGE (object);
  215: +  if (merge->update_tag != 0)
  216: +    {
  217: +      g_source_remove(merge->update_tag);
  218: +    }
  219: +}
  220: +
  221:  static void
  222:  egg_menu_merge_class_init (EggMenuMergeClass *class)
  223:  {
  224: +  GObjectClass *object_class;
  225: +
  226: +  parent_class = g_type_class_peek_parent (class);
  227: +  object_class = G_OBJECT_CLASS(class);
  228: +
  229: +  object_class->finalize     = egg_menu_merge_finalize;
  230: +
  231:    if (!merge_node_chunk)
  232:      merge_node_chunk = g_mem_chunk_create(EggMenuMergeNode, 64,
  233:  					  G_ALLOC_AND_FREE);
  234: @@ -198,14 +216,6 @@
  235:  		  /* if undecided about node type, set it */
  236:  		  if (NODE_INFO(child)->type == EGG_MENU_MERGE_UNDECIDED)
  237:  		    NODE_INFO(child)->type = node_type;
  238: -		  
  239: -		  /* warn about type mismatch */
  240: -		  if (NODE_INFO(child)->type != EGG_MENU_MERGE_UNDECIDED &&
  241: -		      NODE_INFO(child)->type != node_type)
  242: -		    g_warning("node type doesn't match %d (%s is type %d)",
  243: -			      node_type, NODE_INFO(child)->name,
  244: -			      NODE_INFO(child)->type);
  245: -		  
  246:  		  return child;
  247:  		}
  248:  	    }
  249: @@ -690,7 +700,7 @@
  250:  
  251:  guint
  252:  egg_menu_merge_add_ui_from_string (EggMenuMerge *self,
  253: -				   const gchar *buffer, guint length,
  254: +				   const gchar *buffer, size_t length,
  255:  				   GError **error)
  256:  {
  257:    ParseContext ctx = { 0 };
  258: @@ -732,7 +742,7 @@
  259:  				 GError **error)
  260:  {
  261:    gchar *buffer;
  262: -  gint length;
  263: +  size_t length;
  264:    guint res;
  265:  
  266:    if (!g_file_get_contents (filename, &buffer, &length, error))
  267: @@ -935,15 +945,10 @@
  268:  
  269:    info = NODE_INFO(node);
  270:  
  271: -  g_print("update_node name=%s dirty=%d (", info->name, info->dirty);
  272:    for (tmp = info->uifiles; tmp != NULL; tmp = tmp->next)
  273:      {
  274:        NodeUIReference *ref = tmp->data;
  275: -      g_print("%s:%u", g_quark_to_string(ref->action_quark), ref->merge_id);
  276: -      if (tmp->next)
  277: -	g_print(", ");
  278:      }
  279: -  g_print(")\n");
  280:  
  281:    if (NODE_INFO(node)->dirty)
  282:      {
  283: @@ -984,11 +989,7 @@
  284:  	  goto recurse_children;
  285:  	}
  286:        
  287: -      if (info->action)
  288: -	g_object_unref (info->action);
  289:        info->action = action;
  290: -      if (info->action)
  291: -	g_object_ref (info->action);
  292:  
  293:        switch (info->type)
  294:  	{
  295: @@ -1022,8 +1023,15 @@
  296:  	      {
  297:  		GtkWidget *menushell;
  298:  		gint pos;
  299: +		GNode *parent;
  300:  
  301: -		if (find_menu_position(node, &menushell, &pos))
  302: +		parent = node->parent;
  303: +
  304: +		if (parent && NODE_INFO (parent)->type == EGG_MENU_MERGE_POPUPS)
  305: +		  {
  306: +		    info->proxy = gtk_menu_new();
  307: +		  }
  308: +		else if (find_menu_position(node, &menushell, &pos))
  309:  		  {
  310:  		    GtkWidget *menu;
  311:  		    info->proxy = egg_action_create_menu_item (info->action);
  312: @@ -1255,6 +1263,7 @@
  313:  	   NODE_INFO(node)->type == EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER) &&
  314:  	  NODE_INFO(node)->extra)
  315:  	gtk_widget_destroy(NODE_INFO(node)->extra);
  316: +      g_free (NODE_INFO(node)->name);
  317:        g_chunk_free(NODE_INFO(node), merge_node_chunk);
  318:        g_node_destroy(node);
  319:      }
  320: @@ -1275,8 +1284,6 @@
  321:     *    the proxy is reconnected to the new action (or a new proxy widget
  322:     *    is created and added to the parent container).
  323:     */
  324: -
  325: -  g_message("do_updates");
  326:  
  327:    update_node (self, self->root_node);
  328:  
  329: Index: libegg/menu/egg-menu-merge.h
  330: ===================================================================
  331: RCS file: /cvs/gnome/libegg/libegg/menu/egg-menu-merge.h,v
  332: retrieving revision 1.7
  333: diff -u -r1.7 egg-menu-merge.h
  334: --- libegg/menu/egg-menu-merge.h	7 Sep 2002 03:41:14 -0000	1.7
  335: +++ libegg/menu/egg-menu-merge.h	22 Jul 2003 11:09:22 -0000
  336: @@ -4,8 +4,8 @@
  337:  #include <glib.h>
  338:  #include <glib-object.h>
  339:  
  340: -#include <libegg/menu/egg-action.h>
  341: -#include <libegg/menu/egg-action-group.h>
  342: +#include <egg-action.h>
  343: +#include <egg-action-group.h>
  344:  
  345:  #define EGG_TYPE_MENU_MERGE            (egg_menu_merge_get_type ())
  346:  #define EGG_MENU_MERGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_MENU_MERGE, EggMenuMerge))
  347: @@ -55,7 +55,7 @@
  348:  struct _EggMenuMergeNode {
  349:    EggMenuMergeNodeType type;
  350:  
  351: -  const gchar *name;
  352: +  gchar *name;
  353:  
  354:    GQuark action_name;
  355:    EggAction *action;
  356: @@ -86,7 +86,7 @@
  357:   * interface */
  358:  guint         egg_menu_merge_add_ui_from_string  (EggMenuMerge *self,
  359:  						  const gchar *buffer,
  360: -						  guint length,
  361: +						  size_t length,
  362:  						  GError **error);
  363:  guint         egg_menu_merge_add_ui_from_file    (EggMenuMerge *self,
  364:  						  const gchar *filename,
  365: Index: libegg/menu/egg-radio-action.c
  366: ===================================================================
  367: RCS file: /cvs/gnome/libegg/libegg/menu/egg-radio-action.c,v
  368: retrieving revision 1.3
  369: diff -u -r1.3 egg-radio-action.c
  370: --- libegg/menu/egg-radio-action.c	14 Sep 2002 20:24:32 -0000	1.3
  371: +++ libegg/menu/egg-radio-action.c	22 Jul 2003 11:09:22 -0000
  372: @@ -1,4 +1,5 @@
  373:  #include "egg-radio-action.h"
  374: +#include "eggradiotoolbutton.h"
  375:  
  376:  static void egg_radio_action_init       (EggRadioAction *action);
  377:  static void egg_radio_action_class_init (EggRadioActionClass *class);
  378: @@ -45,6 +46,9 @@
  379:    parent_class = g_type_class_peek_parent (class);
  380:    object_class = G_OBJECT_CLASS (class);
  381:    action_class = EGG_ACTION_CLASS (class);
  382: +
  383: +  action_class->menu_item_type = GTK_TYPE_RADIO_MENU_ITEM;
  384: +  action_class->toolbar_item_type = EGG_TYPE_RADIO_TOOL_BUTTON;
  385:  
  386:    object_class->finalize = egg_radio_action_finalize;
  387:  
  388: Index: libegg/menu/egg-radio-action.h
  389: ===================================================================
  390: RCS file: /cvs/gnome/libegg/libegg/menu/egg-radio-action.h,v
  391: retrieving revision 1.1
  392: diff -u -r1.1 egg-radio-action.h
  393: --- libegg/menu/egg-radio-action.h	27 Apr 2002 12:57:27 -0000	1.1
  394: +++ libegg/menu/egg-radio-action.h	22 Jul 2003 11:09:22 -0000
  395: @@ -2,8 +2,8 @@
  396:  #define EGG_RADIO_ACTION_H
  397:  
  398:  #include <gtk/gtk.h>
  399: -#include <libegg/menu/egg-action.h>
  400: -#include <libegg/menu/egg-toggle-action.h>
  401: +#include <egg-action.h>
  402: +#include <egg-toggle-action.h>
  403:  
  404:  #define EGG_TYPE_RADIO_ACTION            (egg_radio_action_get_type ())
  405:  #define EGG_RADIO_ACTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_RADIO_ACTION, EggRadioAction))
  406: Index: libegg/menu/egg-toggle-action.c
  407: ===================================================================
  408: RCS file: /cvs/gnome/libegg/libegg/menu/egg-toggle-action.c,v
  409: retrieving revision 1.6
  410: diff -u -r1.6 egg-toggle-action.c
  411: --- libegg/menu/egg-toggle-action.c	6 Sep 2002 14:13:44 -0000	1.6
  412: +++ libegg/menu/egg-toggle-action.c	22 Jul 2003 11:09:22 -0000
  413: @@ -1,5 +1,5 @@
  414:  #include "egg-toggle-action.h"
  415: -#include "../toolbar/eggtoggletoolbutton.h"
  416: +#include "eggtoggletoolbutton.h"
  417:  
  418:  enum {
  419:    TOGGLED,
  420: Index: libegg/menu/egg-toggle-action.h
  421: ===================================================================
  422: RCS file: /cvs/gnome/libegg/libegg/menu/egg-toggle-action.h,v
  423: retrieving revision 1.1
  424: diff -u -r1.1 egg-toggle-action.h
  425: --- libegg/menu/egg-toggle-action.h	27 Apr 2002 12:57:27 -0000	1.1
  426: +++ libegg/menu/egg-toggle-action.h	22 Jul 2003 11:09:22 -0000
  427: @@ -2,7 +2,7 @@
  428:  #define EGG_TOGGLE_ACTION_H
  429:  
  430:  #include <gtk/gtk.h>
  431: -#include <libegg/menu/egg-action.h>
  432: +#include <egg-action.h>
  433:  
  434:  #define EGG_TYPE_TOGGLE_ACTION            (egg_toggle_action_get_type ())
  435:  #define EGG_TOGGLE_ACTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TOGGLE_ACTION, EggToggleAction))
  436: Index: libegg/menu/test-merge.c
  437: ===================================================================
  438: RCS file: /cvs/gnome/libegg/libegg/menu/test-merge.c,v
  439: retrieving revision 1.16
  440: diff -u -r1.16 test-merge.c
  441: --- libegg/menu/test-merge.c	5 Oct 2002 08:03:53 -0000	1.16
  442: +++ libegg/menu/test-merge.c	22 Jul 2003 11:09:24 -0000
  443: @@ -81,11 +81,11 @@
  444:    { "StockHelpMenuAction", N_("_Help"), NULL, NULL, NULL, NULL, NULL },
  445:    { "Test", N_("Test"), NULL, NULL, NULL, NULL, NULL },
  446:  
  447: -  { "NewAction", NULL, GTK_STOCK_NEW, "<control>n", NULL,
  448: +  { "NewAction", NULL, GTK_STOCK_NEW, "F1", NULL,
  449:      G_CALLBACK (activate_action), NULL },
  450:    { "New2Action", NULL, GTK_STOCK_NEW, "<control>m", NULL,
  451:      G_CALLBACK (activate_action), NULL },
  452: -  { "OpenAction", NULL, GTK_STOCK_OPEN, "<control>o", NULL,
  453: +  { "OpenAction", NULL, GTK_STOCK_OPEN, "h", NULL,
  454:      G_CALLBACK (activate_action), NULL },
  455:    { "QuitAction", NULL, GTK_STOCK_QUIT, "<control>q", NULL,
  456:      G_CALLBACK (gtk_main_quit), NULL },
  457: Index: libegg/toolbar/eggtoolbar.c
  458: ===================================================================
  459: RCS file: /cvs/gnome/libegg/libegg/toolbar/eggtoolbar.c,v
  460: retrieving revision 1.59
  461: diff -u -r1.59 eggtoolbar.c
  462: --- libegg/toolbar/eggtoolbar.c	29 Jun 2003 18:11:36 -0000	1.59
  463: +++ libegg/toolbar/eggtoolbar.c	22 Jul 2003 11:09:36 -0000
  464: @@ -36,7 +36,7 @@
  465:  #include <gtk/gtktoolbar.h>
  466:  #include <gtk/gtkbindings.h>
  467:  #include <gdk/gdkkeysyms.h>
  468: -#include "../util/eggmarshalers.h"
  469: +#include "eggmarshalers.h"
  470:  #include <gtk/gtkmain.h>
  471:  #include <gtk/gtkstock.h>
  472:  #include <gtk/gtklabel.h>
  473: @@ -82,6 +82,7 @@
  474:  };
  475:  
  476:  static void egg_toolbar_init       (EggToolbar      *toolbar);
  477: +static void egg_toolbar_finalize   (GObject         *object);
  478:  static void egg_toolbar_class_init (EggToolbarClass *klass);
  479:  
  480:  static void egg_toolbar_set_property (GObject      *object,
  481: @@ -283,6 +284,7 @@
  482:    
  483:    gobject_class->set_property = egg_toolbar_set_property;
  484:    gobject_class->get_property = egg_toolbar_get_property;
  485: +  gobject_class->finalize = egg_toolbar_finalize;
  486:  
  487:    widget_class->button_press_event = egg_toolbar_button_press;
  488:    widget_class->expose_event = egg_toolbar_expose;
  489: @@ -486,6 +488,18 @@
  490:  
  491:    add_ctrl_tab_bindings (binding_set, 0, GTK_DIR_RIGHT);
  492:    add_ctrl_tab_bindings (binding_set, GDK_SHIFT_MASK, GTK_DIR_LEFT);
  493: +}
  494: +
  495: +static void
  496: +egg_toolbar_finalize (GObject *object)
  497: +{
  498: +  EggToolbar *toolbar = EGG_TOOLBAR (object);
  499: +  GList *list;
  500: +
  501: +  if (toolbar->tooltips)
  502: +    g_object_unref (GTK_OBJECT (toolbar->tooltips));
  503: +
  504: +  G_OBJECT_CLASS (parent_class)->finalize (object);
  505:  }
  506:  
  507:  static void
  508: Index: libegg/toolbar/eggtoolbutton.c
  509: ===================================================================
  510: RCS file: /cvs/gnome/libegg/libegg/toolbar/eggtoolbutton.c,v
  511: retrieving revision 1.34
  512: diff -u -r1.34 eggtoolbutton.c
  513: --- libegg/toolbar/eggtoolbutton.c	29 Jun 2003 18:11:36 -0000	1.34
  514: +++ libegg/toolbar/eggtoolbutton.c	22 Jul 2003 11:09:38 -0000
  515: @@ -513,6 +513,15 @@
  516:    g_free (button->stock_id);
  517:    button->stock_id = NULL;
  518:  
  519: +  g_free (button->label_text);
  520: +  button->label_text = NULL;
  521: +
  522: +  if (button->label_widget)
  523: +    g_object_unref (G_OBJECT (button->label_widget));
  524: +
  525: +  if (button->icon_widget)
  526: +    g_object_unref (G_OBJECT (button->icon_widget));
  527: +
  528:    parent_class->finalize (object);
  529:  }
  530:  
  531: Index: libegg/toolbar/gtkexample.c
  532: ===================================================================
  533: RCS file: /cvs/gnome/libegg/libegg/toolbar/gtkexample.c,v
  534: retrieving revision 1.2
  535: diff -u -r1.2 gtkexample.c
  536: --- libegg/toolbar/gtkexample.c	28 Apr 2003 16:19:41 -0000	1.2
  537: +++ libegg/toolbar/gtkexample.c	22 Jul 2003 11:09:41 -0000
  538: @@ -199,14 +199,12 @@
  539:  set_toolbar_enable (GtkWidget *widget,
  540:  		    gpointer   data)
  541:  {
  542: -  egg_toolbar_set_tooltips (EGG_TOOLBAR (data), TRUE);
  543:  }
  544:  
  545:  static void
  546:  set_toolbar_disable (GtkWidget *widget,
  547:  		     gpointer   data)
  548:  {
  549: -  egg_toolbar_set_tooltips (EGG_TOOLBAR (data), FALSE);
  550:  }
  551:  
  552:  static void
  553: @@ -284,15 +282,6 @@
  554:  
  555:        egg_toolbar_append_space (EGG_TOOLBAR (toolbar));
  556:  
  557: -      egg_toolbar_append_item (EGG_TOOLBAR (toolbar),
  558: -			       "Enable", "Enable tooltips", NULL,
  559: -			       new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
  560: -			       G_CALLBACK (set_toolbar_enable), toolbar);
  561: -      egg_toolbar_append_item (EGG_TOOLBAR (toolbar),
  562: -			       "Disable", "Disable tooltips", NULL,
  563: -			       new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
  564: -			       G_CALLBACK (set_toolbar_disable), toolbar);
  565: -
  566:        egg_toolbar_append_space (EGG_TOOLBAR (toolbar));
  567:  
  568:        egg_toolbar_append_item (EGG_TOOLBAR (toolbar),
  569: @@ -369,15 +358,6 @@
  570:  			   NULL, toolbar);
  571:  
  572:    egg_toolbar_append_space (EGG_TOOLBAR (toolbar));
  573: -
  574: -  egg_toolbar_append_item (EGG_TOOLBAR (toolbar),
  575: -			   "Enable", "Enable tooltips", NULL,
  576: -			   new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
  577: -			   G_CALLBACK (set_toolbar_enable), toolbar);
  578: -  egg_toolbar_append_item (EGG_TOOLBAR (toolbar),
  579: -			   "Disable", "Disable tooltips", NULL,
  580: -			   new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
  581: -			   G_CALLBACK (set_toolbar_disable), toolbar);
  582:  
  583:    egg_toolbar_append_space (EGG_TOOLBAR (toolbar));
  584:    
  585: Index: libegg/toolbar/test-drag.c
  586: ===================================================================
  587: RCS file: /cvs/gnome/libegg/libegg/toolbar/test-drag.c,v
  588: retrieving revision 1.5
  589: diff -u -r1.5 test-drag.c
  590: --- libegg/toolbar/test-drag.c	19 Apr 2003 12:42:10 -0000	1.5
  591: +++ libegg/toolbar/test-drag.c	22 Jul 2003 11:09:41 -0000
  592: @@ -69,7 +69,7 @@
  593:  main (int argc, char **argv)
  594:  {
  595:    GtkWidget *window;
  596: -  GtkWidget *toolbar;
  597: +  GtkWidget *toolbar, *box, *box1;
  598:    EggToolItem *item;
  599:    GtkWidget *entry;
  600:    gint i;
  601: @@ -80,10 +80,58 @@
  602:    gtk_window_set_default_size (GTK_WINDOW (window), 600, -1);
  603:  
  604:    g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
  605: +box1 = gtk_vbox_new (FALSE, 0);
  606: +gtk_container_add (window, box1);
  607: +
  608: +box = gtk_vbox_new (FALSE, 0);
  609: +gtk_box_pack_start (box1, box, FALSE, FALSE, 0);
  610: +gtk_widget_show (box);
  611: +toolbar = egg_toolbar_new();
  612: +  egg_toolbar_set_show_arrow (EGG_TOOLBAR (toolbar), TRUE);
  613: +  gtk_box_pack_start (GTK_CONTAINER (box), toolbar, FALSE, FALSE, 0);
  614: +
  615: +  gtk_drag_dest_set (toolbar, GTK_DEST_DEFAULT_DROP,
  616: +		     target_table, G_N_ELEMENTS (target_table),
  617: +		     GDK_ACTION_COPY | GDK_ACTION_MOVE);
  618: +  g_signal_connect (toolbar, "drag_drop",
  619: +		    G_CALLBACK (toolbar_drop), NULL);
  620: +
  621: +  for (i = 0; i < G_N_ELEMENTS (tool_items); i++)
  622: +    {
  623: +      if (tool_items[i])
  624: +	item = egg_tool_button_new_from_stock (tool_items[i]);
  625: +      else
  626: +	item = egg_separator_tool_item_new ();
  627: +
  628: +      egg_tool_item_set_use_drag_window (EGG_TOOL_ITEM (item), TRUE);
  629: +      egg_toolbar_insert (EGG_TOOLBAR (toolbar), item, -1);
  630: +      gtk_drag_source_set (GTK_WIDGET (item),
  631: +			   GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
  632: +			   target_table, G_N_ELEMENTS (target_table),
  633: +			   GDK_ACTION_COPY | GDK_ACTION_MOVE);
  634: +      g_signal_connect (item, "drag_begin",
  635: +			G_CALLBACK (toolitem_drag_begin), NULL);
  636: +    }
  637: +
  638: +  item = egg_tool_item_new();
  639: +  egg_tool_item_set_homogeneous (item, FALSE);
  640: +  egg_tool_item_set_expand (item, TRUE);
  641: +  entry = gtk_entry_new();
  642: +  gtk_container_add (GTK_CONTAINER (item), entry);
  643: +
  644: +  egg_tool_item_set_use_drag_window (EGG_TOOL_ITEM (item), TRUE);
  645: +  egg_toolbar_insert (EGG_TOOLBAR (toolbar), item, -1);
  646: +  gtk_drag_source_set (GTK_WIDGET (item),
  647: +		       GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
  648: +		       target_table, G_N_ELEMENTS (target_table),
  649: +		       GDK_ACTION_COPY | GDK_ACTION_MOVE);
  650: +  g_signal_connect (item, "drag_begin",
  651: +		    G_CALLBACK (toolitem_drag_begin), NULL);
  652: +
  653:  
  654:    toolbar = egg_toolbar_new();
  655:    egg_toolbar_set_show_arrow (EGG_TOOLBAR (toolbar), TRUE);
  656: -  gtk_container_add (GTK_CONTAINER (window), toolbar);
  657: +  gtk_box_pack_start (GTK_CONTAINER (box), toolbar, FALSE, FALSE, 0);
  658:  
  659:    gtk_drag_dest_set (toolbar, GTK_DEST_DEFAULT_DROP,
  660:  		     target_table, G_N_ELEMENTS (target_table),
  661: Index: libegg/toolbar/test-toolbar.c
  662: ===================================================================
  663: RCS file: /cvs/gnome/libegg/libegg/toolbar/test-toolbar.c,v
  664: retrieving revision 1.25
  665: diff -u -r1.25 test-toolbar.c
  666: --- libegg/toolbar/test-toolbar.c	29 Jun 2003 13:25:58 -0000	1.25
  667: +++ libegg/toolbar/test-toolbar.c	22 Jul 2003 11:09:43 -0000
  668: @@ -379,6 +379,7 @@
  669:    gtk_container_add (GTK_CONTAINER (window), table);
  670:  
  671:    toolbar = egg_toolbar_new ();
  672: +  egg_toolbar_get_nth_item (EGG_TOOLBAR (toolbar), 1);
  673:    gtk_table_attach (GTK_TABLE (table), toolbar,
  674:  		    0,2, 0,1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
  675:  
  676: Index: libegg/treeviewutils/eggtreemodelfilter.c
  677: ===================================================================
  678: RCS file: /cvs/gnome/libegg/libegg/treeviewutils/eggtreemodelfilter.c,v
  679: retrieving revision 1.9
  680: diff -u -r1.9 eggtreemodelfilter.c
  681: --- libegg/treeviewutils/eggtreemodelfilter.c	18 Apr 2003 19:21:18 -0000	1.9
  682: +++ libegg/treeviewutils/eggtreemodelfilter.c	22 Jul 2003 11:09:54 -0000
  683: @@ -182,15 +182,19 @@
  684:                                                                             gboolean            build_levels,
  685:                                                                             gboolean            fetch_childs);
  686:  
  687: -static gboolean     egg_tree_model_filter_fetch_child         (EggTreeModelFilter *filter,
  688: +static FilterElt   *egg_tree_model_filter_fetch_child         (EggTreeModelFilter *filter,
  689:  						               FilterLevel        *level,
  690: -						               gint                offset);
  691: +						               gint                offset,
  692: +							       gint               *index);
  693:  static void         egg_tree_model_filter_remove_node         (EggTreeModelFilter *filter,
  694:  					                       GtkTreeIter        *iter,
  695:  					                       gboolean            emit_signal);
  696:  static void         egg_tree_model_filter_update_childs       (EggTreeModelFilter *filter,
  697:  						               FilterLevel        *level,
  698:  						               FilterElt          *elt);
  699: +static FilterElt   *bsearch_elt_with_offset                   (GArray             *array,
  700: +                                                               gint                offset,
  701: +                                                               gint               *index);
  702:  
  703:  
  704:  static GObjectClass *parent_class = NULL;
  705: @@ -659,12 +663,14 @@
  706:      }
  707:  }
  708:  
  709: -static gboolean
  710: +static FilterElt *
  711:  egg_tree_model_filter_fetch_child (EggTreeModelFilter *filter,
  712:  				   FilterLevel        *level,
  713: -				   gint                offset)
  714: +				   gint                offset,
  715: +                                   gint               *index)
  716:  {
  717:    gint i = 0;
  718: +  gint start, middle, end;
  719:    gint len;
  720:    GtkTreePath *c_path = NULL;
  721:    GtkTreeIter c_iter;
  722: @@ -680,7 +686,7 @@
  723:  					    level->parent_elt,
  724:  					    filter->virtual_root);
  725:        if (!c_parent_path)
  726: -	return FALSE;
  727: +	return NULL;
  728:      }
  729:    else
  730:      {
  731: @@ -712,7 +718,7 @@
  732:    gtk_tree_path_free (c_path);
  733:  
  734:    if (offset >= len || !egg_tree_model_filter_visible (filter, &c_iter))
  735: -    return FALSE;
  736: +    return NULL;
  737:  
  738:    /* add child */
  739:    elt.offset = offset;
  740: @@ -725,21 +731,41 @@
  741:    if (EGG_TREE_MODEL_FILTER_CACHE_CHILD_ITERS (filter))
  742:      elt.iter = c_iter;
  743:  
  744: -  /* find index */
  745: -  for (i = 0; i < level->array->len; i++)
  746: -    if (g_array_index (level->array, FilterElt, i).offset > offset)
  747: -      break;
  748: +  /* find index (binary search on offset) */
  749: +  start = 0;
  750: +  end = level->array->len;
  751: +
  752: +  if (start != end)
  753: +    {
  754: +      while (start != end)
  755: +        {
  756: +          middle = (start + end) / 2;
  757: +
  758: +          if (g_array_index (level->array, FilterElt, middle).offset <= offset)
  759: +            start = middle + 1;
  760: +          else
  761: +            end = middle;
  762: +        }
  763: +
  764: +      if (g_array_index (level->array, FilterElt, middle).offset <= offset)
  765: +        i = middle + 1;
  766: +      else
  767: +        i = middle;
  768: +    }
  769: +  else
  770: +    i = 0;
  771:  
  772:    g_array_insert_val (level->array, i, elt);
  773: +  *index = i;
  774:  
  775: -  for (i = 0; i < level->array->len; i++)
  776: +  for (i = MAX (--i, 0); i < level->array->len; i++)
  777:      {
  778:        FilterElt *e = &(g_array_index (level->array, FilterElt, i));
  779:        if (e->children)
  780:  	e->children->parent_elt = e;
  781:      }
  782:  
  783: -  return TRUE;
  784: +  return &g_array_index (level->array, FilterElt, *index);
  785:  }
  786:  
  787:  static void
  788: @@ -799,21 +825,24 @@
  789:      }
  790:    else
  791:      {
  792: -      /* remove the node */
  793: -      for (i = 0; i < level->array->len; i++)
  794: -        if (elt->offset == g_array_index (level->array, FilterElt, i).offset)
  795: -          break;
  796: +      FilterElt *tmp;
  797:  
  798: -      g_array_remove_index (level->array, i);
  799: +      /* remove the node */
  800: +      tmp = bsearch_elt_with_offset (level->array, elt->offset, &i);
  801:  
  802: -      for (i = 0; i < level->array->len; i++)
  803: +      if (tmp)
  804:          {
  805: -          /* NOTE: here we do *not* decrease offsets, because the node was
  806: -           * not removed from the child model
  807: -           */
  808: -          elt = &g_array_index (level->array, FilterElt, i);
  809: -          if (elt->children)
  810: -	    elt->children->parent_elt = elt;
  811: +          g_array_remove_index (level->array, i);
  812: +
  813: +          for (i = MAX (--i, 0); i < level->array->len; i++)
  814: +            {
  815: +              /* NOTE: here we do *not* decrease offsets, because the node was
  816: +               * not removed from the child model
  817: +               */
  818: +              elt = &g_array_index (level->array, FilterElt, i);
  819: +              if (elt->children)
  820: +	        elt->children->parent_elt = elt;
  821: +            }
  822:          }
  823:      }
  824:  
  825: @@ -870,6 +899,56 @@
  826:      }
  827:  }
  828:  
  829: +static FilterElt *
  830: +bsearch_elt_with_offset (GArray *array,
  831: +                         gint    offset,
  832: +                         gint   *index)
  833: +{
  834: +  gint start, middle, end;
  835: +  FilterElt *elt;
  836: +
  837: +  start = 0;
  838: +  end = array->len;
  839: +
  840: +  if (array->len < 1)
  841: +    return NULL;
  842: +
  843: +  if (start == end)
  844: +    {
  845: +      elt = &g_array_index (array, FilterElt, 0);
  846: +
  847: +      if (elt->offset == offset)
  848: +        {
  849: +          *index = 0;
  850: +          return elt;
  851: +        }
  852: +      else
  853: +        return NULL;
  854: +    }
  855: +
  856: +  while (start != end)
  857: +    {
  858: +      middle = (start + end) / 2;
  859: +
  860: +      elt = &g_array_index (array, FilterElt, middle);
  861: +
  862: +      if (elt->offset < offset)
  863: +        start = middle + 1;
  864: +      else if (elt->offset > offset)
  865: +        end = middle;
  866: +      else
  867: +        break;
  868: +    }
  869: +
  870: +  if (elt->offset == offset)
  871: +    {
  872: +      *index = middle;
  873: +      return elt;
  874: +    }
  875: +
  876: +  return NULL;
  877: +}
  878: +
  879:  /* TreeModel signals */
  880:  static void
  881:  egg_tree_model_filter_row_changed (GtkTreeModel *c_model,
  882: @@ -879,14 +958,15 @@
  883:  {
  884:    EggTreeModelFilter *filter = EGG_TREE_MODEL_FILTER (data);
  885:    GtkTreeIter iter;
  886: +  GtkTreeIter childs;
  887:    GtkTreeIter real_c_iter;
  888: -  GtkTreePath *path;
  889: +  GtkTreePath *path = NULL;
  890:  
  891:    FilterElt *elt;
  892:    FilterLevel *level;
  893: -  gint offset;
  894:  
  895: -  gboolean new;
  896: +  gboolean requested_state;
  897: +  gboolean current_state;
  898:    gboolean free_c_path = FALSE;
  899:  
  900:    g_return_if_fail (c_path != NULL || c_iter != NULL);
  901: @@ -902,21 +982,72 @@
  902:    else
  903:      gtk_tree_model_get_iter (c_model, &real_c_iter, c_path);
  904:  
  905: +  /* what's the requested state? */
  906: +  requested_state = egg_tree_model_filter_visible (filter, &real_c_iter);
  907: +
  908: +  /* now, let's see whether the item is there */
  909: +  path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
  910: +                                                                c_path,
  911: +                                                                FALSE,
  912: +                                                                FALSE);
  913: +
  914: +  if (path)
  915: +    {
  916: +      gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), &iter, path);
  917: +      current_state = FILTER_ELT (iter.user_data2)->visible;
  918: +    }
  919: +  else
  920: +    current_state = FALSE;
  921: +
  922: +  if (current_state == FALSE && requested_state == FALSE)
  923: +    /* no changes required */
  924: +    goto done;
  925: +
  926: +  if (current_state == TRUE && requested_state == FALSE)
  927: +    {
  928: +      /* get rid of this node */
  929: +      gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), &iter, path);
  930: +      egg_tree_model_filter_remove_node (filter, &iter, TRUE);
  931: +
  932: +      level = FILTER_LEVEL (iter.user_data);
  933: +
  934: +      if (!level->parent_level)
  935: +        filter->root_level_visible--;
  936: +
  937: +      goto done;
  938: +    }
  939: +
  940: +  if (current_state == TRUE && requested_state == TRUE)
  941: +    {
  942: +      /* progate the signal */
  943: +      gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), &iter, path);
  944: +      gtk_tree_model_row_changed (GTK_TREE_MODEL (filter), path, &iter);
  945: +
  946: +      level = FILTER_LEVEL (iter.user_data);
  947: +      elt = FILTER_ELT (iter.user_data2);
  948: +
  949: +      /* and update the childs */
  950: +      if (gtk_tree_model_iter_children (c_model, &childs, &real_c_iter))
  951: +        egg_tree_model_filter_update_childs (filter, level, elt);
  952: +
  953: +      goto done;
  954: +    }
  955: +
  956: +  /* only current == FALSE and requested == TRUE is left,
  957: +   * pull in the child
  958: +   */
  959: +  g_return_if_fail (current_state == FALSE && requested_state == TRUE);
  960: +
  961: +  /* make sure the new item has been pulled in */
  962:    if (!filter->root)
  963:      {
  964:        gint i;
  965:        FilterLevel *root;
  966:  
  967: -      /* build root level */
  968:        egg_tree_model_filter_build_level (filter, NULL, NULL);
  969:  
  970:        root = FILTER_LEVEL (filter->root);
  971:  
  972: -      /* FIXME:
  973: -       * we set the visibilities to FALSE here, so we ever emit
  974: -       * a row_inserted. maybe it's even better to emit row_inserted
  975: -       * here, not sure.
  976: -       */
  977:        if (root)
  978:          {
  979:            for (i = 0; i < root->array->len; i++)
  980: @@ -925,63 +1056,35 @@
  981:  	}
  982:      }
  983:  
  984: -  path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
  985: -								c_path,
  986: -								FALSE,
  987: -								TRUE);
  988:    if (!path)
  989: -    goto done;
  990: +    path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
  991: +								  c_path,
  992: +								  FALSE,
  993: +								  TRUE);
  994: +
  995: +  g_return_if_fail (path != NULL);
  996:  
  997: +  egg_tree_model_filter_increment_stamp (filter);
  998:    gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), &iter, path);
  999:  
 1000:    level = FILTER_LEVEL (iter.user_data);
 1001:    elt = FILTER_ELT (iter.user_data2);
 1002: -  offset = elt->offset;
 1003: -  new = egg_tree_model_filter_visible (filter, c_iter);
 1004:  
 1005: -  if (elt->visible == TRUE && new == FALSE)
 1006: -    {
 1007: -      egg_tree_model_filter_remove_node (filter, &iter, TRUE);
 1008: +  elt->visible = TRUE;
 1009:  
 1010: -      if (!level->parent_level)
 1011: -	filter->root_level_visible--;
 1012: -    }
 1013: -  else if (elt->visible == FALSE && new == TRUE)
 1014: -    {
 1015: -      GtkTreeIter childs;
 1016: +  if (!level->parent_level)
 1017: +    filter->root_level_visible++;
 1018:  
 1019: -      elt->visible = TRUE;
 1020: +  /* update stamp */
 1021: +  gtk_tree_model_row_inserted (GTK_TREE_MODEL (filter), path, &iter);
 1022:  
 1023: -      egg_tree_model_filter_increment_stamp (filter);
 1024: -
 1025: -      if (!level->parent_level)
 1026: -	filter->root_level_visible++;
 1027: -
 1028: -      /* update stamp */
 1029: -      gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), &iter, path);
 1030: -      gtk_tree_model_row_inserted (GTK_TREE_MODEL (filter), path, &iter);
 1031: -
 1032: -      if (gtk_tree_model_iter_children (c_model, &childs, c_iter))
 1033: -	egg_tree_model_filter_update_childs (filter, level, elt);
 1034: -    }
 1035: -  else if (elt->visible == FALSE && new == FALSE)
 1036: -    {
 1037: -      egg_tree_model_filter_remove_node (filter, &iter, FALSE);
 1038: -    }
 1039: -  else
 1040: -    {
 1041: -      GtkTreeIter childs;
 1042: -
 1043: -      gtk_tree_model_row_changed (GTK_TREE_MODEL (filter), path, &iter);
 1044: -
 1045: -      if (gtk_tree_model_iter_children (c_model, &childs, c_iter) &&
 1046: -	  elt->visible)
 1047: -	egg_tree_model_filter_update_childs (filter, level, elt);
 1048: -    }
 1049: -
 1050: -  gtk_tree_path_free (path);
 1051: +  if (gtk_tree_model_iter_children (c_model, &childs, c_iter))
 1052: +    egg_tree_model_filter_update_childs (filter, level, elt);
 1053:  
 1054:  done:
 1055: +  if (path)
 1056: +    gtk_tree_path_free (path);
 1057: +
 1058:    if (free_c_path)
 1059:      gtk_tree_path_free (c_path);
 1060:  }
 1061: @@ -1073,14 +1176,9 @@
 1062:  	    /* we don't cover this signal */
 1063:  	    goto done;
 1064:  
 1065: -	  elt = NULL;
 1066: -	  for (j = 0; j < level->array->len; j++)
 1067: -	    if (g_array_index (level->array, FilterElt, j).offset ==
 1068: -		gtk_tree_path_get_indices (real_path)[i])
 1069: -	      {
 1070: -		elt = &g_array_index (level->array, FilterElt, j);
 1071: -		break;
 1072: -	      }
 1073: +          elt = bsearch_elt_with_offset (level->array,
 1074: +                                         gtk_tree_path_get_indices (real_path)[i],
 1075: +                                         &j);
 1076:  
 1077:  	  if (!elt)
 1078:  	    /* parent is probably being filtered out */
 1079: @@ -1332,14 +1430,10 @@
 1080:  		      return;
 1081:  		    }
 1082:  
 1083: -		  elt = NULL;
 1084: -		  for (j = 0; j < level->array->len; j++)
 1085: -		    if (g_array_index (level->array, FilterElt, j).offset ==
 1086: -			gtk_tree_path_get_indices (real_path)[i])
 1087: -		      {
 1088: -			elt = &g_array_index (level->array, FilterElt, j);
 1089: -			break;
 1090: -		      }
 1091: +                  elt = bsearch_elt_with_offset (level->array,
 1092: +                                                 gtk_tree_path_get_indices (real_path)[i],
 1093: +                                                 &j);
 1094: +
 1095:  
 1096:  		  if (!elt || !elt->children)
 1097:  		    {
 1098: @@ -1414,15 +1508,15 @@
 1099:      }
 1100:    else
 1101:      {
 1102: +      FilterElt *tmp;
 1103: +
 1104:        /* remove the row */
 1105: -      for (i = 0; i < level->array->len; i++)
 1106: -        if (elt->offset == g_array_index (level->array, FilterElt, i).offset)
 1107: -          break;
 1108: +      tmp = bsearch_elt_with_offset (level->array, elt->offset, &i);
 1109:  
 1110: -      offset = g_array_index (level->array, FilterElt, i).offset;
 1111: +      offset = tmp->offset;
 1112:        g_array_remove_index (level->array, i);
 1113:  
 1114: -      for (i = 0; i < level->array->len; i++)
 1115: +      for (i = MAX (--i, 0); i < level->array->len; i++)
 1116:          {
 1117:            elt = &g_array_index (level->array, FilterElt, i);
 1118:            if (elt->offset > offset)
 1119: @@ -2391,6 +2485,7 @@
 1120:    GtkTreePath *retval;
 1121:    GtkTreePath *real_path;
 1122:    FilterLevel *level;
 1123: +  FilterElt *tmp;
 1124:    gint i;
 1125:  
 1126:    g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (filter), NULL);
 1127: @@ -2425,25 +2520,24 @@
 1128:            return NULL;
 1129:          }
 1130:  
 1131: -      for (j = 0; j < level->array->len; j++)
 1132: +      tmp = bsearch_elt_with_offset (level->array, child_indices[i], &j);
 1133: +      if (tmp)
 1134:          {
 1135: -          if ((g_array_index (level->array, FilterElt, j)).offset == child_indices[i])
 1136: -            {
 1137: -              gtk_tree_path_append_index (retval, j);
 1138: -              if (g_array_index (level->array, FilterElt, j).children == NULL && build_levels)
 1139: -                egg_tree_model_filter_build_level (filter,
 1140: -                                                   level,
 1141: -                                                   &g_array_index (level->array, FilterElt, j));
 1142: -              level = g_array_index (level->array, FilterElt, j).children;
 1143: -              found_child = TRUE;
 1144: -              break;
 1145: -            }
 1146: +          gtk_tree_path_append_index (retval, j);
 1147: +          if (!tmp->children && build_levels)
 1148: +            egg_tree_model_filter_build_level (filter, level, tmp);
 1149: +          level = tmp->children;
 1150: +          found_child = TRUE;
 1151:          }
 1152:  
 1153:        if (!found_child && fetch_childs)
 1154:          {
 1155: +          tmp = egg_tree_model_filter_fetch_child (filter, level,
 1156: +                                                   child_indices[i],
 1157: +                                                   &j);
 1158: +
 1159:            /* didn't find the child, let's try to bring it back */
 1160: -          if (!egg_tree_model_filter_fetch_child (filter, level, child_indices[i]))
 1161: +          if (!tmp || tmp->offset != child_indices[i])
 1162:              {
 1163:                /* not there */
 1164:                gtk_tree_path_free (real_path);
 1165: @@ -2451,29 +2545,11 @@
 1166:                return NULL;
 1167:              }
 1168:  
 1169: -          /* yay, let's search for the child again */
 1170: -          for (j = 0; j < level->array->len; j++)
 1171: -            {
 1172: -              if ((g_array_index (level->array, FilterElt, j)).offset == child_indices[i])
 1173: -                {
 1174: -                  gtk_tree_path_append_index (retval, j);
 1175: -                  if (g_array_index (level->array, FilterElt, j).children == NULL && build_levels)
 1176: -                    egg_tree_model_filter_build_level (filter,
 1177: -                                                       level,
 1178: -                                                       &g_array_index (level->array, FilterElt, j));
 1179: -                  level = g_array_index (level->array, FilterElt, j).children;
 1180: -                  found_child = TRUE;
 1181: -                  break;
 1182: -                }
 1183: -            }
 1184: -
 1185: -          if (!found_child)
 1186: -            {
 1187: -              /* our happy fun fetch attempt failed ?!?!?! no child! */
 1188: -              gtk_tree_path_free (real_path);
 1189: -              gtk_tree_path_free (retval);
 1190: -              return NULL;
 1191: -            }
 1192: +          gtk_tree_path_append_index (retval, j);
 1193: +          if (!tmp->children && build_levels)
 1194: +            egg_tree_model_filter_build_level (filter, level, tmp);
 1195: +          level = tmp->children;
 1196: +          found_child = TRUE;
 1197:          }
 1198:        else if (!found_child && !fetch_childs)
 1199:          {
 1200: @@ -2588,7 +2664,8 @@
 1201:                                         GtkTreeIter  *iter,
 1202:                                         gpointer      data)
 1203:  {
 1204: -  gtk_tree_model_row_changed (model, path, iter);
 1205: +  /* evil, don't try this at home, but certainly speeds things up */
 1206: +  egg_tree_model_filter_row_changed (model, path, iter, data);
 1207:  
 1208:    return FALSE;
 1209:  }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>