[evolution-data-server] Bug #581288 - Remove .ui files from evolution-data-server



commit 15a7dd0db25880bbf79a0db22d882e3125db0b17
Author: Milan Crha <mcrha redhat com>
Date:   Thu Nov 11 12:05:59 2010 +0100

    Bug #581288 - Remove .ui files from evolution-data-server

 configure.ac                               |    3 -
 libedataserverui/Makefile.am               |    3 -
 libedataserverui/e-categories-dialog.c     |  227 ++++++++++-----
 libedataserverui/e-categories-dialog.ui    |  422 ----------------------------
 libedataserverui/e-name-selector-dialog.c  |  265 ++++++++++++------
 libedataserverui/e-name-selector-dialog.ui |  384 -------------------------
 po/POTFILES.in                             |    2 -
 7 files changed, 324 insertions(+), 982 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e1ba8e5..e1b71c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1384,9 +1384,6 @@ AC_SUBST(imagesdir)
 extensiondir='${libdir}'/evolution-data-server-$API_VERSION/extensions
 AC_SUBST(extensiondir)
 
-uidir="$privdatadir/ui"
-AC_SUBST(uidir)
-
 if test "x$use_gweather" = "xyes"; then
 	weatherdatadir="$privdatadir/weather"
 	AC_SUBST(weatherdatadir)
diff --git a/libedataserverui/Makefile.am b/libedataserverui/Makefile.am
index 0337fae..af2155a 100644
--- a/libedataserverui/Makefile.am
+++ b/libedataserverui/Makefile.am
@@ -134,12 +134,9 @@ test_name_selector_LDADD = $(TEST_EDATASERVERUI_LDFLAGS)
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libedataserverui-$(LIBEDATASERVERUI_API_VERSION).pc
 
-ui_DATA = e-categories-dialog.ui e-name-selector-dialog.ui
-
 BUILT_SOURCES = $(MARSHAL_GENERATED)
 
 EXTRA_DIST = 						\
-	$(ui_DATA)					\
 	e-data-server-ui-marshal.list			\
 	$(pkgconfig_DATA:-$(LIBEDATASERVERUI_API_VERSION).pc=.pc.in)
 
diff --git a/libedataserverui/e-categories-dialog.c b/libedataserverui/e-categories-dialog.c
index 8c2079a..8f14dd5 100644
--- a/libedataserverui/e-categories-dialog.c
+++ b/libedataserverui/e-categories-dialog.c
@@ -40,7 +40,6 @@
 G_DEFINE_TYPE (ECategoriesDialog, e_categories_dialog, GTK_TYPE_DIALOG)
 
 struct _ECategoriesDialogPrivate {
-	GtkBuilder *gui;
 	GtkWidget *categories_entry;
 	GtkWidget *categories_list;
 	GtkWidget *new_button;
@@ -65,7 +64,6 @@ static gpointer parent_class;
 
 typedef struct {
 	ECategoriesDialog *parent;
-	GtkBuilder *gui;
 	GtkWidget *the_dialog;
 	GtkWidget *category_name;
 	GtkWidget *category_icon;
@@ -119,49 +117,74 @@ category_name_changed_cb (GtkEntry *category_name_entry, CategoryPropertiesDialo
 }
 
 static CategoryPropertiesDialog *
-load_properties_dialog (ECategoriesDialog *parent)
+create_properties_dialog (ECategoriesDialog *parent)
 {
 	CategoryPropertiesDialog *prop_dialog;
-	const gchar *ui_to_load[] = { "properties-dialog", NULL };
-	gchar *uifile;
-	GError *error = NULL;
-	GtkWidget *table;
+	GtkWidget *properties_dialog;
+	GtkWidget *dialog_content;
+	GtkWidget *dialog_action_area;
+	GtkWidget *table_category_properties;
+	GtkWidget *label4;
+	GtkWidget *label6;
+	GtkWidget *category_name;
+	GtkWidget *cancelbutton1;
+	GtkWidget *okbutton1;
 
-	prop_dialog = g_new0 (CategoryPropertiesDialog, 1);
+	properties_dialog = gtk_dialog_new ();
+	gtk_window_set_title (GTK_WINDOW (properties_dialog), _("Category Properties"));
+	gtk_window_set_type_hint (GTK_WINDOW (properties_dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
 
-	uifile = g_build_filename (E_DATA_SERVER_UI_UIDIR,
-				      "e-categories-dialog.ui",
-				      NULL);
-	prop_dialog->gui = gtk_builder_new ();
-	gtk_builder_set_translation_domain (prop_dialog->gui, GETTEXT_PACKAGE);
+	dialog_content = gtk_dialog_get_content_area (GTK_DIALOG (properties_dialog));
 
-	if (!gtk_builder_add_objects_from_file (prop_dialog->gui, uifile, (gchar **) ui_to_load, &error)) {
-		g_object_unref (prop_dialog->gui);
-		g_free (prop_dialog);
-		g_free (uifile);
+	table_category_properties = gtk_table_new (3, 2, FALSE);
+	gtk_box_pack_start (GTK_BOX (dialog_content), table_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);
 
-		g_warning ("%s: Failed to load e-categories-dialog.ui, %s", G_STRFUNC, error ? error->message : "Unknown error");
+	label4 = gtk_label_new_with_mnemonic (_("Category _Name"));
+	gtk_table_attach (GTK_TABLE (table_category_properties), label4, 0, 1, 0, 1,
+			  (GtkAttachOptions) (GTK_FILL),
+			  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
 
-		if (error)
-			g_error_free (error);
+	label6 = gtk_label_new_with_mnemonic (_("Category _Icon"));
+	gtk_table_attach (GTK_TABLE (table_category_properties), label6, 0, 1, 2, 3,
+			  (GtkAttachOptions) (GTK_FILL),
+			  (GtkAttachOptions) (0), 0, 0);
+	gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
 
-		return NULL;
-	}
+	category_name = gtk_entry_new ();
+	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);
+
+	dialog_action_area = gtk_dialog_get_action_area (GTK_DIALOG (properties_dialog));
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area), GTK_BUTTONBOX_END);
+
+	cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
+	gtk_dialog_add_action_widget (GTK_DIALOG (properties_dialog), cancelbutton1, GTK_RESPONSE_CANCEL);
+	gtk_widget_set_can_default (cancelbutton1, TRUE);
+
+	okbutton1 = gtk_button_new_from_stock ("gtk-ok");
+	gtk_dialog_add_action_widget (GTK_DIALOG (properties_dialog), okbutton1, GTK_RESPONSE_OK);
+	gtk_widget_set_can_default (okbutton1, TRUE);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label4), category_name);
 
-	g_free (uifile);
+	gtk_widget_show_all (dialog_content);
 
+	prop_dialog = g_new0 (CategoryPropertiesDialog, 1);
 	prop_dialog->parent = parent;
 
-	prop_dialog->the_dialog = GTK_WIDGET (gtk_builder_get_object (prop_dialog->gui, "properties-dialog"));
+	prop_dialog->the_dialog = properties_dialog;
 	gtk_window_set_transient_for (GTK_WINDOW (prop_dialog->the_dialog), GTK_WINDOW (parent));
 
-	prop_dialog->category_name = GTK_WIDGET (gtk_builder_get_object (prop_dialog->gui, "category-name"));
+	prop_dialog->category_name = category_name;
 	g_signal_connect (prop_dialog->category_name, "changed", G_CALLBACK (category_name_changed_cb), prop_dialog);
 	category_name_changed_cb (GTK_ENTRY (prop_dialog->category_name), prop_dialog);
 
-	table = GTK_WIDGET (gtk_builder_get_object (prop_dialog->gui, "table-category-properties"));
-
-	if (table) {
+	if (table_category_properties) {
 		GtkFileChooser *chooser;
 		GtkWidget *dialog, *button;
 		GtkWidget *image = gtk_image_new ();
@@ -187,7 +210,7 @@ load_properties_dialog (ECategoriesDialog *parent)
 
 		prop_dialog->category_icon = GTK_WIDGET (chooser);
 		gtk_widget_show (prop_dialog->category_icon);
-		gtk_table_attach (GTK_TABLE (table), prop_dialog->category_icon, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
+		gtk_table_attach (GTK_TABLE (table_category_properties), prop_dialog->category_icon, 1, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
 
 		gtk_widget_show (image);
 
@@ -208,11 +231,6 @@ free_properties_dialog (CategoryPropertiesDialog *prop_dialog)
 		prop_dialog->the_dialog = NULL;
 	}
 
-	if (prop_dialog->gui) {
-		g_object_unref (prop_dialog->gui);
-		prop_dialog->gui = NULL;
-	}
-
 	g_free (prop_dialog);
 }
 
@@ -370,7 +388,7 @@ new_button_clicked_cb (GtkButton *button, gpointer user_data)
 
 	dialog = user_data;
 
-	prop_dialog = load_properties_dialog (dialog);
+	prop_dialog = create_properties_dialog (dialog);
 	if (!prop_dialog)
 		return;
 
@@ -436,7 +454,7 @@ edit_button_clicked_cb (GtkButton *button, gpointer user_data)
 	g_return_if_fail (g_list_length (selected) == 1);
 
 	/* load the properties dialog */
-	prop_dialog = load_properties_dialog (dialog);
+	prop_dialog = create_properties_dialog (dialog);
 	if (!prop_dialog)
 		return;
 
@@ -571,11 +589,6 @@ categories_dialog_dispose (GObject *object)
 
 	priv = E_CATEGORIES_DIALOG_GET_PRIVATE (object);
 
-	if (priv->gui != NULL) {
-		g_object_unref (priv->gui);
-		priv->gui = NULL;
-	}
-
 	g_hash_table_remove_all (priv->selected_categories);
 
 	/* Chain up to parent's dispose() method. */
@@ -619,44 +632,100 @@ e_categories_dialog_init (ECategoriesDialog *dialog)
 	GtkTreeViewColumn *column;
 	GtkTreeSelection *selection;
 	GtkTreeView *tree_view;
-	GtkWidget *main_widget;
-	GtkWidget *content_area;
-	gchar *uifile;
-	const gchar *ui_to_load[] = {"table-categories", NULL};
-	GError *error = NULL;
+	GtkWidget *dialog_content;
+	GtkWidget *table_categories;
+	GtkWidget *entry_categories;
+	GtkWidget *label_header;
+	GtkWidget *label2;
+	GtkWidget *scrolledwindow1;
+	GtkWidget *categories_list;
+	GtkWidget *hbuttonbox1;
+	GtkWidget *button_new;
+	GtkWidget *button_edit;
+	GtkWidget *alignment1;
+	GtkWidget *hbox1;
+	GtkWidget *image1;
+	GtkWidget *label3;
+	GtkWidget *button_delete;
+
+	dialog_content = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
+	table_categories = gtk_table_new (5, 1, FALSE);
+	gtk_box_pack_start (GTK_BOX (dialog_content), table_categories, TRUE, TRUE, 0);
+	gtk_container_set_border_width (GTK_CONTAINER (table_categories), 12);
+	gtk_table_set_row_spacings (GTK_TABLE (table_categories), 6);
+	gtk_table_set_col_spacings (GTK_TABLE (table_categories), 6);
+
+	entry_categories = gtk_entry_new ();
+	gtk_table_attach (GTK_TABLE (table_categories), entry_categories, 0, 1, 1, 2,
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+			  (GtkAttachOptions) (0), 0, 0);
+
+	label_header = gtk_label_new_with_mnemonic (_("Currently _used categories:"));
+	gtk_table_attach (GTK_TABLE (table_categories), label_header, 0, 1, 0, 1,
+			  (GtkAttachOptions) (GTK_FILL),
+			  (GtkAttachOptions) (0), 0, 0);
+	gtk_label_set_justify (GTK_LABEL (label_header), GTK_JUSTIFY_CENTER);
+	gtk_misc_set_alignment (GTK_MISC (label_header), 0, 0.5);
+
+	label2 = gtk_label_new_with_mnemonic (_("_Available Categories:"));
+	gtk_table_attach (GTK_TABLE (table_categories), label2, 0, 1, 2, 3,
+			  (GtkAttachOptions) (GTK_FILL),
+			  (GtkAttachOptions) (0), 0, 0);
+	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 (table_categories), scrolledwindow1, 0, 1, 3, 4,
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN);
+
+	categories_list = gtk_tree_view_new ();
+	gtk_container_add (GTK_CONTAINER (scrolledwindow1), categories_list);
+	gtk_widget_set_size_request (categories_list, -1, 350);
+	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (categories_list), FALSE);
+	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (categories_list), TRUE);
+
+	hbuttonbox1 = gtk_hbutton_box_new ();
+	gtk_table_attach (GTK_TABLE (table_categories), hbuttonbox1, 0, 1, 4, 5,
+			  (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),
+			  (GtkAttachOptions) (GTK_SHRINK), 0, 0);
+	gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 6);
+
+	button_new = gtk_button_new_from_stock ("gtk-new");
+	gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_new);
+	gtk_widget_set_can_default (button_new, TRUE);
+
+	button_edit = gtk_button_new ();
+	gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_edit);
+	gtk_widget_set_can_default (button_edit, TRUE);
+
+	alignment1 = gtk_alignment_new (0.5, 0.5, 0, 0);
+	gtk_container_add (GTK_CONTAINER (button_edit), alignment1);
+
+	hbox1 = gtk_hbox_new (FALSE, 2);
+	gtk_container_add (GTK_CONTAINER (alignment1), hbox1);
+
+	image1 = gtk_image_new_from_stock ("gtk-properties", GTK_ICON_SIZE_BUTTON);
+	gtk_box_pack_start (GTK_BOX (hbox1), image1, FALSE, FALSE, 0);
+
+	label3 = gtk_label_new_with_mnemonic (_("_Edit"));
+	gtk_box_pack_start (GTK_BOX (hbox1), label3, FALSE, FALSE, 0);
+
+	button_delete = gtk_button_new_from_stock ("gtk-delete");
+	gtk_container_add (GTK_CONTAINER (hbuttonbox1), button_delete);
+	gtk_widget_set_can_default (button_delete, TRUE);
+
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label_header), entry_categories);
+	gtk_label_set_mnemonic_widget (GTK_LABEL (label2), categories_list);
 
 	dialog->priv = E_CATEGORIES_DIALOG_GET_PRIVATE (dialog);
 	dialog->priv->selected_categories = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
 
-	/* load the UI from our UI file */
-	uifile = g_build_filename (E_DATA_SERVER_UI_UIDIR,
-				      "e-categories-dialog.ui",
-				      NULL);
-	dialog->priv->gui = gtk_builder_new ();
-	gtk_builder_set_translation_domain (dialog->priv->gui, GETTEXT_PACKAGE);
-
-	if (!gtk_builder_add_objects_from_file (dialog->priv->gui, uifile, (gchar **) ui_to_load, &error)) {
-		g_free (uifile);
-		g_object_unref (dialog->priv->gui);
-		dialog->priv->gui = NULL;
-
-		g_warning ("%s: can't load e-categories-dialog.ui file, %s", G_STRFUNC, error ? error->message : "Unknown error");
-
-		if (error)
-			g_error_free (error);
-
-		return;
-	}
-
-	g_free (uifile);
-
-	content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
-
-	main_widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "table-categories"));
-	gtk_box_pack_start (GTK_BOX (content_area), main_widget, TRUE, TRUE, 0);
-
-	dialog->priv->categories_entry = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "entry-categories"));
-	dialog->priv->categories_list = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "categories-list"));
+	dialog->priv->categories_entry = entry_categories;
+	dialog->priv->categories_list = categories_list;
 
 	tree_view = GTK_TREE_VIEW (dialog->priv->categories_list);
 	selection = gtk_tree_view_get_selection (tree_view);
@@ -674,11 +743,11 @@ e_categories_dialog_init (ECategoriesDialog *dialog)
 	gtk_entry_set_completion (GTK_ENTRY (dialog->priv->categories_entry), completion);
 	g_object_unref (completion);
 
-	dialog->priv->new_button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "button-new"));
+	dialog->priv->new_button = button_new;
 	g_signal_connect (G_OBJECT (dialog->priv->new_button), "clicked", G_CALLBACK (new_button_clicked_cb), dialog);
-	dialog->priv->edit_button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "button-edit"));
+	dialog->priv->edit_button = button_edit;
 	g_signal_connect (G_OBJECT (dialog->priv->edit_button), "clicked", G_CALLBACK (edit_button_clicked_cb), dialog);
-	dialog->priv->delete_button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->gui, "button-delete"));
+	dialog->priv->delete_button = button_delete;
 	g_signal_connect_swapped (
 		G_OBJECT (dialog->priv->delete_button), "clicked",
 		G_CALLBACK (categories_dialog_delete_cb), dialog);
@@ -689,6 +758,8 @@ e_categories_dialog_init (ECategoriesDialog *dialog)
 	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
 	gtk_window_set_title (GTK_WINDOW (dialog), _("Categories"));
 
+	gtk_widget_show_all (dialog_content);
+
 	renderer = gtk_cell_renderer_toggle_new ();
 	g_signal_connect (G_OBJECT (renderer), "toggled", G_CALLBACK (category_toggled_cb), dialog);
 	column = gtk_tree_view_column_new_with_attributes ("?", renderer,
diff --git a/libedataserverui/e-name-selector-dialog.c b/libedataserverui/e-name-selector-dialog.c
index 7beb876..77976ad 100644
--- a/libedataserverui/e-name-selector-dialog.c
+++ b/libedataserverui/e-name-selector-dialog.c
@@ -64,17 +64,16 @@ typedef struct {
 } SelData;
 
 struct _ENameSelectorDialogPrivate {
-
 	ENameSelectorModel *name_selector_model;
 	GtkTreeModelSort *contact_sort;
 	GCancellable *cancellable;
 
-	GtkBuilder *gui;
 	GtkTreeView *contact_view;
 	GtkLabel *status_label;
 	GtkBox *destination_box;
 	GtkEntry *search_entry;
 	GtkSizeGroup *button_size_group;
+	GtkWidget *category_combobox;
 
 	GArray *sections;
 
@@ -115,8 +114,7 @@ e_name_selector_dialog_populate_categories (ENameSelectorDialog *name_selector_d
 	GList *category_list, *iter;
 
 	/* "Any Category" is preloaded. */
-	combo_box = GTK_WIDGET (gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "combobox-category"));
+	combo_box = name_selector_dialog->priv->category_combobox;
 	if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)) == -1)
 		gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
 
@@ -138,87 +136,187 @@ e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog)
 	GtkTreeSelection  *contact_selection;
 	GtkTreeViewColumn *column;
 	GtkCellRenderer   *cell_renderer;
-	GtkWidget         *widget;
-	GtkWidget         *container;
-	GtkWidget         *content_area;
-	GtkWidget	  *label;
-	GtkWidget         *parent;
 	GtkTreeSelection  *selection;
 	ESourceList       *source_list;
-	gchar             *uifile;
 	GConfClient *gconf_client;
-	gchar *uid;
-	GError *error = NULL;
+	gchar *uid, *tmp_str;
+	GtkWidget *name_selector_box;
+	GtkWidget *show_contacts_label;
+	GtkWidget *hbox2;
+	GtkWidget *label35;
+	GtkWidget *show_contacts_table;
+	GtkWidget *AddressBookLabel;
+	GtkWidget *label31;
+	GtkWidget *hbox1;
+	GtkWidget *search;
+	AtkObject *atko;
+	GtkWidget *label39;
+	GtkWidget *source_menu_box;
+	GtkWidget *combobox_category;
+	GtkWidget *label36;
+	GtkWidget *hbox3;
+	GtkWidget *label38;
+	GtkWidget *scrolledwindow1;
+	AtkRelationSet *tmp_relation_set;
+	AtkRelationType tmp_relationship;
+	AtkRelation *tmp_relation;
+	AtkObject *scrolledwindow1_relation_targets[1];
+	GtkWidget *source_tree_view;
+	GtkWidget *destination_box;
+	GtkWidget *status_message;
+	GtkWidget *source_combo;
 
 	name_selector_dialog->priv =
 		E_NAME_SELECTOR_DIALOG_GET_PRIVATE (name_selector_dialog);
 
-	/* Get GtkBuilder GUI */
-	uifile = g_build_filename (E_DATA_SERVER_UI_UIDIR,
-				"e-name-selector-dialog.ui",
-				NULL);
-	name_selector_dialog->priv->gui = gtk_builder_new ();
-	gtk_builder_set_translation_domain (
-		name_selector_dialog->priv->gui, GETTEXT_PACKAGE);
-
-	if (!gtk_builder_add_from_file (
-		name_selector_dialog->priv->gui, uifile, &error)) {
-		g_free (uifile);
-		g_object_unref (name_selector_dialog->priv->gui);
-		name_selector_dialog->priv->gui = NULL;
-
-		g_warning ("%s: Cannot load e-name-selector-dialog.ui file, %s", G_STRFUNC, error ? error->message : "Unknown error");
-
-		if (error)
-			g_error_free (error);
-
-		return;
-	}
-
-	g_free (uifile);
-
-	widget = GTK_WIDGET (gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "name-selector-box"));
-	if (!widget) {
-		g_warning ("%s: Cannot load e-name-selector-dialog.ui file", G_STRFUNC);
-		g_object_unref (name_selector_dialog->priv->gui);
-		name_selector_dialog->priv->gui = NULL;
-		return;
-	}
+	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);
+
+	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_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);
+
+	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);
+
+	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_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 (_("Cate_gory:"));
+	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);
+
+	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);
+
+	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);
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX (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);
+	g_free (tmp_str);
+
+	hbox3 = gtk_hbox_new (FALSE, 12);
+	gtk_widget_show (hbox3);
+	gtk_box_pack_start (GTK_BOX (name_selector_box), hbox3, TRUE, TRUE, 0);
+
+	label38 = gtk_label_new ("");
+	gtk_widget_show (label38);
+	gtk_box_pack_start (GTK_BOX (hbox3), label38, FALSE, FALSE, 0);
+
+	scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
+	gtk_widget_show (scrolledwindow1);
+	gtk_box_pack_start (GTK_BOX (hbox3), scrolledwindow1, TRUE, TRUE, 0);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN);
+
+	source_tree_view = gtk_tree_view_new ();
+	gtk_widget_show (source_tree_view);
+	gtk_container_add (GTK_CONTAINER (scrolledwindow1), source_tree_view);
+	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (source_tree_view), FALSE);
+	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);
+
+	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_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);
+
+	atko = gtk_widget_get_accessible (search);
+	atk_object_set_name (atko, _("Search"));
+
+	atko = gtk_widget_get_accessible (source_menu_box);
+	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);
+	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);
+	g_object_unref (G_OBJECT (tmp_relation));
+	g_object_unref (G_OBJECT (tmp_relation_set));
 
 	/* Get addressbook sources */
 
 	if (!e_book_get_addressbooks (&source_list, NULL)) {
 		g_warning ("ENameSelectorDialog can't find any addressbooks!");
-		g_object_unref (name_selector_dialog->priv->gui);
 		return;
 	}
 
-	/* Reparent it to inside ourselves */
-
-	content_area = gtk_dialog_get_content_area (
-		GTK_DIALOG (name_selector_dialog));
-
-	g_object_ref (widget);
-	parent = gtk_widget_get_parent (widget);
-	gtk_container_remove (GTK_CONTAINER (parent), widget);
-	gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
-	g_object_unref (widget);
+	gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (name_selector_dialog))), name_selector_box, TRUE, TRUE, 0);
 
 	/* Store pointers to relevant widgets */
 
-	name_selector_dialog->priv->contact_view = GTK_TREE_VIEW (
-		gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "source-tree-view"));
-	name_selector_dialog->priv->status_label = GTK_LABEL (
-		gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "status-message"));
-	name_selector_dialog->priv->destination_box = GTK_BOX (
-		gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "destination-box"));
-	name_selector_dialog->priv->search_entry = GTK_ENTRY (
-		gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "search"));
+	name_selector_dialog->priv->contact_view = GTK_TREE_VIEW (source_tree_view);
+	name_selector_dialog->priv->status_label = GTK_LABEL (status_message);
+	name_selector_dialog->priv->destination_box = GTK_BOX (destination_box);
+	name_selector_dialog->priv->search_entry = GTK_ENTRY (search);
+	name_selector_dialog->priv->category_combobox = combobox_category;
 
 	/* Create size group for transfer buttons */
 
@@ -274,44 +372,33 @@ e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog)
 
 	/* Create source menu */
 
-	widget = e_source_combo_box_new (source_list);
+	source_combo = e_source_combo_box_new (source_list);
 	g_signal_connect_swapped (
-		widget, "changed",
+		source_combo, "changed",
 		G_CALLBACK (source_changed), name_selector_dialog);
 	g_object_unref (source_list);
 
 	if (uid) {
 		e_source_combo_box_set_active_uid (
-			E_SOURCE_COMBO_BOX (widget), uid);
+			E_SOURCE_COMBO_BOX (source_combo), uid);
 		g_free (uid);
 	}
 
-	label = GTK_WIDGET (gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "AddressBookLabel"));
-	gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
-
-	gtk_widget_show (widget);
-
-	container = GTK_WIDGET (gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "source-menu-box"));
-	gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+	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);
 
 	e_name_selector_dialog_populate_categories (name_selector_dialog);
 
 	/* Set up search-as-you-type signal */
 
-	widget = GTK_WIDGET (gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "search"));
-	g_signal_connect_swapped (widget, "changed", G_CALLBACK (search_changed), name_selector_dialog);
+	g_signal_connect_swapped (search, "changed", G_CALLBACK (search_changed), name_selector_dialog);
 
 	/* Display initial source */
 
 	/* TODO: Remember last used source */
 
 	/* Set up dialog defaults */
-#if 0 // MEEGO - but we should consider for everyone
-	gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (name_selector_dialog->gui, "show-contacts-label")));
-#endif
 
 	gtk_dialog_add_buttons (GTK_DIALOG (name_selector_dialog),
 				GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
@@ -326,7 +413,7 @@ e_name_selector_dialog_init (ENameSelectorDialog *name_selector_dialog)
 #endif
 	gtk_container_set_border_width  (GTK_CONTAINER (name_selector_dialog), 4);
 	gtk_window_set_title            (GTK_WINDOW (name_selector_dialog), _("Select Contacts from Address Book"));
-	gtk_widget_grab_focus (widget);
+	gtk_widget_grab_focus (search);
 }
 
 static void
@@ -807,9 +894,8 @@ book_loaded_cb (ESource *source,
 	if (error != NULL) {
 		gchar *message;
 
-		/* FIXME This shold be translated, no? */
 		message = g_strdup_printf (
-			"Error loading address book: %s", error->message);
+			_("Error loading address book: %s"), error->message);
 		gtk_label_set_text (
 			name_selector_dialog->priv->status_label, message);
 		g_free (message);
@@ -883,8 +969,7 @@ search_changed (ENameSelectorDialog *name_selector_dialog)
 	gchar         *category_escaped;
 	gchar         *user_fields_str;
 
-	combo_box = GTK_WIDGET (gtk_builder_get_object (
-		name_selector_dialog->priv->gui, "combobox-category"));
+	combo_box = priv->category_combobox;
 	if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)) == -1)
 		gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 60fa350..1e0d1ad 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -190,11 +190,9 @@ libedataserver/e-categories.c
 libedataserver/e-time-utils.c
 libedataserverui/e-book-auth-util.c
 libedataserverui/e-categories-dialog.c
-[type: gettext/glade]libedataserverui/e-categories-dialog.ui
 libedataserverui/e-category-completion.c
 libedataserverui/e-cell-renderer-color.c
 libedataserverui/e-name-selector-dialog.c
-[type: gettext/glade]libedataserverui/e-name-selector-dialog.ui
 libedataserverui/e-name-selector-entry.c
 libedataserverui/e-name-selector-list.c
 libedataserverui/e-passwords.c



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