[libegg] Build ToolbarEditor with GSEAL



commit 5a62d65f05a97d4abd738f6848256bf1a475c140
Author: Jonh Wendell <jwendell gnome org>
Date:   Sat Aug 14 11:19:51 2010 -0300

    Build ToolbarEditor with GSEAL

 libegg/toolbareditor/egg-editable-toolbar.c |   62 +++++++++++++++------------
 libegg/toolbareditor/egg-toolbar-editor.c   |    8 ++--
 libegg/toolbareditor/test-toolbar-editor.c  |    2 +-
 3 files changed, 40 insertions(+), 32 deletions(-)
---
diff --git a/libegg/toolbareditor/egg-editable-toolbar.c b/libegg/toolbareditor/egg-editable-toolbar.c
index 2b071ae..60288c0 100644
--- a/libegg/toolbareditor/egg-editable-toolbar.c
+++ b/libegg/toolbareditor/egg-editable-toolbar.c
@@ -100,7 +100,7 @@ get_dock_position (EggEditableToolbar *etoolbar,
 static int
 get_toolbar_position (EggEditableToolbar *etoolbar, GtkWidget *toolbar)
 {
-  return get_dock_position (etoolbar, toolbar->parent);
+  return get_dock_position (etoolbar, gtk_widget_get_parent (toolbar));
 }
 
 static int
@@ -177,14 +177,16 @@ drag_data_delete_cb (GtkWidget          *widget,
 		     EggEditableToolbar *etoolbar)
 {
   int pos, toolbar_pos;
+  GtkWidget *parent;
 
   widget = gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM);
   g_return_if_fail (widget != NULL);
   g_return_if_fail (EGG_IS_EDITABLE_TOOLBAR (etoolbar));
 
-  pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (widget->parent),
+  parent = gtk_widget_get_parent (widget);
+  pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (parent),
 				    GTK_TOOL_ITEM (widget));
-  toolbar_pos = get_toolbar_position (etoolbar, widget->parent);
+  toolbar_pos = get_toolbar_position (etoolbar, parent);
 
   egg_toolbars_model_remove_item (etoolbar->priv->model,
 				  toolbar_pos, pos);
@@ -262,6 +264,7 @@ drag_data_get_cb (GtkWidget          *widget,
   EggToolbarsModel *model;
   const char *name;
   char *data;
+  GdkAtom target;
 
   g_return_if_fail (EGG_IS_EDITABLE_TOOLBAR (etoolbar));
   model = egg_editable_toolbar_get_model (etoolbar);
@@ -273,10 +276,11 @@ drag_data_get_cb (GtkWidget          *widget,
       g_return_if_fail (name != NULL);
     }
 
-  data = egg_toolbars_model_get_data (model, selection_data->target, name);
+  target = gtk_selection_data_get_target (selection_data);
+  data = egg_toolbars_model_get_data (model, target, name);
   if (data != NULL)
     {
-      gtk_selection_data_set (selection_data, selection_data->target, 8, (unsigned char *)data, strlen (data));
+      gtk_selection_data_set (selection_data, target, 8, (unsigned char *)data, strlen (data));
       g_free (data);
     }
 }
@@ -308,10 +312,11 @@ remove_item_cb (GtkAction          *action,
                 EggEditableToolbar *etoolbar)
 {
   GtkWidget *toolitem = gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar), GTK_TYPE_TOOL_ITEM);
+  GtkWidget *parent = gtk_widget_get_parent (toolitem);
   int pos, toolbar_pos;
 
-  toolbar_pos = get_toolbar_position (etoolbar, toolitem->parent);
-  pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolitem->parent),
+  toolbar_pos = get_toolbar_position (etoolbar, parent);
+  pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (parent),
 				    GTK_TOOL_ITEM (toolitem));
 
   egg_toolbars_model_remove_item (etoolbar->priv->model,
@@ -419,8 +424,9 @@ configure_item_cursor (GtkToolItem *item,
 {
   EggEditableToolbarPrivate *priv = etoolbar->priv;
   GtkWidget *widget = GTK_WIDGET (item);
+  GdkWindow *window = gtk_widget_get_window (widget);
 
-  if (widget->window != NULL)
+  if (window != NULL)
     {
       if (priv->edit_mode > 0)
         {
@@ -432,7 +438,7 @@ configure_item_cursor (GtkToolItem *item,
 
           cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen),
 					       GDK_HAND2);
-          gdk_window_set_cursor (widget->window, cursor);
+          gdk_window_set_cursor (window, cursor);
           gdk_cursor_unref (cursor);
 
           gtk_drag_source_set (widget, GDK_BUTTON1_MASK, dest_drag_types,
@@ -498,7 +504,7 @@ configure_item_cursor (GtkToolItem *item,
         }
       else
         {
-          gdk_window_set_cursor (GTK_WIDGET(item)->window, NULL);
+          gdk_window_set_cursor (window, NULL);
         }
     }
 }
@@ -642,15 +648,15 @@ toolbar_drag_data_received_cb (GtkToolbar         *toolbar,
    *      actually add a new item to the toolbar.
    */
 
-  GdkAtom type = selection_data->type;
-  const char *data = (char *)selection_data->data;
+  GdkAtom type = gtk_selection_data_get_data_type (selection_data);
+  const char *data = (char *)gtk_selection_data_get_data (selection_data);
 
   int ipos = -1;
   char *name = NULL;
   gboolean used = FALSE;
 
   /* Find out where the drop is occuring, and the name of what is being dropped. */
-  if (selection_data->length >= 0)
+  if (gtk_selection_data_get_length (selection_data) >= 0)
     {
       ipos = gtk_toolbar_get_drop_index (toolbar, x, y);
       name = egg_toolbars_model_get_name (etoolbar->priv->model, type, data, FALSE);
@@ -679,7 +685,7 @@ toolbar_drag_data_received_cb (GtkToolbar         *toolbar,
       etoolbar->priv->dnd_toolitem = NULL;
 
       /* If we don't have a name to use yet, try to create one. */
-      if (name == NULL && selection_data->length >= 0)
+      if (name == NULL && gtk_selection_data_get_length (selection_data) >= 0)
         {
           name = egg_toolbars_model_get_name (etoolbar->priv->model, type, data, TRUE);
         }
@@ -688,11 +694,11 @@ toolbar_drag_data_received_cb (GtkToolbar         *toolbar,
         {
           gint tpos = get_toolbar_position (etoolbar, GTK_WIDGET (toolbar));
           egg_toolbars_model_add_item (etoolbar->priv->model, tpos, ipos, name);
-          gtk_drag_finish (context, TRUE, context->action == GDK_ACTION_MOVE, time);
+          gtk_drag_finish (context, TRUE, gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE, time);
         }
       else
         {
-          gtk_drag_finish (context, FALSE, context->action == GDK_ACTION_MOVE, time);
+          gtk_drag_finish (context, FALSE, gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE, time);
         }
     }
 
@@ -751,7 +757,7 @@ toolbar_drag_motion_cb (GtkToolbar         *toolbar,
                                            etoolbar->priv->dnd_toolitem, ipos);
     }
 
-  gdk_drag_status (context, context->suggested_action, time);
+  gdk_drag_status (context, gdk_drag_context_get_suggested_action (context), time);
 
   return TRUE;
 }
@@ -873,7 +879,7 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar)
   priv->visibility_id = gtk_ui_manager_new_merge_id (priv->manager);
 
 #if GTK_CHECK_VERSION(2,20,0)
-  showing = gtk_widget_get_visible (etoolbar);
+  showing = gtk_widget_get_visible (GTK_WIDGET (etoolbar));
 #else
   showing = GTK_WIDGET_VISIBLE (etoolbar);
 #endif
@@ -1087,7 +1093,7 @@ unparent_fixed (EggEditableToolbar *etoolbar)
   toolbar = etoolbar->priv->fixed_toolbar;
   dock = get_dock_nth (etoolbar, 0);
 
-  if (dock && toolbar->parent != NULL)
+  if (dock && gtk_widget_get_parent (toolbar) != NULL)
     {
       gtk_container_remove (GTK_CONTAINER (dock), toolbar);
     }
@@ -1102,7 +1108,7 @@ update_fixed (EggEditableToolbar *etoolbar)
   toolbar = etoolbar->priv->fixed_toolbar;
   dock = get_dock_nth (etoolbar, 0);
 
-  if (dock && toolbar && toolbar->parent == NULL)
+  if (dock && toolbar && gtk_widget_get_parent (toolbar) == NULL)
     {
       gtk_box_pack_end (GTK_BOX (dock), toolbar, FALSE, TRUE, 0);
 
@@ -1746,14 +1752,14 @@ fake_expose_widget (GtkWidget *widget,
   event.type = GDK_EXPOSE;
   event.window = pixmap;
   event.send_event = FALSE;
-  event.area = widget->allocation;
+  gtk_widget_get_allocation (widget, &event.area);
   event.region = NULL;
   event.count = 0;
 
-  tmp_window = widget->window;
-  widget->window = pixmap;
+  tmp_window = gtk_widget_get_window (widget);
+  gtk_widget_set_window (widget, pixmap);
   gtk_widget_send_expose (widget, (GdkEvent *) &event);
-  widget->window = tmp_window;
+  gtk_widget_set_window (widget, tmp_window);
 }
 
 /* We should probably experiment some more with this.
@@ -1773,6 +1779,7 @@ new_pixbuf_from_widget (GtkWidget *widget)
   gint icon_width;
   gint icon_height;
   GdkScreen *screen;
+  GtkStyle *style;
 
   icon_width = DEFAULT_ICON_WIDTH;
 
@@ -1812,13 +1819,14 @@ new_pixbuf_from_widget (GtkWidget *widget)
 
   /* Create a pixmap */
   visual = gtk_widget_get_visual (window);
-  pixmap = gdk_pixmap_new (NULL, icon_width, icon_height, visual->depth);
+  pixmap = gdk_pixmap_new (NULL, icon_width, icon_height, gdk_visual_get_depth (visual));
   gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap), gtk_widget_get_colormap (window));
 
   /* Draw the window */
   gtk_widget_ensure_style (window);
-  g_assert (window->style);
-  g_assert (window->style->font_desc);
+  style = gtk_widget_get_style (window);
+  g_assert (style);
+  g_assert (style->font_desc);
 
   fake_expose_widget (window, pixmap);
   fake_expose_widget (widget, pixmap);
diff --git a/libegg/toolbareditor/egg-toolbar-editor.c b/libegg/toolbareditor/egg-toolbar-editor.c
index 5e9529a..9763342 100644
--- a/libegg/toolbareditor/egg-toolbar-editor.c
+++ b/libegg/toolbareditor/egg-toolbar-editor.c
@@ -322,7 +322,7 @@ drag_data_get_cb (GtkWidget          *widget,
   target = g_object_get_data (G_OBJECT (widget), "egg-item-name");
   g_return_if_fail (target != NULL);
 
-  gtk_selection_data_set (selection_data, selection_data->target, 8,
+  gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data), 8,
 			  (const guchar *) target, strlen (target));
 }
 
@@ -362,7 +362,7 @@ set_drag_cursor (GtkWidget *widget)
 
   cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen),
 				       GDK_HAND2);
-  gdk_window_set_cursor (widget->window, cursor);
+  gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
   gdk_cursor_unref (cursor);
 }
 
@@ -631,11 +631,11 @@ update_editor_sheet (EggToolbarEditor *editor)
   g_ptr_array_free (items, TRUE);
 
   /* Delete old table. */
-  viewport = GTK_BIN (editor->priv->scrolled_window)->child;
+  viewport = gtk_bin_get_child (GTK_BIN (editor->priv->scrolled_window));
   if (viewport)
     {
       gtk_container_remove (GTK_CONTAINER (viewport),
-                            GTK_BIN (viewport)->child);
+                            gtk_bin_get_child (GTK_BIN (viewport)));
     }
 
   /* Add table to window. */
diff --git a/libegg/toolbareditor/test-toolbar-editor.c b/libegg/toolbareditor/test-toolbar-editor.c
index 3515ebd..90172df 100644
--- a/libegg/toolbareditor/test-toolbar-editor.c
+++ b/libegg/toolbareditor/test-toolbar-editor.c
@@ -51,7 +51,7 @@ edit (GtkWidget *button, EggEditableToolbar *toolbar)
   gtk_window_set_title (GTK_WINDOW (dialog), "Toolbar editor");
 
   editor = egg_toolbar_editor_new (manager, model);
-  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), editor);
+  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), editor);
   gtk_widget_show (editor);
   g_signal_connect (editor, "destroy", G_CALLBACK (editor_destroy_cb), toolbar);
   egg_editable_toolbar_set_edit_mode (toolbar, TRUE);



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