[glade3/signal-tree-model: 51/53] Merge branch 'master' into signal-tree-model



commit 02c435f354e9a543437a833e4ff03bb1624d4ca5
Merge: 5b8ab44 97975f7
Author: Johannes Schmid <jhs gnome org>
Date:   Wed Jan 5 10:19:38 2011 +0100

    Merge branch 'master' into signal-tree-model
    
    Conflicts:
    	gladeui/Makefile.am
    	gladeui/glade-app.c
    	gladeui/glade-app.h
    	gladeui/glade-editor.c
    	gladeui/glade-signal-editor.c
    	gladeui/glade-signal-editor.h
    	gladeui/glade-signal.h
    	gladeui/glade-widget.c
    	gladeui/glade-widget.h

 ChangeLog                                 |  186 ++
 data/gladeui-2.0.pc.in                    |    4 +-
 gladeui/Makefile.am                       |   45 +-
 gladeui/glade-app.c                       |  931 +---------
 gladeui/glade-app.h                       |  175 +--
 gladeui/glade-base-editor.c               |  254 ++--
 gladeui/glade-base-editor.h               |   18 +-
 gladeui/glade-catalog.c                   |    5 +-
 gladeui/glade-cell-renderer-icon.c        |   45 +-
 gladeui/glade-cell-renderer-icon.h        |   10 +-
 gladeui/glade-clipboard.c                 |  130 +-
 gladeui/glade-clipboard.h                 |   37 +-
 gladeui/glade-command.c                   |  803 +++-----
 gladeui/glade-command.h                   |   76 +-
 gladeui/glade-cursor.c                    |   38 +-
 gladeui/glade-cursor.h                    |    6 +-
 gladeui/glade-design-view.c               |    9 +-
 gladeui/glade-editor-property.c           |  735 +++++----
 gladeui/glade-editor-property.h           |   64 +-
 gladeui/glade-editor-table.c              |  204 ++-
 gladeui/glade-editor-table.h              |   37 +-
 gladeui/glade-editor.c                    |  417 +++--
 gladeui/glade-editor.h                    |  129 +--
 gladeui/glade-id-allocator.c              |   19 +-
 gladeui/glade-inspector.c                 |   14 +-
 gladeui/glade-inspector.h                 |   20 +-
 gladeui/glade-name-context.c              |   35 +-
 gladeui/glade-palette.c                   |  964 +++++-----
 gladeui/glade-palette.h                   |   34 +-
 gladeui/glade-parameter.c                 |  311 ---
 gladeui/glade-parameter.h                 |   53 -
 gladeui/glade-placeholder.c               |   51 +-
 gladeui/glade-popup.c                     |  355 ++--
 gladeui/glade-popup.h                     |    6 +-
 gladeui/glade-project.c                   | 1330 +++++++++-----
 gladeui/glade-project.h                   |  334 ++--
 gladeui/glade-property-class.c            |  597 ++++++-
 gladeui/glade-property-class.h            |  265 +--
 gladeui/glade-property.c                  |  541 ++++--
 gladeui/glade-property.h                  |  118 +-
 gladeui/glade-signal-class.c              |  153 ++
 gladeui/glade-signal-class.h              |   73 +
 gladeui/glade-signal-editor.c             |    1 -
 gladeui/glade-signal-editor.h             |   22 +-
 gladeui/glade-signal.c                    |  128 ++-
 gladeui/glade-signal.h                    |   64 +-
 gladeui/glade-utils.c                     |   20 +-
 gladeui/glade-widget-adaptor.c            |  774 +++++----
 gladeui/glade-widget-adaptor.h            |  711 +++-----
 gladeui/glade-widget.c                    | 1344 ++++++++------
 gladeui/glade-widget.h                    |  165 +--
 gladeui/glade-xml-utils.h                 |   11 +-
 gladeui/glade.h                           |    3 +-
 m4/python.m4                              |    8 +-
 plugins/gtk+/Makefile.am                  |    6 +-
 plugins/gtk+/glade-accels.c               |  100 +-
 plugins/gtk+/glade-activatable-editor.c   |   40 +-
 plugins/gtk+/glade-attributes.c           |   77 +-
 plugins/gtk+/glade-button-editor.c        |   37 +-
 plugins/gtk+/glade-cell-renderer-editor.c |  109 +-
 plugins/gtk+/glade-column-types.c         |   85 +-
 plugins/gtk+/glade-entry-editor.c         |   72 +-
 {gladeui => plugins/gtk+}/glade-fixed.c   |  103 +-
 {gladeui => plugins/gtk+}/glade-fixed.h   |    0
 plugins/gtk+/glade-gtk.c                  |  660 ++++---
 plugins/gtk+/glade-icon-factory-editor.c  |   12 +-
 plugins/gtk+/glade-icon-sources.c         |   27 +-
 plugins/gtk+/glade-image-editor.c         |   27 +-
 plugins/gtk+/glade-image-item-editor.c    |   42 +-
 plugins/gtk+/glade-label-editor.c         |   52 +-
 plugins/gtk+/glade-model-data.c           |   52 +-
 plugins/gtk+/glade-store-editor.c         |   19 +-
 plugins/gtk+/glade-tool-button-editor.c   |   30 +-
 plugins/gtk+/glade-treeview-editor.c      |   27 +-
 plugins/gtk+/gtk+.xml.in                  |   95 +-
 po/POTFILES.in                            |    1 -
 po/es.po                                  | 2902 ++++++++++++++---------------
 src/glade-window.c                        |  405 ++--
 src/main.c                                |   11 +-
 79 files changed, 8991 insertions(+), 8882 deletions(-)
---
diff --cc gladeui/Makefile.am
index fa081b3,dde2b92..fe7c42a
--- a/gladeui/Makefile.am
+++ b/gladeui/Makefile.am
@@@ -87,10 -88,7 +88,8 @@@ libgladeui_2_la_SOURCES = 
  	glade-widget-action.c \
  	glade-name-context.c \
  	glade-displayable-values.c \
- 	glade-editable.c \
- 	glade-editor-table.c \
- 	glade-cell-renderer-icon.c \
 +	glade-signal-model.c
+ 	glade-cell-renderer-icon.c
  
  libgladeui_2_la_CPPFLAGS =  \
  	$(common_defines)   \
diff --cc gladeui/glade-app.c
index 5e35578,08ea674..f02bdf3
--- a/gladeui/glade-app.c
+++ b/gladeui/glade-app.c
@@@ -53,11 -52,10 +52,9 @@@
  
  #define GLADE_CONFIG_FILENAME "glade-3.conf"
  
- #define GLADE_APP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GLADE_TYPE_APP, GladeAppPrivate))
- 
  enum
  {
-   UPDATE_UI,
 -  SIGNAL_EDITOR_CREATED,
+   DOC_SEARCH,
    LAST_SIGNAL
  };
  
@@@ -208,87 -160,13 +159,6 @@@ glade_app_finalize (GObject * app
  /*****************************************************************
   *                    GladeAppClass                              *
   *****************************************************************/
--static void
- glade_app_refresh_undo_redo_button (GladeApp * app,
-                                     GtkWidget * button, gboolean undo)
- {
-   GladeCommand *command = NULL;
-   GladeProject *project;
-   gchar *desc;
- 
-   if ((project = glade_app_get_project ()) != NULL)
-     {
-       if (undo)
-         command = glade_project_next_undo_item (project);
-       else
-         command = glade_project_next_redo_item (project);
-     }
- 
-   /* Change tooltips */
-   desc = g_strdup_printf ((undo) ? _("Undo: %s") : _("Redo: %s"),
-                           command ? command->
-                           description : _("the last action"));
-   gtk_widget_set_tooltip_text (button, desc);
-   g_free (desc);
- 
-   /* Set sensitivity on the button */
-   gtk_widget_set_sensitive (button, command != NULL);
- }
- 
- static void
- glade_app_update_ui_default (GladeApp * app)
- {
-   GList *list;
- 
-   for (list = app->priv->undo_list; list; list = list->next)
-     if (list->data)
-       glade_app_refresh_undo_redo_button (app, list->data, TRUE);
- 
-   for (list = app->priv->redo_list; list; list = list->next)
-     if (list->data)
-       glade_app_refresh_undo_redo_button (app, list->data, FALSE);
- }
- 
 -glade_app_signal_editor_created_default (GladeApp * app,
 -                                         GladeSignalEditor * signal_editor)
 -{
 -  glade_signal_editor_construct_signals_list (signal_editor);
 -}
 -
  static GKeyFile *
  glade_app_config_load (GladeApp * app)
  {
@@@ -447,48 -313,52 +305,46 @@@ glade_app_init (GladeApp * app
  static void
  glade_app_class_init (GladeAppClass * klass)
  {
 -  GObjectClass *object_class;
 -
 -  object_class = G_OBJECT_CLASS (klass);
 +	GObjectClass *object_class;
 +	
 +	object_class = G_OBJECT_CLASS (klass);
 +	
 +	object_class->constructor  = glade_app_constructor;
 +	object_class->dispose      = glade_app_dispose;
 +	object_class->finalize     = glade_app_finalize;
 +	object_class->get_property = glade_app_get_property;
 +	object_class->set_property = glade_app_set_property;
 +
 +	klass->update_ui_signal = glade_app_update_ui_default;
 +	klass->show_properties  = NULL;
 +	klass->hide_properties  = NULL;
 +
- 
- 
-     /**
- 	 * GladeApp::update-ui:
- 	 * @gladeapp: the #GladeApp which received the signal.
- 	 *
- 	 * Emitted when a project name changes or a cut/copy/paste/delete occurred.
- 	 */
-   glade_app_signals[UPDATE_UI] =
-       g_signal_new ("update-ui",
-                     G_TYPE_FROM_CLASS (object_class),
-                     G_SIGNAL_RUN_FIRST,
-                     G_STRUCT_OFFSET (GladeAppClass,
-                                      update_ui_signal),
-                     NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
- 
 +  g_object_class_install_property
 +      (object_class, PROP_ACTIVE_PROJECT,
 +       g_param_spec_object
 +       ("active-project", _("Active Project"),
 +        _("The active project"), GLADE_TYPE_PROJECT, G_PARAM_READWRITE));
  
-   g_object_class_install_property
-       (object_class, PROP_POINTER_MODE,
-        g_param_spec_enum
-        ("pointer-mode", _("Pointer Mode"),
-         _("Current mode for the pointer in the workspace"),
-         GLADE_TYPE_POINTER_MODE, GLADE_POINTER_SELECT, G_PARAM_READWRITE));
+   object_class->constructor = glade_app_constructor;
+   object_class->dispose = glade_app_dispose;
+   object_class->finalize = glade_app_finalize;
+ 
 -  klass->signal_editor_created = glade_app_signal_editor_created_default;
 -
 -  /**
 -   * GladeApp::signal-editor-created:
 -   * @gladeapp: the #GladeApp which received the signal.
 -   * @signal_editor: the new #GladeSignalEditor.
 -   *
 -   * Emitted when a new signal editor created.
 -   * A tree view is created in the default handler.
 -   * Connect your handler before the default handler for setting a custom column or renderer
 -   * and after it for connecting to the tree view signals
 -   */
 -  glade_app_signals[SIGNAL_EDITOR_CREATED] =
 -      g_signal_new ("signal-editor-created",
 -                    G_TYPE_FROM_CLASS (object_class),
 -                    G_SIGNAL_RUN_LAST,
 -                    G_STRUCT_OFFSET (GladeAppClass,
 -                                     signal_editor_created),
 -                    NULL, NULL,
 -                    glade_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT);
 -
 -
+   /**
+    * GladeApp::doc-search:
+    * @gladeeditor: the #GladeEditor which received the signal.
+    * @arg1: the (#gchar *) book to search or %NULL
+    * @arg2: the (#gchar *) page to search or %NULL
+    * @arg3: the (#gchar *) search string or %NULL
+    *
+    * Emitted when the glade core requests that a doc-search be performed.
+    */
+   glade_app_signals[DOC_SEARCH] =
+       g_signal_new ("doc-search",
+                     G_TYPE_FROM_CLASS (object_class),
+                     G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+                     glade_marshal_VOID__STRING_STRING_STRING,
+                     G_TYPE_NONE, 3,
+                     G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
  
    g_type_class_add_private (klass, sizeof (GladeAppPrivate));
  }
diff --cc gladeui/glade-app.h
index a25c129,32e5326..31b5332
--- a/gladeui/glade-app.h
+++ b/gladeui/glade-app.h
@@@ -72,138 -52,53 +52,49 @@@ struct _GladeAp
  
  struct _GladeAppClass
  {
 -  GObjectClass parent_class;
 -
 -  /* signals */
 -  void   (*  signal_editor_created) (GladeApp *app, GladeSignalEditor *signal_editor);
 +	GObjectClass parent_class;
- 	
- 	/* class methods */
- 	void   (*  show_properties) (GladeApp* app,
- 				     gboolean  raise);
- 	void   (*  hide_properties) (GladeApp* app);
- 
- 	/* signals */
- 	void   (* update_ui_signal) (GladeApp    *app);
  };
  
-  
- GType              glade_app_get_type   (void) G_GNUC_CONST;
--
- GladeApp*          glade_app_new        (void);
- 
- GType              glade_pointer_mode_get_type (void) G_GNUC_CONST;
- 
- GladeApp*          glade_app_get        (void);
- 
- void               glade_app_update_ui  (void);
- 
- void               glade_app_set_window (GtkWidget *window);
-  
- GtkWidget*         glade_app_get_window (void);
- 
- gboolean           glade_app_get_catalog_version (const gchar *name, gint *major, gint *minor);
+ GType              glade_app_get_type             (void) G_GNUC_CONST;
  
- GList             *glade_app_get_catalogs (void);
+ GladeApp*          glade_app_new                  (void);
+ GladeApp*          glade_app_get                  (void);
+ GKeyFile*          glade_app_get_config           (void);
+ gint               glade_app_config_save          (void);
  
- GladeCatalog      *glade_app_get_catalog (const gchar *name);
+ gboolean           glade_app_get_catalog_version  (const gchar   *name, 
+ 						   gint          *major, 
+ 						   gint          *minor);
+ GList             *glade_app_get_catalogs         (void);
+ GladeCatalog      *glade_app_get_catalog          (const gchar   *name);
+ GladeClipboard*    glade_app_get_clipboard        (void);
  
- GladeEditor*       glade_app_get_editor (void);
- 
- GladePalette*      glade_app_get_palette (void);
- 
- GladeClipboard*    glade_app_get_clipboard (void);
- 
- GladeProject*      glade_app_get_project (void);
- 
- GladeProject*      glade_app_check_get_project (void);
-  
- void               glade_app_set_project (GladeProject *project);
- 
- GladePointerMode   glade_app_get_pointer_mode (void);
-  
- void               glade_app_set_pointer_mode (GladePointerMode mode);
- 
- void               glade_app_add_project (GladeProject *project);
-  
- void               glade_app_remove_project (GladeProject *project);
-  
- GList*             glade_app_get_projects (void);
-  
- GKeyFile*          glade_app_get_config (void);
-  
- gboolean           glade_app_is_project_loaded (const gchar *project_path);
-  
- GladeProject*      glade_app_get_project_by_path (const gchar *project_path);
-  
- void               glade_app_show_properties (gboolean raise);
-  
- void               glade_app_hide_properties (void);
+ void               glade_app_add_project          (GladeProject  *project);
+ void               glade_app_remove_project       (GladeProject  *project);
+ GList*             glade_app_get_projects         (void);
+ gboolean           glade_app_is_project_loaded    (const gchar   *project_path);
+ GladeProject*      glade_app_get_project_by_path  (const gchar   *project_path);
  
+ void               glade_app_set_window           (GtkWidget     *window);
+ GtkWidget*         glade_app_get_window           (void);
   
- void               glade_app_command_copy (void);
-  
- void               glade_app_command_cut (void);
-  
- void               glade_app_command_paste (GladePlaceholder *placeholder);
-  
- void               glade_app_command_delete (void);
- 
- void               glade_app_command_delete_clipboard (void);
-  
- void               glade_app_command_undo (void);
-  
- void               glade_app_command_redo (void);
- 
-  
- gint               glade_app_config_save (void);
-  
- void               glade_app_set_transient_parent (GtkWindow *parent);
-  
+ void               glade_app_set_transient_parent (GtkWindow     *parent);
  GtkWindow         *glade_app_get_transient_parent (void);
   
- void               glade_app_set_accel_group (GtkAccelGroup *accel_group);
- 
- GtkAccelGroup     *glade_app_get_accel_group (void);
-  
- GtkWidget         *glade_app_undo_button_new (void);
-  
- GtkWidget         *glade_app_redo_button_new (void);
- 
-  
- GList             *glade_app_get_selection (void);
+ void               glade_app_set_accel_group      (GtkAccelGroup *accel_group);
+ GtkAccelGroup     *glade_app_get_accel_group      (void);
  
- 
- /* These handle selection on a global scope and take care
-  * of multiple project logic.
-  */
-  
- gboolean           glade_app_is_selected       (GObject  *object);
-  
- void               glade_app_selection_set     (GObject  *object,
- 					        gboolean  emit_signal);
-  
- void               glade_app_selection_add     (GObject  *object,
- 					        gboolean  emit_signal);
-  
- void               glade_app_selection_remove  (GObject  *object,
- 					        gboolean  emit_signal);
-  
- void               glade_app_selection_clear   (gboolean  emit_signal);
-  
- void               glade_app_selection_changed (void);
- 
- void               glade_app_queue_selection_changed (void);
+ void               glade_app_search_docs          (const gchar   *book, 
+ 						   const gchar   *page, 
+ 						   const gchar   *search);
  
  /* package paths */
- 
- const gchar       *glade_app_get_catalogs_dir  (void) G_GNUC_CONST;
- 
- const gchar       *glade_app_get_modules_dir   (void) G_GNUC_CONST;
- 
- const gchar       *glade_app_get_plugins_dir   (void) G_GNUC_CONST;
- 
- const gchar       *glade_app_get_pixmaps_dir   (void) G_GNUC_CONST;
- 
- const gchar       *glade_app_get_locale_dir    (void) G_GNUC_CONST;
- 
- const gchar       *glade_app_get_bin_dir       (void) G_GNUC_CONST;
+ const gchar       *glade_app_get_catalogs_dir     (void) G_GNUC_CONST;
+ const gchar       *glade_app_get_modules_dir      (void) G_GNUC_CONST;
+ const gchar       *glade_app_get_plugins_dir      (void) G_GNUC_CONST;
+ const gchar       *glade_app_get_pixmaps_dir      (void) G_GNUC_CONST;
+ const gchar       *glade_app_get_locale_dir       (void) G_GNUC_CONST;
+ const gchar       *glade_app_get_bin_dir          (void) G_GNUC_CONST;
  
  G_END_DECLS
  
diff --cc gladeui/glade-editor.c
index 2f5ac55,34c2470..b50c36f
--- a/gladeui/glade-editor.c
+++ b/gladeui/glade-editor.c
@@@ -596,11 -632,11 +632,11 @@@ glade_editor_set_signal_editor (GladeEd
  static void
  glade_editor_load_signal_page (GladeEditor * editor)
  {
-   if (editor->signal_editor == NULL)
+   if (editor->priv->signal_editor == NULL)
      {
-       editor->signal_editor = glade_signal_editor_new ();
-       gtk_container_add (GTK_CONTAINER (editor->page_signals),
-                          GTK_WIDGET (editor->signal_editor));
 -      editor->priv->signal_editor = glade_signal_editor_new ((gpointer) editor);
++      editor->priv->signal_editor = glade_signal_editor_new ();
+       gtk_container_add (GTK_CONTAINER (editor->priv->page_signals),
+                          GTK_WIDGET (editor->priv->signal_editor));
      }
  }
  
diff --cc gladeui/glade-signal-editor.c
index 4c66758,17ee9a2..60f8737
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@@ -544,15 -1602,63 +544,14 @@@ glade_signal_editor_init (GladeSignalEd
  }
  
  static void
 -glade_signal_editor_userdata_store_update (GladeSignalEditor * self,
 -                                           GtkListStore * store)
 -{
 -  GtkTreeIter tmp_iter;
 -  GList *list;
 -  GladeProject *project;
 -
 -  GladeSignalEditorPrivate *priv = self->priv;
 -
 -  project = glade_widget_get_project (priv->widget);
 -
 -  gtk_list_store_clear (store);
 -
 -  for (list = (GList *) glade_project_get_objects (project);
 -       list && list->data; list = g_list_next (list))
 -    {
 -      GladeWidget *widget = glade_widget_get_from_gobject (list->data);
 -
 -      if (widget)
 -        {
 -          gtk_list_store_append (store, &tmp_iter);
 -          gtk_list_store_set (store, &tmp_iter, 0, glade_widget_get_name (widget), -1);
 -        }
 -    }
 -
 -  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), 0,
 -                                        GTK_SORT_DESCENDING);
 -}
 -
 -static gboolean
 -glade_signal_editor_userdata_editing_started_default (GladeSignalEditor *
 -                                                      editor,
 -                                                      gchar * signal_name,
 -                                                      GtkTreeIter * iter,
 -                                                      GtkCellEditable *
 -                                                      editable)
 +glade_signal_editor_class_init (GladeSignalEditorClass *klass)
  {
 -  GtkEntry *entry;
 -  GtkEntryCompletion *completion;
 -  GladeSignalEditorPrivate *priv = editor->priv;
 -  GtkTreeModel *completion_store = priv->userdata_store;
 -
 -  g_return_val_if_fail (priv->widget != NULL, FALSE);
 -  g_return_val_if_fail (GTK_IS_LIST_STORE (completion_store), FALSE);
 -  g_return_val_if_fail (GTK_IS_ENTRY (editable), FALSE);
 -
 -  entry = GTK_ENTRY (editable);
 -
 -  glade_signal_editor_editing_started (entry, priv->is_void_handler);
 +	GObjectClass *object_class;
  
 -  glade_signal_editor_userdata_store_update (editor,
 -                                             GTK_LIST_STORE (completion_store));
 +	glade_signal_editor_parent_class = g_type_class_peek_parent (klass);
  
 -  completion = gtk_entry_completion_new ();
 -  gtk_entry_completion_set_text_column (completion, 0);
 -  gtk_entry_completion_set_model (completion, completion_store);
 -  gtk_entry_set_completion (entry, completion);
 +	object_class = G_OBJECT_CLASS (klass);
 +	object_class->dispose = glade_signal_editor_dispose;
  
 -  return FALSE;
 +	g_type_class_add_private (klass, sizeof (GladeSignalEditorPrivate));
  }
- 
diff --cc gladeui/glade-signal-editor.h
index 2a75e65,4ff64ff..1e92a66
--- a/gladeui/glade-signal-editor.h
+++ b/gladeui/glade-signal-editor.h
@@@ -29,17 -29,23 +29,25 @@@ struct _GladeSignalEdito
  
  struct _GladeSignalEditorClass
  {
- 	GtkVBoxClass parent_class;
+   GtkVBoxClass parent_class;
+ 
+   void   (* glade_reserved1)   (void);
+   void   (* glade_reserved2)   (void);
+   void   (* glade_reserved3)   (void);
+   void   (* glade_reserved4)   (void);
+   void   (* glade_reserved5)   (void);
+   void   (* glade_reserved6)   (void);
  };
  
- GType glade_signal_editor_get_type (void) G_GNUC_CONST;
+ GType              glade_signal_editor_get_type (void) G_GNUC_CONST;
  
- GladeSignalEditor *glade_signal_editor_new (void);
- 
- void glade_signal_editor_load_widget (GladeSignalEditor *editor, GladeWidget *widget);
 -GladeSignalEditor *glade_signal_editor_new                    (gpointer          *editor);
++GladeSignalEditor *glade_signal_editor_new                    (void);
+ void               glade_signal_editor_construct_signals_list (GladeSignalEditor *editor);
+ void               glade_signal_editor_load_widget            (GladeSignalEditor *editor, 
+ 							       GladeWidget       *widget);
  
 +void glade_signal_editor_enable_dnd (GladeSignalEditor *editor, gboolean enabled);
 +
  G_END_DECLS
  
  #endif /* __GLADE_SIGNAL_EDITOR_H__ */
diff --cc gladeui/glade-widget.c
index 2dc36f4,de4a695..7b8e7dd
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@@ -65,6 -65,100 +65,102 @@@ static void glade_widget_set_propertie
  static void glade_widget_set_object (GladeWidget * gwidget,
                                       GObject * new_object, gboolean destroy);
  
+ 
+ struct _GladeWidgetPrivate {
+ 
+   GladeWidgetAdaptor *adaptor; /* An adaptor class for the object type */
+ 
+   GladeProject       *project; /* A pointer to the project that this 
+ 				  widget currently belongs to. */
+ 
+   GladeWidget  *parent;  /* A pointer to the parent widget in the hierarchy */
+ 	
+   gchar *name; /* The name of the widget. For example window1 or
+ 		* button2. This is a unique name and is the one
+ 		* used when loading widget with libglade
+ 		*/
+ 
+   gchar *support_warning; /* A warning message for version incompatabilities
+ 			   * in this widget
+ 			   */
+ 
+   gchar *internal; /* If the widget is an internal child of 
+ 		    * another widget this is the name of the 
+ 		    * internal child, otherwise is NULL.
+ 		    * Internal children cannot be deleted.
+ 		    */
+ 
+   gboolean anarchist; /* Some composite widgets have internal children
+ 		       * that are not part of the same hierarchy; hence 'anarchists',
+ 		       * typicly a popup window or its child (we need to mark
+ 		       * them so we can avoid bookkeeping packing props on them etc.).
+ 		       */
+ 
+   GObject *object; /* A pointer to the object that was created.
+ 		    * if it is a GtkWidget; it is shown as a "view"
+ 		    * of the GladeWidget. This object is updated as
+ 		    * the properties are modified for the GladeWidget.
+ 		    */
+ 
+   GList *properties; /* A list of GladeProperty. A GladeProperty is an
+ 		      * instance of a GladePropertyClass. If a
+ 		      * GladePropertyClass for a gtkbutton is label, its
+ 		      * property is "Ok". 
+ 		      */
+ 
+   GList *packing_properties; /* A list of GladeProperty. Note that these
+ 			      * properties are related to the container
+ 			      * of the widget, thus they change after
+ 			      * pasting the widget to a different
+ 			      * container. Toplevels widget do not have
+ 			      * packing properties.
+ 			      * See also child_properties of 
+ 			      * GladeWidgetClass.
+ 			      */
+ 
+   GHashTable *props_hash; /* A Quick reference table to speed up calls to glade_widget_get_property()
+ 			   */	
+   GHashTable *pack_props_hash; /* A Quick reference table to speed up calls to glade_widget_get_pack_property()
+ 				*/
+ 
+   GHashTable *signals; /* A table with a GPtrArray of GladeSignals (signal handlers),
+ 			* indexed by its name */
+ 
+   GList     *prop_refs; /* List of properties in the project who's value are `this object'
+ 			 * (this is used to set/unset those properties when the object is
+ 			 * added/removed from the project).
+ 			 */
+ 
+   gint               width;   /* Current size used in the UI, this is only */
+   gint               height;  /* usefull for parentless widgets in the
+ 			       * GladeDesignLayout */
+ 
+   GList *actions;		/* A GladeWidgetAction list */
+ 
+   GList *packing_actions;	/* A GladeWidgetAction list, this actions are
+ 				 * related to the container and they are not always present.
+ 				 */
+ 
+   GladeWidget    *lock; /* The glade widget that has locked this widget down.
+ 			 */
+   GList          *locked_widgets; /* A list of widgets this widget has locked down.
+ 				   */
+ 
++	GtkTreeModel   *signal_model; /* Signal model (or NULL if not yet requested) */
++    
+   /* Construct parameters: */
+   GladeWidget       *construct_template;
+   GladeCreateReason  construct_reason;
+   gchar             *construct_internal;
+   guint              construct_exact : 1;
+ 
+   guint              in_project : 1;
+ 
+   guint              visible : 1; /* Local copy of widget visibility, we need to keep track of this
+ 				   * since the objects copy may be invalid due to a rebuild.
+ 				   */
+ };
+ 
  enum
  {
    ADD_SIGNAL_HANDLER,
@@@ -234,22 -324,13 +332,22 @@@ glade_widget_add_signal_handler (GladeW
  
    new_signal_handler = glade_signal_clone (signal_handler);
    g_ptr_array_add (signals, new_signal_handler);
 +  g_signal_emit (widget, glade_widget_signals[ADD_SIGNAL_HANDLER], 0, new_signal_handler);
  
-   glade_project_update_signal_support_warning (widget, new_signal_handler);
+   glade_project_verify_signal (widget, new_signal_handler);
  }
  
 -static void
 -glade_widget_remove_signal_handler_impl (GladeWidget * widget,
 -                                         GladeSignal * signal_handler)
 +/**
 + * glade_widget_remove_signal_handler:
 + * @widget: A #GladeWidget
 + * @signal_handler: The #GladeSignal
 + *
 + * Removes a signal handler from @widget 
 + */
 +
 +void
 +glade_widget_remove_signal_handler (GladeWidget * widget,
 +                                    const GladeSignal * signal_handler)
  {
    GPtrArray *signals;
    GladeSignal *tmp_signal_handler;
@@@ -263,89 -344,63 +361,78 @@@
    /* trying to remove an inexistent signal? */
    g_assert (signals);
  
 -  for (i = 0; i < signals->len; i++)
 -    {
 -      tmp_signal_handler = g_ptr_array_index (signals, i);
 -      if (glade_signal_equal (tmp_signal_handler, signal_handler))
 -        {
 -          glade_signal_free (tmp_signal_handler);
 -          g_ptr_array_remove_index (signals, i);
 -          break;
 -        }
 -    }
 +	for (i = 0; i < signals->len; i++)
 +	{
 +		tmp_signal_handler = g_ptr_array_index (signals, i);
 +		if (glade_signal_equal (tmp_signal_handler, signal_handler))
 +		{
 +			g_signal_emit (widget, glade_widget_signals[REMOVE_SIGNAL_HANDLER], 0, tmp_signal_handler);
 +			g_ptr_array_remove_index (signals, i);
 +			if (signals->len == 0)
 +			{
 +				g_hash_table_remove (widget->signals, tmp_signal_handler->name);
 +			}
 +			else
 +			{
 +				glade_signal_free (tmp_signal_handler);
 +			}
 +			break;
 +		}
 +	}
  }
  
 -static void
 +/**
 + * glade_widget_change_signal_handler:
 + * @widget: A #GladeWidget
 + * @old_signal_handler: the old #GladeSignal
 + * @new_signal_handler: the new #GladeSignal
 + *
 + * Changes a #GladeSignal on @widget 
 + */
 +void
- glade_widget_change_signal_handler (GladeWidget *widget,
- 				    const GladeSignal *old_signal_handler,
- 				    const GladeSignal *new_signal_handler)
+ glade_widget_change_signal_handler_impl (GladeWidget * widget,
+                                          GladeSignal * old_signal_handler,
+                                          GladeSignal * new_signal_handler)
  {
- 	GPtrArray   *signals;
- 	GladeSignal *signal_handler_iter;
- 	guint        i;
- 	
- 	g_return_if_fail (GLADE_IS_WIDGET (widget));
- 	g_return_if_fail (GLADE_IS_SIGNAL (old_signal_handler));
- 	g_return_if_fail (GLADE_IS_SIGNAL (new_signal_handler));
- 	g_return_if_fail (strcmp (old_signal_handler->name, new_signal_handler->name) == 0);
- 
- 	signals = glade_widget_list_signal_handlers (widget, old_signal_handler->name);
+   GPtrArray *signals;
+   GladeSignal *signal_handler_iter;
+   guint i;
  
- 	/* trying to remove an inexistent signal? */
- 	g_assert (signals);
+   g_return_if_fail (GLADE_IS_WIDGET (widget));
+   g_return_if_fail (GLADE_IS_SIGNAL (old_signal_handler));
+   g_return_if_fail (GLADE_IS_SIGNAL (new_signal_handler));
+   g_return_if_fail (strcmp (glade_signal_get_name (old_signal_handler), 
+ 			    glade_signal_get_name (new_signal_handler)) == 0);
  
- 	for (i = 0; i < signals->len; i++)
- 	{
- 		signal_handler_iter = g_ptr_array_index (signals, i);
- 		if (glade_signal_equal (signal_handler_iter, old_signal_handler))
- 		{
- 			if (strcmp (old_signal_handler->handler,
- 				    new_signal_handler->handler) != 0)
- 			{
- 				g_free (signal_handler_iter->handler);
- 				signal_handler_iter->handler =
- 					g_strdup (new_signal_handler->handler);
- 			}
+   signals =
+     glade_widget_list_signal_handlers (widget, glade_signal_get_name (old_signal_handler));
  
- 			/* Handler */
- 			if (signal_handler_iter->handler)
- 				g_free (signal_handler_iter->handler);
- 			signal_handler_iter->handler =
- 				g_strdup (new_signal_handler->handler);
- 			
- 			/* Object */
- 			if (signal_handler_iter->userdata)
- 				g_free (signal_handler_iter->userdata);
- 			signal_handler_iter->userdata = 
- 				g_strdup (new_signal_handler->userdata);
- 			
- 			signal_handler_iter->after    = new_signal_handler->after;
- 			signal_handler_iter->swapped  = new_signal_handler->swapped;
- 
- 			g_signal_emit (widget, glade_widget_signals[CHANGE_SIGNAL_HANDLER], 0,
- 			               old_signal_handler, signal_handler_iter);
+   /* trying to remove an inexistent signal? */
+   g_assert (signals);
  
- 			break;
- 		}
- 	}
+   for (i = 0; i < signals->len; i++)
+     {
+       signal_handler_iter = g_ptr_array_index (signals, i);
+       if (glade_signal_equal (signal_handler_iter, old_signal_handler))
+         {
+           /* Handler */
+ 	  glade_signal_set_handler (signal_handler_iter, 
+ 				    glade_signal_get_handler (new_signal_handler));
+ 
+           /* Object */
+ 	  glade_signal_set_userdata (signal_handler_iter, 
+ 				     glade_signal_get_userdata (new_signal_handler));
+ 
+ 	  /* Flags */
+ 	  glade_signal_set_after (signal_handler_iter, 
+ 				  glade_signal_get_after (new_signal_handler));
+ 	  glade_signal_set_swapped (signal_handler_iter, 
+ 				    glade_signal_get_swapped (new_signal_handler));
+           break;
+         }
+     }
  }
  
 -
  static gboolean
  glade_widget_button_press_event_impl (GladeWidget * gwidget,
                                        GdkEvent * base_event)
@@@ -900,33 -971,27 +1003,33 @@@ glade_widget_dispose (GObject * object
  
    glade_widget_set_object (widget, NULL, TRUE);
  
-   if (widget->packing_properties)
+   if (widget->priv->packing_properties)
      {
-       g_list_foreach (widget->packing_properties, (GFunc) g_object_unref, NULL);
-       g_list_free (widget->packing_properties);
-       widget->packing_properties = NULL;
+       g_list_foreach (widget->priv->packing_properties, (GFunc) g_object_unref, NULL);
+       g_list_free (widget->priv->packing_properties);
+       widget->priv->packing_properties = NULL;
      }
  
-   if (widget->actions)
+   if (widget->priv->actions)
      {
-       g_list_foreach (widget->actions, (GFunc) g_object_unref, NULL);
-       g_list_free (widget->actions);
-       widget->actions = NULL;
+       g_list_foreach (widget->priv->actions, (GFunc) g_object_unref, NULL);
+       g_list_free (widget->priv->actions);
+       widget->priv->actions = NULL;
      }
  
-   if (widget->packing_actions)
+   if (widget->priv->packing_actions)
      {
-       g_list_foreach (widget->packing_actions, (GFunc) g_object_unref, NULL);
-       g_list_free (widget->packing_actions);
-       widget->packing_actions = NULL;
+       g_list_foreach (widget->priv->packing_actions, (GFunc) g_object_unref, NULL);
+       g_list_free (widget->priv->packing_actions);
+       widget->priv->packing_actions = NULL;
      }
  
 +  if (widget->signal_model)
 +    {
 +      g_object_unref (widget->signal_model);
 +      widget->signal_model = NULL;
 +    }
 +
    glade_widget_pop_superuser ();
  
    G_OBJECT_CLASS (glade_widget_parent_class)->dispose (object);
@@@ -4248,19 -4472,18 +4452,35 @@@ glade_widget_support_changed (GladeWidg
    g_signal_emit (widget, glade_widget_signals[SUPPORT_CHANGED], 0);
  }
  
 +/**
 + * glade_widget_get_signal_model:
 + * @widget: A #GladeWidget
 + * 
 + * Returns: a GtkTreeModel that can be used to view the widget's signals.
 + *          The signal model is owned by the #GladeWidget.
 + */
 +GtkTreeModel *
 +glade_widget_get_signal_model (GladeWidget *widget)
 +{
- 	if (!widget->signal_model)
++	if (!widget->priv->signal_model)
 +	{
- 		widget->signal_model = glade_signal_model_new (widget);
++		widget->priv->signal_model = glade_signal_model_new (widget);
 +	}
- 	return widget->signal_model;
++	return widget->priv->signal_model;
++}
++
+ GList *
+ glade_widget_get_properties (GladeWidget *widget)
+ {
+   g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+ 
+   return widget->priv->properties;
+ }
+ 
+ GList *
+ glade_widget_get_packing_properties (GladeWidget *widget)
+ {
+   g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
+ 
+   return widget->priv->packing_properties;
  }
diff --cc gladeui/glade-widget.h
index 2a34143,d2f30f0..319cf43
--- a/gladeui/glade-widget.h
+++ b/gladeui/glade-widget.h
@@@ -432,11 -365,12 +365,15 @@@ void                    glade_widget_lo
  							     GladeWidget      *locked);
  void                    glade_widget_unlock                 (GladeWidget      *widget);
  
+ GladeWidget            *glade_widget_get_locker             (GladeWidget      *widget);
+ 
+ GList                  *glade_widget_list_locked_widgets    (GladeWidget      *widget);
+ 
  void                    glade_widget_support_changed        (GladeWidget      *widget);
  
 +GtkTreeModel           *glade_widget_get_signal_model       (GladeWidget      *widget);
 +
 +
  G_END_DECLS
  
  #endif /* __GLADE_WIDGET_H__ */



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