[evolution-data-server] Replace deprecated Gtk+ symbols (as of Gtk+ 3.6.x)
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Replace deprecated Gtk+ symbols (as of Gtk+ 3.6.x)
- Date: Wed, 14 Nov 2012 22:38:52 +0000 (UTC)
commit 5cac1ca5b92827e27de536580e0b80f609ae4370
Author: Milan Crha <mcrha redhat com>
Date: Wed Nov 14 23:37:24 2012 +0100
Replace deprecated Gtk+ symbols (as of Gtk+ 3.6.x)
configure.ac | 7 +-
libedataserverui/e-categories-editor.c | 58 ++--
libedataserverui/e-categories-editor.h | 4 +-
libedataserverui/e-category-editor.c | 48 ++--
libedataserverui/e-cell-renderer-color.c | 8 +-
libedataserverui/e-name-selector-dialog.c | 318 ++++++++++++---------
libedataserverui/e-name-selector-list.c | 108 ++++++--
libedataserverui/e-passwords-win32.c | 60 +++--
libedataserverui/e-passwords.c | 58 +++--
libedataserverui/e-source-selector-dialog.c | 30 ++-
tests/libedataserverui/test-category-completion.c | 15 +-
tests/libedataserverui/test-contact-store.c | 19 +-
tests/libedataserverui/test-source-selector.c | 22 +-
13 files changed, 462 insertions(+), 293 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ab319f8..095ebd7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,7 +91,7 @@ LIBEDATASERVER_CURRENT=17
LIBEDATASERVER_REVISION=0
LIBEDATASERVER_AGE=0
-LIBEDATASERVERUI_CURRENT=4
+LIBEDATASERVERUI_CURRENT=5
LIBEDATASERVERUI_REVISION=0
LIBEDATASERVERUI_AGE=0
@@ -160,7 +160,6 @@ AS_COMPILER_FLAGS(WARNING_FLAGS,
-Wno-missing-field-initializers
-Wno-sign-compare
-Wno-unused-parameter
- -Wno-deprecated-declarations
-Wdeclaration-after-statement
-Werror-implicit-function-declaration
-Wformat-security -Winit-self
@@ -200,7 +199,9 @@ fi
AC_MSG_RESULT([$enable_strict])
if test "x$enable_strict" = xyes; then
- AM_CPPFLAGS="$AM_CPPFLAGS -DG_DISABLE_DEPRECATED"
+ AM_CPPFLAGS="$AM_CPPFLAGS -Wdeprecated-declarations -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DLIBSOUP_DISABLE_DEPRECATED"
+else
+ AM_CPPFLAGS="$AM_CPPFLAGS -Wno-deprecated-declarations"
fi
AC_SUBST(AM_CPPFLAGS)
diff --git a/libedataserverui/e-categories-editor.c b/libedataserverui/e-categories-editor.c
index 49e2b1a..8cb09d4 100644
--- a/libedataserverui/e-categories-editor.c
+++ b/libedataserverui/e-categories-editor.c
@@ -65,7 +65,7 @@ enum {
static gint signals[LAST_SIGNAL] = {0};
-G_DEFINE_TYPE (ECategoriesEditor, e_categories_editor, GTK_TYPE_TABLE)
+G_DEFINE_TYPE (ECategoriesEditor, e_categories_editor, GTK_TYPE_GRID)
static void
entry_changed_cb (GtkEntry *entry,
@@ -203,6 +203,7 @@ static void
e_categories_editor_init (ECategoriesEditor *editor)
{
GtkEntryCompletion *completion;
+ GtkGrid *grid;
GtkWidget *entry_categories;
GtkWidget *label_header;
GtkWidget *label2;
@@ -215,42 +216,37 @@ e_categories_editor_init (ECategoriesEditor *editor)
gtk_widget_set_size_request (GTK_WIDGET (editor), -1, 400);
- gtk_table_resize (GTK_TABLE (editor), 3, 2);
- gtk_table_set_row_spacings (GTK_TABLE (editor), 6);
- gtk_table_set_col_spacings (GTK_TABLE (editor), 6);
+ grid = GTK_GRID (editor);
- entry_categories = gtk_entry_new ();
- gtk_table_attach (
- GTK_TABLE (editor),
- entry_categories, 0, 1, 1, 2,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_set_row_spacing (grid, 6);
+ gtk_grid_set_column_spacing (grid, 6);
label_header = gtk_label_new_with_mnemonic (
_("Currently _used categories:"));
- gtk_table_attach (
- GTK_TABLE (editor),
- label_header, 0, 1, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_halign (label_header, GTK_ALIGN_FILL);
+ gtk_grid_attach (grid, label_header, 0, 0, 1, 1);
gtk_label_set_justify (GTK_LABEL (label_header), GTK_JUSTIFY_CENTER);
gtk_misc_set_alignment (GTK_MISC (label_header), 0, 0.5);
+ entry_categories = gtk_entry_new ();
+ gtk_widget_set_hexpand (entry_categories, TRUE);
+ gtk_widget_set_halign (entry_categories, GTK_ALIGN_FILL);
+ gtk_grid_attach (grid, entry_categories, 0, 1, 1, 1);
+
label2 = gtk_label_new_with_mnemonic (_("_Available Categories:"));
- gtk_table_attach (
- GTK_TABLE (editor),
- label2, 0, 1, 2, 3,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
+ gtk_widget_set_halign (label2, GTK_ALIGN_FILL);
+ gtk_grid_attach (grid, label2, 0, 2, 1, 1);
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER);
gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
- gtk_table_attach (
- GTK_TABLE (editor),
- scrolledwindow1, 0, 1, 3, 4,
- (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
- (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);
+ g_object_set (G_OBJECT (scrolledwindow1),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
+ gtk_grid_attach (grid, scrolledwindow1, 0, 3, 1, 1);
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (scrolledwindow1),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -267,12 +263,12 @@ e_categories_editor_init (ECategoriesEditor *editor)
G_OBJECT (categories_list), "category-checked",
G_CALLBACK (category_checked_cb), editor);
- hbuttonbox1 = gtk_hbutton_box_new ();
- gtk_table_attach (
- GTK_TABLE (editor),
- hbuttonbox1, 0, 1, 4, 5,
- (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
- (GtkAttachOptions) (GTK_SHRINK), 0, 0);
+ hbuttonbox1 = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
+ g_object_set (G_OBJECT (hbuttonbox1),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ NULL);
+ gtk_grid_attach (grid, hbuttonbox1, 0, 4, 1, 1);
gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 6);
button_new = gtk_button_new_from_stock (GTK_STOCK_NEW);
diff --git a/libedataserverui/e-categories-editor.h b/libedataserverui/e-categories-editor.h
index b088348..7cdf67e 100644
--- a/libedataserverui/e-categories-editor.h
+++ b/libedataserverui/e-categories-editor.h
@@ -60,12 +60,12 @@ typedef struct _ECategoriesEditorPrivate ECategoriesEditorPrivate;
* Since: 3.2
**/
struct _ECategoriesEditor {
- GtkTable parent;
+ GtkGrid parent;
ECategoriesEditorPrivate *priv;
};
struct _ECategoriesEditorClass {
- GtkTableClass parent_class;
+ GtkGridClass parent_class;
void (*entry_changed) (GtkEntry *entry);
};
diff --git a/libedataserverui/e-category-editor.c b/libedataserverui/e-category-editor.c
index 6579a6c..33ad6dd 100644
--- a/libedataserverui/e-category-editor.c
+++ b/libedataserverui/e-category-editor.c
@@ -122,7 +122,7 @@ e_category_editor_init (ECategoryEditor *editor)
{
GtkWidget *dialog_content;
GtkWidget *dialog_action_area;
- GtkWidget *table_category_properties;
+ GtkGrid *grid_category_properties;
GtkWidget *label_name;
GtkWidget *label_icon;
GtkWidget *category_name;
@@ -166,48 +166,38 @@ e_category_editor_init (ECategoryEditor *editor)
dialog_content = gtk_dialog_get_content_area (GTK_DIALOG (editor));
- table_category_properties = gtk_table_new (3, 2, FALSE);
+ grid_category_properties = GTK_GRID (gtk_grid_new ());
gtk_box_pack_start (
GTK_BOX (dialog_content),
- table_category_properties, TRUE, TRUE, 0);
+ GTK_WIDGET (grid_category_properties), TRUE, TRUE, 0);
gtk_container_set_border_width (
- GTK_CONTAINER (table_category_properties), 12);
- gtk_table_set_row_spacings (GTK_TABLE (table_category_properties), 6);
- gtk_table_set_col_spacings (GTK_TABLE (table_category_properties), 6);
+ GTK_CONTAINER (grid_category_properties), 12);
+ gtk_grid_set_row_spacing (grid_category_properties, 6);
+ gtk_grid_set_column_spacing (grid_category_properties, 6);
label_name = gtk_label_new_with_mnemonic (_("Category _Name"));
+ gtk_widget_set_halign (label_name, GTK_ALIGN_FILL);
gtk_misc_set_alignment (GTK_MISC (label_name), 0, 0.5);
- gtk_table_attach (
- GTK_TABLE (table_category_properties),
- label_name, 0, 1, 0, 1,
- (GtkAttachOptions) GTK_FILL,
- (GtkAttachOptions) 0, 0, 0);
-
- label_icon = gtk_label_new_with_mnemonic (_("Category _Icon"));
- gtk_misc_set_alignment (GTK_MISC (label_icon), 0, 0.5);
- gtk_table_attach (
- GTK_TABLE (table_category_properties),
- label_icon, 0, 1, 2, 3,
- (GtkAttachOptions) GTK_FILL,
- (GtkAttachOptions) 0, 0, 0);
+ gtk_grid_attach (grid_category_properties, label_name, 0, 0, 1, 1);
category_name = gtk_entry_new ();
+ gtk_widget_set_hexpand (category_name, TRUE);
+ gtk_widget_set_halign (category_name, GTK_ALIGN_FILL);
gtk_label_set_mnemonic_widget (GTK_LABEL (label_name), category_name);
- gtk_table_attach (
- GTK_TABLE (table_category_properties),
- category_name, 1, 2, 0, 1,
- (GtkAttachOptions) GTK_EXPAND | GTK_SHRINK | GTK_FILL,
- (GtkAttachOptions) 0, 0, 0);
+ gtk_grid_attach (grid_category_properties, category_name, 1, 0, 1, 1);
editor->priv->category_name = category_name;
+ label_icon = gtk_label_new_with_mnemonic (_("Category _Icon"));
+ gtk_widget_set_halign (label_icon, GTK_ALIGN_FILL);
+ gtk_misc_set_alignment (GTK_MISC (label_icon), 0, 0.5);
+ gtk_grid_attach (grid_category_properties, label_icon, 0, 1, 1, 1);
+
chooser_button = GTK_WIDGET (
gtk_file_chooser_button_new_with_dialog (chooser_dialog));
+ gtk_widget_set_hexpand (chooser_button, TRUE);
+ gtk_widget_set_halign (chooser_button, GTK_ALIGN_FILL);
gtk_label_set_mnemonic_widget (GTK_LABEL (label_icon), chooser_button);
- gtk_table_attach (
- GTK_TABLE (table_category_properties),
- chooser_button, 1, 2, 2, 3,
- (GtkAttachOptions) GTK_EXPAND | GTK_SHRINK | GTK_FILL,
- (GtkAttachOptions) 0, 0, 0);
+ gtk_grid_attach (grid_category_properties, chooser_button, 1, 1, 1, 1);
editor->priv->category_icon = chooser_button;
g_signal_connect (
diff --git a/libedataserverui/e-cell-renderer-color.c b/libedataserverui/e-cell-renderer-color.c
index 748bea5..4bbb131 100644
--- a/libedataserverui/e-cell-renderer-color.c
+++ b/libedataserverui/e-cell-renderer-color.c
@@ -106,6 +106,7 @@ cell_renderer_color_render (GtkCellRenderer *cell,
ECellRendererColorPrivate *priv;
GdkRectangle pix_rect;
GdkRectangle draw_rect;
+ GdkRGBA rgba;
guint xpad;
guint ypad;
@@ -129,7 +130,12 @@ cell_renderer_color_render (GtkCellRenderer *cell,
if (!gdk_rectangle_intersect (cell_area, &pix_rect, &draw_rect))
return;
- gdk_cairo_set_source_color (cr, priv->color);
+ rgba.red = priv->color->red / 65535.0;
+ rgba.green = priv->color->green / 65535.0;
+ rgba.blue = priv->color->blue / 65535.0;
+ rgba.alpha = 1.0;
+
+ gdk_cairo_set_source_rgba (cr, &rgba);
cairo_rectangle (cr, pix_rect.x, pix_rect.y, draw_rect.width, draw_rect.height);
cairo_fill (cr);
diff --git a/libedataserverui/e-name-selector-dialog.c b/libedataserverui/e-name-selector-dialog.c
index 3ebfcbc..f12d7a1 100644
--- a/libedataserverui/e-name-selector-dialog.c
+++ b/libedataserverui/e-name-selector-dialog.c
@@ -47,7 +47,7 @@
typedef struct {
gchar *name;
- GtkBox *section_box;
+ GtkGrid *section_grid;
GtkLabel *label;
GtkButton *transfer_button;
GtkButton *remove_button;
@@ -69,7 +69,7 @@ struct _ENameSelectorDialogPrivate {
GtkTreeView *contact_view;
GtkLabel *status_label;
- GtkBox *destination_box;
+ GtkGrid *destination_vgrid;
GtkEntry *search_entry;
GtkSizeGroup *button_size_group;
GtkWidget *category_combobox;
@@ -238,22 +238,19 @@ name_selector_dialog_constructed (GObject *object)
GtkTreeSelection *selection;
ESource *source;
gchar *tmp_str;
- GtkWidget *name_selector_box;
+ GtkWidget *name_selector_grid;
GtkWidget *show_contacts_label;
- GtkWidget *hbox2;
- GtkWidget *label35;
- GtkWidget *show_contacts_table;
+ GtkWidget *hgrid;
+ GtkWidget *label;
+ GtkWidget *show_contacts_grid;
GtkWidget *AddressBookLabel;
- GtkWidget *label31;
- GtkWidget *hbox1;
+ GtkWidget *label_category;
GtkWidget *search;
AtkObject *atko;
- GtkWidget *label39;
- GtkWidget *source_menu_box;
+ GtkWidget *label_search;
+ GtkWidget *source_menu_hgrid;
GtkWidget *combobox_category;
- GtkWidget *label36;
- GtkWidget *hbox3;
- GtkWidget *label38;
+ GtkWidget *label_contacts;
GtkWidget *scrolledwindow0;
GtkWidget *scrolledwindow1;
AtkRelationSet *tmp_relation_set;
@@ -261,7 +258,7 @@ name_selector_dialog_constructed (GObject *object)
AtkRelation *tmp_relation;
AtkObject *scrolledwindow1_relation_targets[1];
GtkWidget *source_tree_view;
- GtkWidget *destination_box;
+ GtkWidget *destination_vgrid;
GtkWidget *status_message;
GtkWidget *source_combo;
const gchar *extension_name;
@@ -271,122 +268,136 @@ name_selector_dialog_constructed (GObject *object)
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_name_selector_dialog_parent_class)->constructed (object);
- name_selector_box = gtk_vbox_new (FALSE, 6);
- gtk_widget_show (name_selector_box);
- gtk_container_set_border_width (GTK_CONTAINER (name_selector_box), 0);
+ name_selector_grid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "column-homogeneous", FALSE,
+ "row-spacing", 6,
+ NULL);
+ gtk_widget_show (name_selector_grid);
+ gtk_container_set_border_width (GTK_CONTAINER (name_selector_grid), 0);
tmp_str = g_strconcat ("<b>", _("Show Contacts"), "</b>", NULL);
show_contacts_label = gtk_label_new (tmp_str);
gtk_widget_show (show_contacts_label);
- gtk_box_pack_start (GTK_BOX (name_selector_box), show_contacts_label, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (name_selector_grid), show_contacts_label);
gtk_label_set_use_markup (GTK_LABEL (show_contacts_label), TRUE);
gtk_misc_set_alignment (GTK_MISC (show_contacts_label), 0, 0.5);
g_free (tmp_str);
- hbox2 = gtk_hbox_new (FALSE, 12);
- gtk_widget_show (hbox2);
- gtk_box_pack_start (GTK_BOX (name_selector_box), hbox2, FALSE, FALSE, 0);
-
- label35 = gtk_label_new ("");
- gtk_widget_show (label35);
- gtk_box_pack_start (GTK_BOX (hbox2), label35, FALSE, FALSE, 0);
+ hgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "row-homogeneous", FALSE,
+ "column-spacing", 12,
+ NULL);
+ gtk_widget_show (hgrid);
+ gtk_container_add (GTK_CONTAINER (name_selector_grid), hgrid);
- show_contacts_table = gtk_table_new (3, 2, FALSE);
- gtk_widget_show (show_contacts_table);
- gtk_box_pack_start (GTK_BOX (hbox2), show_contacts_table, TRUE, TRUE, 0);
- gtk_table_set_row_spacings (GTK_TABLE (show_contacts_table), 6);
- gtk_table_set_col_spacings (GTK_TABLE (show_contacts_table), 12);
+ label = gtk_label_new ("");
+ gtk_widget_show (label);
+ gtk_container_add (GTK_CONTAINER (hgrid), label);
+
+ show_contacts_grid = gtk_grid_new ();
+ gtk_widget_show (show_contacts_grid);
+ gtk_container_add (GTK_CONTAINER (hgrid), show_contacts_grid);
+ g_object_set (G_OBJECT (show_contacts_grid),
+ "column-spacing", 12,
+ "row-spacing", 6,
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ NULL);
AddressBookLabel = gtk_label_new_with_mnemonic (_("Address B_ook:"));
gtk_widget_show (AddressBookLabel);
- gtk_table_attach (
- GTK_TABLE (show_contacts_table),
- AddressBookLabel, 0, 1, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
+ gtk_grid_attach (GTK_GRID (show_contacts_grid), AddressBookLabel, 0, 0, 1, 1);
+ gtk_widget_set_halign (AddressBookLabel, GTK_ALIGN_FILL);
gtk_label_set_justify (GTK_LABEL (AddressBookLabel), GTK_JUSTIFY_CENTER);
gtk_misc_set_alignment (GTK_MISC (AddressBookLabel), 0, 0.5);
- label31 = gtk_label_new_with_mnemonic (_("Cat_egory:"));
- gtk_widget_show (label31);
- gtk_table_attach (
- GTK_TABLE (show_contacts_table),
- label31, 0, 1, 1, 2,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_label_set_justify (GTK_LABEL (label31), GTK_JUSTIFY_CENTER);
- gtk_misc_set_alignment (GTK_MISC (label31), 0, 0.5);
-
- hbox1 = gtk_hbox_new (FALSE, 12);
- gtk_widget_show (hbox1);
- gtk_table_attach (
- GTK_TABLE (show_contacts_table),
- hbox1, 1, 2, 2, 3,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+ label_category = gtk_label_new_with_mnemonic (_("Cat_egory:"));
+ gtk_widget_show (label_category);
+ gtk_grid_attach (GTK_GRID (show_contacts_grid), label_category, 0, 1, 1, 1);
+ gtk_widget_set_halign (label_category, GTK_ALIGN_FILL);
+ gtk_label_set_justify (GTK_LABEL (label_category), GTK_JUSTIFY_CENTER);
+ gtk_misc_set_alignment (GTK_MISC (label_category), 0, 0.5);
+
+ hgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "row-homogeneous", FALSE,
+ "column-spacing", 12,
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ NULL);
+ gtk_widget_show (hgrid);
+ gtk_grid_attach (GTK_GRID (show_contacts_grid), hgrid, 1, 2, 1, 1);
search = gtk_entry_new ();
gtk_widget_show (search);
- gtk_box_pack_start (GTK_BOX (hbox1), search, TRUE, TRUE, 0);
-
- label39 = gtk_label_new_with_mnemonic (_("_Search:"));
- gtk_widget_show (label39);
- gtk_table_attach (
- GTK_TABLE (show_contacts_table),
- label39, 0, 1, 2, 3,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label39), 0, 0.5);
-
- source_menu_box = gtk_hbox_new (FALSE, 0);
- gtk_widget_show (source_menu_box);
- gtk_table_attach (
- GTK_TABLE (show_contacts_table),
- source_menu_box, 1, 2, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
+ gtk_widget_set_hexpand (search, TRUE);
+ gtk_widget_set_halign (search, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (hgrid), search);
+
+ label_search = gtk_label_new_with_mnemonic (_("_Search:"));
+ gtk_widget_show (label_search);
+ gtk_grid_attach (GTK_GRID (show_contacts_grid), label_search, 0, 2, 1, 1);
+ gtk_widget_set_halign (label_search, GTK_ALIGN_FILL);
+ gtk_misc_set_alignment (GTK_MISC (label_search), 0, 0.5);
+
+ source_menu_hgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "row-homogeneous", FALSE,
+ "column-spacing", 0,
+ "halign", GTK_ALIGN_FILL,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
+ gtk_widget_show (source_menu_hgrid);
+ gtk_grid_attach (GTK_GRID (show_contacts_grid), source_menu_hgrid, 1, 0, 1, 1);
combobox_category = gtk_combo_box_text_new ();
gtk_widget_show (combobox_category);
- gtk_table_attach (
- GTK_TABLE (show_contacts_table),
- combobox_category, 1, 2, 1, 2,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
+ g_object_set (G_OBJECT (combobox_category),
+ "halign", GTK_ALIGN_FILL,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
+ gtk_grid_attach (GTK_GRID (show_contacts_grid), combobox_category, 1, 1, 1, 1);
gtk_combo_box_text_append_text (
GTK_COMBO_BOX_TEXT (combobox_category), _("Any Category"));
tmp_str = g_strconcat ("<b>", _("Co_ntacts"), "</b>", NULL);
- label36 = gtk_label_new_with_mnemonic (tmp_str);
- gtk_widget_show (label36);
- gtk_box_pack_start (
- GTK_BOX (name_selector_box), label36, FALSE, FALSE, 0);
- gtk_label_set_use_markup (GTK_LABEL (label36), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label36), 0, 0.5);
+ label_contacts = gtk_label_new_with_mnemonic (tmp_str);
+ gtk_widget_show (label_contacts);
+ gtk_container_add (GTK_CONTAINER (name_selector_grid), label_contacts);
+ gtk_label_set_use_markup (GTK_LABEL (label_contacts), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label_contacts), 0, 0.5);
g_free (tmp_str);
scrolledwindow0 = gtk_scrolled_window_new (NULL, NULL);
priv->contact_window = scrolledwindow0;
gtk_widget_show (scrolledwindow0);
- gtk_box_pack_start (
- GTK_BOX (name_selector_box), scrolledwindow0,
- TRUE, TRUE, 0);
+ gtk_widget_set_vexpand (scrolledwindow0, TRUE);
+ gtk_widget_set_valign (scrolledwindow0, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (name_selector_grid), scrolledwindow0);
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (scrolledwindow0),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- hbox3 = gtk_hbox_new (FALSE, 12);
- gtk_widget_show (hbox3);
+ hgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "row-homogeneous", FALSE,
+ "column-spacing", 12,
+ NULL);
+ gtk_widget_show (hgrid);
gtk_scrolled_window_add_with_viewport (
- GTK_SCROLLED_WINDOW (scrolledwindow0), hbox3);
+ GTK_SCROLLED_WINDOW (scrolledwindow0), hgrid);
- label38 = gtk_label_new ("");
- gtk_widget_show (label38);
- gtk_box_pack_start (GTK_BOX (hbox3), label38, FALSE, FALSE, 0);
+ label = gtk_label_new ("");
+ gtk_widget_show (label);
+ gtk_container_add (GTK_CONTAINER (hgrid), label);
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scrolledwindow1);
- gtk_box_pack_start (GTK_BOX (hbox3), scrolledwindow1, TRUE, TRUE, 0);
+ gtk_container_add (GTK_CONTAINER (hgrid), scrolledwindow1);
+ gtk_widget_set_hexpand (scrolledwindow1, TRUE);
+ gtk_widget_set_halign (scrolledwindow1, GTK_ALIGN_FILL);
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (scrolledwindow1),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -401,32 +412,40 @@ name_selector_dialog_constructed (GObject *object)
gtk_tree_view_set_enable_search (
GTK_TREE_VIEW (source_tree_view), FALSE);
- destination_box = gtk_vbox_new (TRUE, 6);
- gtk_widget_show (destination_box);
- gtk_box_pack_start (GTK_BOX (hbox3), destination_box, TRUE, TRUE, 0);
+ destination_vgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "column-homogeneous", TRUE,
+ "row-spacing", 6,
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
+ gtk_widget_show (destination_vgrid);
+ gtk_container_add (GTK_CONTAINER (hgrid), destination_vgrid);
status_message = gtk_label_new ("");
gtk_widget_show (status_message);
- gtk_box_pack_end (GTK_BOX (name_selector_box), status_message, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (name_selector_grid), status_message);
gtk_label_set_use_markup (GTK_LABEL (status_message), TRUE);
gtk_misc_set_alignment (GTK_MISC (status_message), 0, 0.5);
gtk_misc_set_padding (GTK_MISC (status_message), 0, 3);
- gtk_label_set_mnemonic_widget (GTK_LABEL (AddressBookLabel), source_menu_box);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label31), combobox_category);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label39), search);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label36), source_tree_view);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (AddressBookLabel), source_menu_hgrid);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label_category), combobox_category);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label_search), search);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label_contacts), source_tree_view);
atko = gtk_widget_get_accessible (search);
atk_object_set_name (atko, _("Search"));
- atko = gtk_widget_get_accessible (source_menu_box);
+ atko = gtk_widget_get_accessible (source_menu_hgrid);
atk_object_set_name (atko, _("Address Book"));
atko = gtk_widget_get_accessible (scrolledwindow1);
atk_object_set_name (atko, _("Contacts"));
tmp_relation_set = atk_object_ref_relation_set (atko);
- scrolledwindow1_relation_targets[0] = gtk_widget_get_accessible (label36);
+ scrolledwindow1_relation_targets[0] = gtk_widget_get_accessible (label_contacts);
tmp_relationship = atk_relation_type_for_name ("labelled-by");
tmp_relation = atk_relation_new (scrolledwindow1_relation_targets, 1, tmp_relationship);
atk_relation_set_add (tmp_relation_set, tmp_relation);
@@ -435,13 +454,13 @@ name_selector_dialog_constructed (GObject *object)
gtk_box_pack_start (
GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (object))),
- name_selector_box, TRUE, TRUE, 0);
+ name_selector_grid, TRUE, TRUE, 0);
/* Store pointers to relevant widgets */
priv->contact_view = GTK_TREE_VIEW (source_tree_view);
priv->status_label = GTK_LABEL (status_message);
- priv->destination_box = GTK_BOX (destination_box);
+ priv->destination_vgrid = GTK_GRID (destination_vgrid);
priv->search_entry = GTK_ENTRY (search);
priv->category_combobox = combobox_category;
@@ -495,7 +514,9 @@ name_selector_dialog_constructed (GObject *object)
gtk_label_set_mnemonic_widget (GTK_LABEL (AddressBookLabel), source_combo);
gtk_widget_show (source_combo);
- gtk_box_pack_start (GTK_BOX (source_menu_box), source_combo, TRUE, TRUE, 0);
+ gtk_widget_set_hexpand (source_combo, TRUE);
+ gtk_widget_set_halign (source_combo, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (source_menu_hgrid), source_combo);
name_selector_dialog_populate_categories (
E_NAME_SELECTOR_DIALOG (object));
@@ -817,7 +838,7 @@ setup_section_button (ENameSelectorDialog *name_selector_dialog,
gboolean icon_before_label)
{
GtkWidget *alignment;
- GtkWidget *hbox;
+ GtkWidget *hgrid;
GtkWidget *label;
GtkWidget *image;
@@ -828,9 +849,13 @@ setup_section_button (ENameSelectorDialog *name_selector_dialog,
alignment = gtk_alignment_new (halign, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (button), GTK_WIDGET (alignment));
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_widget_show (GTK_WIDGET (hbox));
- gtk_container_add (GTK_CONTAINER (alignment), hbox);
+ hgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "row-homogeneous", FALSE,
+ "column-spacing", 2,
+ NULL);
+ gtk_widget_show (hgrid);
+ gtk_container_add (GTK_CONTAINER (alignment), hgrid);
label = gtk_label_new_with_mnemonic (label_text);
gtk_widget_show (label);
@@ -839,11 +864,11 @@ setup_section_button (ENameSelectorDialog *name_selector_dialog,
gtk_widget_show (image);
if (icon_before_label) {
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (hgrid), image);
+ gtk_container_add (GTK_CONTAINER (hgrid), label);
} else {
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (hgrid), label);
+ gtk_container_add (GTK_CONTAINER (hgrid), image);
}
}
@@ -855,13 +880,13 @@ add_section (ENameSelectorDialog *name_selector_dialog,
{
ENameSelectorDialogPrivate *priv;
Section section;
- GtkWidget *vbox;
+ GtkWidget *vgrid;
GtkWidget *alignment;
GtkWidget *scrollwin;
SelData *data;
GtkTreeSelection *selection;
gchar *text;
- GtkWidget *hbox;
+ GtkWidget *hgrid;
g_assert (name != NULL);
g_assert (pretty_name != NULL);
@@ -872,7 +897,13 @@ add_section (ENameSelectorDialog *name_selector_dialog,
memset (§ion, 0, sizeof (Section));
section.name = g_strdup (name);
- section.section_box = GTK_BOX (gtk_hbox_new (FALSE, 12));
+ section.section_grid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "row-homogeneous", FALSE,
+ "column-spacing", 12,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
section.label = GTK_LABEL (gtk_label_new_with_mnemonic (pretty_name));
section.transfer_button = GTK_BUTTON (gtk_button_new ());
section.remove_button = GTK_BUTTON (gtk_button_new ());
@@ -904,41 +935,56 @@ add_section (ENameSelectorDialog *name_selector_dialog,
section.remove_button, "clicked",
G_CALLBACK (remove_button_clicked), data);
- /* Alignment and vbox for the add/remove buttons */
+ /* Alignment and vgrid for the add/remove buttons */
alignment = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
- gtk_box_pack_start (section.section_box, alignment, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (section.section_grid), alignment);
- vbox = gtk_vbox_new (TRUE, 6);
- gtk_container_add (GTK_CONTAINER (alignment), vbox);
+ vgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "column-homogeneous", TRUE,
+ "row-spacing", 6,
+ NULL);
+
+ gtk_container_add (GTK_CONTAINER (alignment), vgrid);
/* "Add" button */
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (section.transfer_button), FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (vgrid), GTK_WIDGET (section.transfer_button));
setup_section_button (name_selector_dialog, section.transfer_button, 0.7, _("_Add"), "gtk-go-forward", FALSE);
/* "Remove" button */
- gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (section.remove_button), FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (vgrid), GTK_WIDGET (section.remove_button));
setup_section_button (name_selector_dialog, section.remove_button, 0.5, _("_Remove"), "gtk-go-back", TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (section.remove_button), FALSE);
- /* Hbox for label and scrolled window. This is a separate hbox, instead
- * of just using the section.section_box directly, as it has a different
+ /* hgrid for label and scrolled window. This is a separate hgrid, instead
+ * of just using the section.section_grid directly, as it has a different
* spacing.
*/
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (section.section_box, hbox, TRUE, TRUE, 0);
+ hgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "row-homogeneous", FALSE,
+ "column-spacing", 6,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (section.section_grid), hgrid);
/* Title label */
gtk_size_group_add_widget (priv->dest_label_size_group, GTK_WIDGET (section.label));
gtk_misc_set_alignment (GTK_MISC (section.label), 0.0, 0.0);
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (section.label), FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (hgrid), GTK_WIDGET (section.label));
/* Treeview in a scrolled window */
scrollwin = gtk_scrolled_window_new (NULL, NULL);
- gtk_box_pack_start (GTK_BOX (hbox), scrollwin, TRUE, TRUE, 0);
+ gtk_container_add (GTK_CONTAINER (hgrid), scrollwin);
+ gtk_widget_set_hexpand (scrollwin, TRUE);
+ gtk_widget_set_halign (scrollwin, GTK_ALIGN_FILL);
+ gtk_widget_set_vexpand (scrollwin, TRUE);
+ gtk_widget_set_valign (scrollwin, GTK_ALIGN_FILL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (scrollwin), GTK_WIDGET (section.destination_view));
@@ -964,12 +1010,14 @@ add_section (ENameSelectorDialog *name_selector_dialog,
/* Done! */
- gtk_widget_show_all (GTK_WIDGET (section.section_box));
+ gtk_widget_show_all (GTK_WIDGET (section.section_grid));
/* Pack this section's box into the dialog */
- gtk_box_pack_start (
- name_selector_dialog->priv->destination_box,
- GTK_WIDGET (section.section_box), TRUE, TRUE, 0);
+ gtk_container_add (GTK_CONTAINER (name_selector_dialog->priv->destination_vgrid), GTK_WIDGET (section.section_grid));
+ g_object_set (G_OBJECT (section.section_grid),
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
g_array_append_val (name_selector_dialog->priv->sections, section);
@@ -992,7 +1040,7 @@ free_section (ENameSelectorDialog *name_selector_dialog,
name_selector_dialog->priv->sections, Section, n);
g_free (section->name);
- gtk_widget_destroy (GTK_WIDGET (section->section_box));
+ gtk_widget_destroy (GTK_WIDGET (section->section_grid));
}
static void
@@ -1776,7 +1824,7 @@ e_name_selector_dialog_get_section_visible (ENameSelectorDialog *name_selector_d
g_return_val_if_fail (index != -1, FALSE);
section = &g_array_index (name_selector_dialog->priv->sections, Section, index);
- return gtk_widget_get_visible (GTK_WIDGET (section->section_box));
+ return gtk_widget_get_visible (GTK_WIDGET (section->section_grid));
}
/**
@@ -1806,8 +1854,8 @@ e_name_selector_dialog_set_section_visible (ENameSelectorDialog *name_selector_d
section = &g_array_index (name_selector_dialog->priv->sections, Section, index);
if (visible)
- gtk_widget_show (GTK_WIDGET (section->section_box));
+ gtk_widget_show (GTK_WIDGET (section->section_grid));
else
- gtk_widget_hide (GTK_WIDGET (section->section_box));
+ gtk_widget_hide (GTK_WIDGET (section->section_grid));
}
diff --git a/libedataserverui/e-name-selector-list.c b/libedataserverui/e-name-selector-list.c
index f22c894..43c9dc9 100644
--- a/libedataserverui/e-name-selector-list.c
+++ b/libedataserverui/e-name-selector-list.c
@@ -45,6 +45,8 @@ struct _ENameSelectorListPrivate {
GtkWidget *tree_view;
GtkWidget *menu;
gint rows;
+ GdkDevice *grab_keyboard;
+ GdkDevice *grab_pointer;
};
G_DEFINE_TYPE (ENameSelectorList, e_name_selector_list, E_TYPE_NAME_SELECTOR_ENTRY)
@@ -90,26 +92,70 @@ enl_popup_position (ENameSelectorList *list)
gtk_window_move (list->priv->popup, x, y);
}
+static gboolean
+popup_grab_on_window (GdkWindow *window,
+ GdkDevice *keyboard,
+ GdkDevice *pointer,
+ guint32 activate_time)
+{
+ if (keyboard && gdk_device_grab (keyboard, window,
+ GDK_OWNERSHIP_WINDOW, TRUE,
+ GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
+ NULL, activate_time) != GDK_GRAB_SUCCESS)
+ return FALSE;
+
+ if (pointer && gdk_device_grab (pointer, window,
+ GDK_OWNERSHIP_WINDOW, TRUE,
+ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
+ GDK_POINTER_MOTION_MASK,
+ NULL, activate_time) != GDK_GRAB_SUCCESS) {
+ if (keyboard)
+ gdk_device_ungrab (keyboard, activate_time);
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void
-enl_popup_grab (ENameSelectorList *list)
+enl_popup_grab (ENameSelectorList *list,
+ const GdkEvent *event)
{
EDestinationStore *store;
ENameSelectorEntry *entry;
GdkWindow *window;
+ GdkDevice *device = NULL;
+ GdkDevice *keyboard, *pointer;
gint len;
+ if (list->priv->grab_pointer && list->priv->grab_keyboard)
+ return;
+
window = gtk_widget_get_window (GTK_WIDGET (list->priv->popup));
- gtk_grab_add (GTK_WIDGET (list->priv->popup));
+ if (event)
+ device = gdk_event_get_device (event);
+ if (!device)
+ device = gtk_get_current_event_device ();
+ if (!device) {
+ GdkDeviceManager *device_manager;
+
+ device_manager = gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET (list)));
+ device = gdk_device_manager_get_client_pointer (device_manager);
+ }
- gdk_pointer_grab (
- window, TRUE,
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK,
- NULL, NULL, GDK_CURRENT_TIME);
+ if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) {
+ keyboard = device;
+ pointer = gdk_device_get_associated_device (device);
+ } else {
+ pointer = device;
+ keyboard = gdk_device_get_associated_device (device);
+ }
+
+ if (!popup_grab_on_window (window, keyboard, pointer, gtk_get_current_event_time ()))
+ return;
- gdk_keyboard_grab (window, TRUE, GDK_CURRENT_TIME);
gtk_widget_grab_focus ((GtkWidget *) list);
/* Build the listview from the model */
@@ -122,17 +168,25 @@ enl_popup_grab (ENameSelectorList *list)
/* If any selection of text is present, unselect it */
len = strlen (gtk_entry_get_text (GTK_ENTRY (list)));
gtk_editable_select_region (GTK_EDITABLE (list), len, -1);
+
+ gtk_device_grab_add (GTK_WIDGET (list->priv->popup), pointer, TRUE);
+ list->priv->grab_keyboard = keyboard;
+ list->priv->grab_pointer = pointer;
}
static void
enl_popup_ungrab (ENameSelectorList *list)
{
- if (!gtk_widget_has_grab (GTK_WIDGET (list->priv->popup)))
+ if (!list->priv->grab_pointer ||
+ !list->priv->grab_keyboard ||
+ !gtk_widget_has_grab (GTK_WIDGET (list->priv->popup)))
return;
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gtk_grab_remove (GTK_WIDGET (list->priv->popup));
- gdk_keyboard_ungrab (GDK_CURRENT_TIME);
+ gtk_device_grab_remove (GTK_WIDGET (list->priv->popup), list->priv->grab_pointer);
+ gtk_device_grab_remove (GTK_WIDGET (list->priv->popup), list->priv->grab_keyboard);
+
+ list->priv->grab_pointer = NULL;
+ list->priv->grab_keyboard = NULL;
}
static gboolean
@@ -195,10 +249,10 @@ enl_popup_enter_notify (GtkWidget *widget,
GdkEventCrossing *event,
ENameSelectorList *list)
{
- if (event->type == GDK_ENTER_NOTIFY && !gtk_widget_has_grab (GTK_WIDGET (list->priv->popup)))
- enl_popup_grab (list);
+ if (event->type == GDK_ENTER_NOTIFY && !gtk_widget_has_grab (GTK_WIDGET (list->priv->popup)))
+ enl_popup_grab (list, (GdkEvent *) event);
- return TRUE;
+ return TRUE;
}
static void
@@ -247,7 +301,7 @@ enl_entry_key_press_event (ENameSelectorList *list,
if ( (event->state & GDK_CONTROL_MASK) && (event->keyval == GDK_KEY_Down)) {
enl_popup_position (list);
gtk_widget_show_all (GTK_WIDGET (list->priv->popup));
- enl_popup_grab (list);
+ enl_popup_grab (list, (GdkEvent *) event);
list->priv->rows = e_destination_store_get_destination_count (store);
enl_popup_size (list);
enl_tree_select_node (list, 1);
@@ -380,7 +434,7 @@ static void
menu_deactivate (GtkMenuShell *junk,
ENameSelectorList *list)
{
- enl_popup_grab (list);
+ enl_popup_grab (list, NULL);
}
static gboolean
@@ -412,7 +466,7 @@ enl_tree_button_press_event (GtkWidget *widget,
store = e_name_selector_entry_peek_destination_store (entry);
if (!gtk_widget_has_grab (GTK_WIDGET (list->priv->popup)))
- enl_popup_grab (list);
+ enl_popup_grab (list, (GdkEvent *) event);
gtk_tree_view_get_dest_row_at_pos (
tree_view, event->x, event->y, &path, NULL);
@@ -591,7 +645,7 @@ e_name_selector_list_expand_clicked (ENameSelectorList *list)
if (!gtk_widget_get_visible (GTK_WIDGET (list->priv->popup))) {
enl_popup_position (list);
gtk_widget_show_all (GTK_WIDGET (list->priv->popup));
- enl_popup_grab (list);
+ enl_popup_grab (list, NULL);
list->priv->rows = e_destination_store_get_destination_count (store);
enl_popup_size (list);
enl_tree_select_node (list, 1);
@@ -637,7 +691,7 @@ static void
e_name_selector_list_init (ENameSelectorList *list)
{
GtkCellRenderer *renderer;
- GtkWidget *scroll, *popup_frame, *vbox;
+ GtkWidget *scroll, *popup_frame, *vgrid;
GtkTreeSelection *selection;
GtkTreeViewColumn *column;
ENameSelectorEntry *entry;
@@ -677,6 +731,8 @@ e_name_selector_list_init (ENameSelectorList *list)
gtk_widget_set_size_request (
gtk_scrolled_window_get_vscrollbar (
GTK_SCROLLED_WINDOW (scroll)), -1, 0);
+ gtk_widget_set_vexpand (scroll, TRUE);
+ gtk_widget_set_valign (scroll, GTK_ALIGN_FILL);
list->priv->popup = GTK_WINDOW (gtk_window_new (GTK_WINDOW_POPUP));
gtk_window_set_resizable (GTK_WINDOW (list->priv->popup), FALSE);
@@ -687,11 +743,15 @@ e_name_selector_list_init (ENameSelectorList *list)
gtk_container_add (GTK_CONTAINER (list->priv->popup), popup_frame);
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add (GTK_CONTAINER (popup_frame), vbox);
+ vgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "column-homogeneous", FALSE,
+ "row-spacing", 0,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (popup_frame), vgrid);
gtk_container_add (GTK_CONTAINER (scroll), list->priv->tree_view);
- gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
+ gtk_container_add (GTK_CONTAINER (vgrid), scroll);
g_signal_connect_after (
GTK_WIDGET (list), "focus-in-event",
diff --git a/libedataserverui/e-passwords-win32.c b/libedataserverui/e-passwords-win32.c
index 274683b..51c0cb2 100644
--- a/libedataserverui/e-passwords-win32.c
+++ b/libedataserverui/e-passwords-win32.c
@@ -604,14 +604,18 @@ update_capslock_state (GtkDialog *dialog,
GdkModifierType mask = 0;
GdkWindow *window;
gchar *markup = NULL;
+ GdkDeviceManager *device_manager;
+ GdkDevice *device;
+ device_manager = gdk_display_get_device_manager (gtk_widget_get_display (label));
+ device = gdk_device_manager_get_client_pointer (device_manager);
window = gtk_widget_get_window (GTK_WIDGET (dialog));
- gdk_window_get_pointer (window, NULL, NULL, &mask);
+ gdk_window_get_device_position (window, device, NULL, NULL, &mask);
/* The space acts as a vertical placeholder. */
markup = g_markup_printf_escaped (
"<small>%s</small>", (mask & GDK_LOCK_MASK) ?
- _("You have the Caps Lock key on.") : " ");
+ _("You have the Caps Lock key on.") : " ");
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
@@ -657,12 +661,10 @@ ep_ask_password (EPassMsg *msg)
gtk_box_set_spacing (GTK_BOX (content_area), 12);
gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
- /* Table */
- container = gtk_table_new (2, 3, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (container), 12);
- gtk_table_set_row_spacings (GTK_TABLE (container), 6);
- gtk_table_set_row_spacing (GTK_TABLE (container), 0, 12);
- gtk_table_set_row_spacing (GTK_TABLE (container), 1, 0);
+ /* Grid */
+ container = gtk_grid_new ();
+ gtk_grid_set_column_spacing (GTK_GRID (container), 12);
+ gtk_grid_set_row_spacing (GTK_GRID (container), 6);
gtk_widget_show (container);
gtk_box_pack_start (
@@ -672,22 +674,27 @@ ep_ask_password (EPassMsg *msg)
widget = gtk_image_new_from_icon_name (
"dialog-password", GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.0);
+ g_object_set (G_OBJECT (widget),
+ "halign", GTK_ALIGN_FILL,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 0, 1, 0, 3, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 3);
/* Password Label */
widget = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
gtk_label_set_markup (GTK_LABEL (widget), msg->prompt);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 1, 1);
/* Password Entry */
widget = gtk_entry_new ();
@@ -697,6 +704,10 @@ ep_ask_password (EPassMsg *msg)
gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
gtk_widget_grab_focus (widget);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
msg->entry = widget;
@@ -709,17 +720,17 @@ ep_ask_password (EPassMsg *msg)
}
}
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 1, 1);
/* Caps Lock Label */
widget = gtk_label_new (NULL);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 2, 1, 1);
g_signal_connect (
password_dialog, "key-release-event",
@@ -749,12 +760,15 @@ ep_ask_password (EPassMsg *msg)
GTK_TOGGLE_BUTTON (widget), *msg->remember);
if (msg->flags & E_PASSWORDS_DISABLE_REMEMBER)
gtk_widget_set_sensitive (widget, FALSE);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
msg->check = widget;
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 3, 1, 1);
}
msg->noreply = noreply;
diff --git a/libedataserverui/e-passwords.c b/libedataserverui/e-passwords.c
index 2cb7666..bf4cfc1 100644
--- a/libedataserverui/e-passwords.c
+++ b/libedataserverui/e-passwords.c
@@ -450,9 +450,13 @@ update_capslock_state (GtkDialog *dialog,
GdkModifierType mask = 0;
GdkWindow *window;
gchar *markup = NULL;
+ GdkDeviceManager *device_manager;
+ GdkDevice *device;
+ device_manager = gdk_display_get_device_manager (gtk_widget_get_display (label));
+ device = gdk_device_manager_get_client_pointer (device_manager);
window = gtk_widget_get_window (GTK_WIDGET (dialog));
- gdk_window_get_pointer (window, NULL, NULL, &mask);
+ gdk_window_get_device_position (window, device, NULL, NULL, &mask);
/* The space acts as a vertical placeholder. */
markup = g_markup_printf_escaped (
@@ -500,12 +504,10 @@ ep_ask_password (EPassMsg *msg)
gtk_box_set_spacing (GTK_BOX (content_area), 12);
gtk_container_set_border_width (GTK_CONTAINER (content_area), 0);
- /* Table */
- container = gtk_table_new (2, 3, FALSE);
- gtk_table_set_col_spacings (GTK_TABLE (container), 12);
- gtk_table_set_row_spacings (GTK_TABLE (container), 6);
- gtk_table_set_row_spacing (GTK_TABLE (container), 0, 12);
- gtk_table_set_row_spacing (GTK_TABLE (container), 1, 0);
+ /* Grid */
+ container = gtk_grid_new ();
+ gtk_grid_set_column_spacing (GTK_GRID (container), 12);
+ gtk_grid_set_row_spacing (GTK_GRID (container), 6);
gtk_widget_show (container);
gtk_box_pack_start (
@@ -515,22 +517,27 @@ ep_ask_password (EPassMsg *msg)
widget = gtk_image_new_from_icon_name (
"dialog-password", GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.0);
+ g_object_set (G_OBJECT (widget),
+ "halign", GTK_ALIGN_FILL,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 0, 1, 0, 3, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 1, 3);
/* Password Label */
widget = gtk_label_new (NULL);
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
gtk_label_set_markup (GTK_LABEL (widget), msg->prompt);
gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 0, 1, 1);
/* Password Entry */
widget = gtk_entry_new ();
@@ -540,6 +547,10 @@ ep_ask_password (EPassMsg *msg)
gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE);
gtk_widget_grab_focus (widget);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
msg->entry = widget;
@@ -552,17 +563,17 @@ ep_ask_password (EPassMsg *msg)
}
}
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 1, 1);
/* Caps Lock Label */
widget = gtk_label_new (NULL);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 2, 1, 1);
g_signal_connect (
password_dialog, "key-release-event",
@@ -592,12 +603,15 @@ ep_ask_password (EPassMsg *msg)
GTK_TOGGLE_BUTTON (widget), *msg->remember);
if (msg->flags & E_PASSWORDS_DISABLE_REMEMBER)
gtk_widget_set_sensitive (widget, FALSE);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
gtk_widget_show (widget);
msg->check = widget;
- gtk_table_attach (
- GTK_TABLE (container), widget,
- 1, 2, 3, 4, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_grid_attach (GTK_GRID (container), widget, 1, 3, 1, 1);
}
msg->noreply = noreply;
diff --git a/libedataserverui/e-source-selector-dialog.c b/libedataserverui/e-source-selector-dialog.c
index 1699a93..68e29fd 100644
--- a/libedataserverui/e-source-selector-dialog.c
+++ b/libedataserverui/e-source-selector-dialog.c
@@ -205,7 +205,7 @@ static void
source_selector_dialog_constructed (GObject *object)
{
ESourceSelectorDialog *dialog;
- GtkWidget *label, *hbox;
+ GtkWidget *label, *hgrid;
GtkWidget *container;
GtkWidget *widget;
gchar *label_text;
@@ -214,7 +214,11 @@ source_selector_dialog_constructed (GObject *object)
container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
- widget = gtk_vbox_new (FALSE, 12);
+ widget = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "column-homogeneous", FALSE,
+ "row-spacing", 12,
+ NULL);
gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
gtk_widget_show (widget);
@@ -225,16 +229,22 @@ source_selector_dialog_constructed (GObject *object)
label = gtk_label_new_with_mnemonic (label_text);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- gtk_box_pack_start (GTK_BOX (container), label, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (container), label);
gtk_widget_show (label);
g_free (label_text);
- hbox = gtk_hbox_new (FALSE, 12);
- gtk_box_pack_start (GTK_BOX (container), hbox, TRUE, TRUE, 0);
- gtk_widget_show (hbox);
+ hgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "row-homogeneous", FALSE,
+ "column-spacing", 12,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (container), hgrid);
+ gtk_widget_show (hgrid);
widget = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (hgrid), widget);
gtk_widget_show (widget);
widget = gtk_scrolled_window_new (NULL, NULL);
@@ -243,7 +253,11 @@ source_selector_dialog_constructed (GObject *object)
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (
GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
+ gtk_widget_set_hexpand (widget, TRUE);
+ gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
+ gtk_widget_set_vexpand (widget, TRUE);
+ gtk_widget_set_valign (widget, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (hgrid), widget);
gtk_widget_show (widget);
container = widget;
diff --git a/tests/libedataserverui/test-category-completion.c b/tests/libedataserverui/test-category-completion.c
index de557dc..2a11385 100644
--- a/tests/libedataserverui/test-category-completion.c
+++ b/tests/libedataserverui/test-category-completion.c
@@ -22,7 +22,7 @@ static gboolean
on_idle_create_widget (void)
{
GtkWidget *window;
- GtkWidget *vbox;
+ GtkWidget *vgrid;
GtkWidget *entry;
GtkEntryCompletion *completion;
@@ -33,13 +33,20 @@ on_idle_create_widget (void)
window, "delete-event",
G_CALLBACK (gtk_main_quit), NULL);
- vbox = gtk_vbox_new (FALSE, 3);
- gtk_container_add (GTK_CONTAINER (window), vbox);
+ vgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "column-homogeneous", FALSE,
+ "row-spacing", 3,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (window), vgrid);
entry = gtk_entry_new ();
completion = e_category_completion_new ();
gtk_entry_set_completion (GTK_ENTRY (entry), completion);
- gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
+ gtk_widget_set_vexpand (entry, TRUE);
+ gtk_widget_set_hexpand (entry, TRUE);
+ gtk_widget_set_halign (entry, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (vgrid), entry);
gtk_widget_show_all (window);
diff --git a/tests/libedataserverui/test-contact-store.c b/tests/libedataserverui/test-contact-store.c
index 2e19214..eeb4ed1 100644
--- a/tests/libedataserverui/test-contact-store.c
+++ b/tests/libedataserverui/test-contact-store.c
@@ -62,7 +62,7 @@ start_test (const gchar *param)
GtkWidget *scrolled_window;
GtkWidget *window;
GtkWidget *tree_view;
- GtkWidget *box;
+ GtkWidget *vgrid;
GtkWidget *entry;
GtkTreeViewColumn *column;
EBookClient *book_client;
@@ -70,14 +70,23 @@ start_test (const gchar *param)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- box = gtk_vbox_new (FALSE, 2);
- gtk_container_add (GTK_CONTAINER (window), box);
+ vgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "column-homogeneous", FALSE,
+ "row-spacing", 2,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (window), vgrid);
entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (box), entry, FALSE, TRUE, 0);
+ gtk_widget_set_halign (entry, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (vgrid), entry);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_box_pack_start (GTK_BOX (box), scrolled_window, TRUE, TRUE, 0);
+ gtk_widget_set_hexpand (scrolled_window, TRUE);
+ gtk_widget_set_halign (scrolled_window, GTK_ALIGN_FILL);
+ gtk_widget_set_vexpand (scrolled_window, TRUE);
+ gtk_widget_set_valign (scrolled_window, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (vgrid), scrolled_window);
contact_store = e_contact_store_new ();
model_sort = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (contact_store));
diff --git a/tests/libedataserverui/test-source-selector.c b/tests/libedataserverui/test-source-selector.c
index 82dbb83..db4a1e7 100644
--- a/tests/libedataserverui/test-source-selector.c
+++ b/tests/libedataserverui/test-source-selector.c
@@ -64,7 +64,7 @@ static gint
on_idle_create_widget (ESourceRegistry *registry)
{
GtkWidget *window;
- GtkWidget *vbox;
+ GtkWidget *vgrid;
GtkWidget *selector;
GtkWidget *scrolled_window;
GtkWidget *check;
@@ -76,8 +76,12 @@ on_idle_create_widget (ESourceRegistry *registry)
window, "delete-event",
G_CALLBACK (gtk_main_quit), NULL);
- vbox = gtk_vbox_new (FALSE, 6);
- gtk_container_add (GTK_CONTAINER (window), vbox);
+ vgrid = g_object_new (GTK_TYPE_GRID,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "column-homogeneous", FALSE,
+ "row-spacing", 6,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (window), vgrid);
selector = e_source_selector_new (registry, extension_name);
g_signal_connect (
@@ -91,10 +95,15 @@ on_idle_create_widget (ESourceRegistry *registry)
gtk_scrolled_window_set_shadow_type (
GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (scrolled_window), selector);
- gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
+ gtk_widget_set_hexpand (scrolled_window, TRUE);
+ gtk_widget_set_halign (scrolled_window, GTK_ALIGN_FILL);
+ gtk_widget_set_vexpand (scrolled_window, TRUE);
+ gtk_widget_set_valign (scrolled_window, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (vgrid), scrolled_window);
check = gtk_check_button_new_with_label ("Show colors");
- gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0);
+ gtk_widget_set_halign (check, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (vgrid), check);
g_object_bind_property (
selector, "show-colors",
@@ -103,7 +112,8 @@ on_idle_create_widget (ESourceRegistry *registry)
G_BINDING_SYNC_CREATE);
check = gtk_check_button_new_with_label ("Show toggles");
- gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0);
+ gtk_widget_set_halign (check, GTK_ALIGN_FILL);
+ gtk_container_add (GTK_CONTAINER (vgrid), check);
g_object_bind_property (
selector, "show-toggles",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]