[evince] cut-n-paste: Update toolbareditor from libegg
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] cut-n-paste: Update toolbareditor from libegg
- Date: Sun, 4 Dec 2011 12:08:29 +0000 (UTC)
commit 3b0edf9ea4a19eb8f14a3ae1947526b2c0efd8b2
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sun Dec 4 13:06:04 2011 +0100
cut-n-paste: Update toolbareditor from libegg
cut-n-paste/toolbar-editor/egg-editable-toolbar.c | 8 ++-
cut-n-paste/toolbar-editor/egg-editable-toolbar.h | 4 +-
cut-n-paste/toolbar-editor/egg-toolbar-editor.c | 50 +++++++++++----------
cut-n-paste/toolbar-editor/egg-toolbar-editor.h | 4 +-
4 files changed, 35 insertions(+), 31 deletions(-)
---
diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
index e826d1f..a27b88a 100644
--- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
+++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
@@ -84,7 +84,7 @@ struct _EggEditableToolbarPrivate
gchar *primary_name;
};
-G_DEFINE_TYPE (EggEditableToolbar, egg_editable_toolbar, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (EggEditableToolbar, egg_editable_toolbar, GTK_TYPE_BOX);
static int
get_dock_position (EggEditableToolbar *etoolbar,
@@ -1061,7 +1061,7 @@ create_dock (EggEditableToolbar *etoolbar)
{
GtkWidget *toolbar, *hbox;
- hbox = gtk_hbox_new (0, FALSE);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
toolbar = gtk_toolbar_new ();
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE);
@@ -1416,6 +1416,8 @@ egg_editable_toolbar_init (EggEditableToolbar *etoolbar)
priv = etoolbar->priv = EGG_EDITABLE_TOOLBAR_GET_PRIVATE (etoolbar);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (etoolbar),
+ GTK_ORIENTATION_VERTICAL);
priv->save_hidden = TRUE;
g_signal_connect (etoolbar, "notify::visible",
@@ -1859,7 +1861,7 @@ new_separator_pixbuf (void)
GtkWidget *separator;
GdkPixbuf *pixbuf;
- separator = gtk_vseparator_new ();
+ separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
pixbuf = new_pixbuf_from_widget (separator);
return pixbuf;
}
diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.h b/cut-n-paste/toolbar-editor/egg-editable-toolbar.h
index b08f68a..9f975b8 100644
--- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.h
+++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.h
@@ -41,7 +41,7 @@ typedef struct _EggEditableToolbarClass EggEditableToolbarClass;
struct _EggEditableToolbar
{
- GtkVBox parent_object;
+ GtkBox parent_object;
/*< private >*/
EggEditableToolbarPrivate *priv;
@@ -49,7 +49,7 @@ struct _EggEditableToolbar
struct _EggEditableToolbarClass
{
- GtkVBoxClass parent_class;
+ GtkBoxClass parent_class;
void (* action_request) (EggEditableToolbar *etoolbar,
const char *action_name);
diff --git a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c
index bf76ca8..09339ab 100644
--- a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c
+++ b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c
@@ -62,7 +62,7 @@ struct EggToolbarEditorPrivate
GtkUIManager *manager;
EggToolbarsModel *model;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *scrolled_window;
GList *actions_list;
GList *factory_list;
@@ -71,7 +71,7 @@ struct EggToolbarEditorPrivate
gulong sig_handlers[SIGNAL_HANDLER_LIST_SIZE];
};
-G_DEFINE_TYPE (EggToolbarEditor, egg_toolbar_editor, GTK_TYPE_VBOX);
+G_DEFINE_TYPE (EggToolbarEditor, egg_toolbar_editor, GTK_TYPE_BOX);
static gint
compare_items (gconstpointer a,
@@ -456,7 +456,7 @@ editor_create_item (EggToolbarEditor *editor,
G_CALLBACK (drag_end_cb), NULL);
}
- vbox = gtk_vbox_new (0, FALSE);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (event_box), vbox);
@@ -534,32 +534,32 @@ editor_create_item_from_name (EggToolbarEditor *editor,
}
static gint
-append_table (GtkTable *table, GList *items, gint y, gint width)
+append_grid (GtkGrid *grid, GList *items, gint y, gint width)
{
if (items != NULL)
{
- gint x = 0, height;
+ gint x = 0;
GtkWidget *alignment;
GtkWidget *item;
- height = g_list_length (items) / width + 1;
- gtk_table_resize (table, height, width);
-
if (y > 0)
{
- item = gtk_hseparator_new ();
+ item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
alignment = gtk_alignment_new (0.5, 0.5, 1.0, 0.0);
+ g_object_set (G_OBJECT (alignment), "expand", TRUE, NULL);
gtk_container_add (GTK_CONTAINER (alignment), item);
gtk_widget_show (alignment);
gtk_widget_show (item);
- gtk_table_attach_defaults (table, alignment, 0, width, y-1, y+1);
+ gtk_grid_attach (grid, alignment, 0, y, width, 1);
+ y++;
}
for (; items != NULL; items = items->next)
{
item = items->data;
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+ g_object_set (G_OBJECT (alignment), "expand", TRUE, NULL);
gtk_container_add (GTK_CONTAINER (alignment), item);
gtk_widget_show (alignment);
gtk_widget_show (item);
@@ -569,7 +569,7 @@ append_table (GtkTable *table, GList *items, gint y, gint width)
x = 0;
y++;
}
- gtk_table_attach_defaults (table, alignment, x, x+1, y, y+1);
+ gtk_grid_attach (grid, alignment, x, y, 1, 1);
x++;
}
@@ -584,18 +584,18 @@ update_editor_sheet (EggToolbarEditor *editor)
gint y;
GPtrArray *items;
GList *to_move = NULL, *to_copy = NULL;
- GtkWidget *table;
+ GtkWidget *grid;
GtkWidget *viewport;
g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor));
- /* Create new table. */
- table = gtk_table_new (0, 0, TRUE);
- editor->priv->table = table;
- gtk_container_set_border_width (GTK_CONTAINER (table), 12);
- gtk_table_set_row_spacings (GTK_TABLE (table), 24);
- gtk_widget_show (table);
- gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL,
+ /* Create new grid. */
+ grid = gtk_grid_new ();
+ editor->priv->grid = grid;
+ gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
+ gtk_grid_set_row_spacing (GTK_GRID (grid), 24);
+ gtk_widget_show (grid);
+ gtk_drag_dest_set (grid, GTK_DEST_DEFAULT_ALL,
dest_drag_types, G_N_ELEMENTS (dest_drag_types),
GDK_ACTION_MOVE | GDK_ACTION_COPY);
@@ -627,14 +627,14 @@ update_editor_sheet (EggToolbarEditor *editor)
/* Add them to the sheet. */
y = 0;
- y = append_table (GTK_TABLE (table), to_move, y, 4);
- y = append_table (GTK_TABLE (table), to_copy, y, 4);
+ y = append_grid (GTK_GRID (grid), to_move, y, 4);
+ y = append_grid (GTK_GRID (grid), to_copy, y, 4);
g_list_free (to_move);
g_list_free (to_copy);
g_ptr_array_free (items, TRUE);
- /* Delete old table. */
+ /* Delete old grid. */
viewport = gtk_bin_get_child (GTK_BIN (editor->priv->scrolled_window));
if (viewport)
{
@@ -642,9 +642,9 @@ update_editor_sheet (EggToolbarEditor *editor)
gtk_bin_get_child (GTK_BIN (viewport)));
}
- /* Add table to window. */
+ /* Add grid to window. */
gtk_scrolled_window_add_with_viewport
- (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), table);
+ (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), grid);
}
@@ -667,6 +667,8 @@ egg_toolbar_editor_init (EggToolbarEditor *t)
{
t->priv = EGG_TOOLBAR_EDITOR_GET_PRIVATE (t);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (t),
+ GTK_ORIENTATION_VERTICAL);
t->priv->manager = NULL;
t->priv->actions_list = NULL;
diff --git a/cut-n-paste/toolbar-editor/egg-toolbar-editor.h b/cut-n-paste/toolbar-editor/egg-toolbar-editor.h
index ba6e1a9..038e191 100644
--- a/cut-n-paste/toolbar-editor/egg-toolbar-editor.h
+++ b/cut-n-paste/toolbar-editor/egg-toolbar-editor.h
@@ -40,7 +40,7 @@ typedef struct EggToolbarEditorPrivate EggToolbarEditorPrivate;
struct EggToolbarEditor
{
- GtkVBox parent_object;
+ GtkBox parent_object;
/*< private >*/
EggToolbarEditorPrivate *priv;
@@ -48,7 +48,7 @@ struct EggToolbarEditor
struct EggToolbarEditorClass
{
- GtkVBoxClass parent_class;
+ GtkBoxClass parent_class;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]