aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-01-24 21:13:09 +0800
committerMilan Crha <mcrha@redhat.com>2014-01-24 21:13:09 +0800
commit90f956ad4a0d7622bc9798893d53dbff8bb942bd (patch)
tree663f93f0e7603e71d663d2643104e209eb418179 /addressbook/gui
parent51cafd4067f700d1946bb6f68318127595f4a648 (diff)
downloadgsoc2013-evolution-90f956ad4a0d7622bc9798893d53dbff8bb942bd.tar
gsoc2013-evolution-90f956ad4a0d7622bc9798893d53dbff8bb942bd.tar.gz
gsoc2013-evolution-90f956ad4a0d7622bc9798893d53dbff8bb942bd.tar.bz2
gsoc2013-evolution-90f956ad4a0d7622bc9798893d53dbff8bb942bd.tar.lz
gsoc2013-evolution-90f956ad4a0d7622bc9798893d53dbff8bb942bd.tar.xz
gsoc2013-evolution-90f956ad4a0d7622bc9798893d53dbff8bb942bd.tar.zst
gsoc2013-evolution-90f956ad4a0d7622bc9798893d53dbff8bb942bd.zip
Bug #707121 - Merge contacts dialogs indefinitely expands by itself
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/widgets/Makefile.am7
-rw-r--r--addressbook/gui/widgets/eab-contact-commit-duplicate-detected.ui185
-rw-r--r--addressbook/gui/widgets/eab-contact-duplicate-detected.ui219
-rw-r--r--addressbook/gui/widgets/eab-contact-merging.c246
4 files changed, 196 insertions, 461 deletions
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
index 79ab1fb2f4..bfebe2125c 100644
--- a/addressbook/gui/widgets/Makefile.am
+++ b/addressbook/gui/widgets/Makefile.am
@@ -87,13 +87,8 @@ dist-hook:
etspec_DATA= e-addressbook-view.etspec
-ui_DATA = \
- eab-contact-duplicate-detected.ui \
- eab-contact-commit-duplicate-detected.ui
-
EXTRA_DIST = \
$(etspec_DATA) \
- $(rule_DATA) \
- $(ui_DATA)
+ $(rule_DATA)
-include $(top_srcdir)/git.mk
diff --git a/addressbook/gui/widgets/eab-contact-commit-duplicate-detected.ui b/addressbook/gui/widgets/eab-contact-commit-duplicate-detected.ui
deleted file mode 100644
index 04ed728a56..0000000000
--- a/addressbook/gui/widgets/eab-contact-commit-duplicate-detected.ui
+++ /dev/null
@@ -1,185 +0,0 @@
-<?xml version="1.0"?>
-<!--*- mode: xml -*-->
-<interface>
- <object class="GtkDialog" id="dialog-duplicate-contact">
- <property name="border_width">6</property>
- <property name="visible">True</property>
- <property name="title" translatable="yes">Duplicate Contact Detected</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <child>
- <object class="GtkButton" id="button3">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="button4">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-save</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
- <child>
- <object class="GtkTable" id="table1">
- <property name="border_width">6</property>
- <property name="visible">True</property>
- <property name="n_rows">5</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="EABContactDisplay" type-func="eab_contact_display_get_type" id="custom-old-contact">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">The name or email of this contact already exists in this folder. Would you like to save the changes anyway?</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Translators: Heading of the contact which has same name or email address in this folder already.">Conflicting Contact:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Changed Contact:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="EABContactDisplay" type-func="eab_contact_display_get_type" id="custom-new-contact">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkImage" id="custom2">
- <property name="visible">True</property>
- <property name="icon-name">avatar-default</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="1">button3</action-widget>
- <action-widget response="0">button4</action-widget>
- </action-widgets>
- </object>
-</interface>
diff --git a/addressbook/gui/widgets/eab-contact-duplicate-detected.ui b/addressbook/gui/widgets/eab-contact-duplicate-detected.ui
deleted file mode 100644
index 124b9c2787..0000000000
--- a/addressbook/gui/widgets/eab-contact-duplicate-detected.ui
+++ /dev/null
@@ -1,219 +0,0 @@
-<?xml version="1.0"?>
-<!--*- mode: xml -*-->
-<interface>
- <object class="GtkDialog" id="dialog-duplicate-contact">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Duplicate Contact Detected</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="height-request">400</property>
- <property name="width-request">500</property>
- <child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <child>
- <object class="GtkButton" id="button4">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="button3">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-add</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="button5">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Merge</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
- <child>
- <object class="GtkViewport" id="viewport1">
- <child>
- <object class="GtkTable" id="table1">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="n_rows">5</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="EABContactDisplay" type-func="eab_contact_display_get_type" id="custom-old-contact">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">The name or email address of this contact already exists
-in this folder. Would you like to add it anyway?</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Original Contact:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">New Contact:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="EABContactDisplay" type-func="eab_contact_display_get_type" id="custom-new-contact">
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
- <child>
- <object class="GtkImage" id="custom2">
- <property name="visible">True</property>
- <property name="icon-name">avatar-default</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="1">button4</action-widget>
- <action-widget response="0">button3</action-widget>
- <action-widget response="2">button5</action-widget>
- </action-widgets>
- </object>
-</interface>
diff --git a/addressbook/gui/widgets/eab-contact-merging.c b/addressbook/gui/widgets/eab-contact-merging.c
index 0a0903d5b3..05bc69665f 100644
--- a/addressbook/gui/widgets/eab-contact-merging.c
+++ b/addressbook/gui/widgets/eab-contact-merging.c
@@ -597,28 +597,210 @@ check_if_same (EContact *contact,
return res;
}
+static GtkWidget *
+create_iconic_button (const gchar *label,
+ const gchar *icon_name)
+{
+ GtkWidget *button, *image;
+
+ button = gtk_button_new_with_mnemonic (label);
+
+ if (icon_name) {
+ image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ }
+
+ return button;
+}
+
+static GtkWidget *
+create_duplicate_contact_detected_dialog (EContact *old_contact,
+ EContact *new_contact,
+ gboolean disable_merge,
+ gboolean is_for_commit)
+{
+ GtkWidget *widget, *scrolled;
+ GtkContainer *container;
+ GtkDialog *dialog;
+ const gchar *text;
+
+ widget = gtk_dialog_new ();
+ dialog = GTK_DIALOG (widget);
+
+ g_object_set (G_OBJECT (dialog),
+ "title", _("Duplicate Contact Detected"),
+ "default-width", 500,
+ "default-height", 400,
+ NULL);
+
+ gtk_dialog_add_action_widget (dialog, create_iconic_button (_("_Cancel"), GTK_STOCK_CANCEL), GTK_RESPONSE_CANCEL);
+
+ if (is_for_commit) {
+ gtk_dialog_add_action_widget (dialog, create_iconic_button (_("_Save"), "document-save"), GTK_RESPONSE_OK);
+ } else {
+ gtk_dialog_add_action_widget (dialog, create_iconic_button (_("_Add"), "list-add"), GTK_RESPONSE_OK);
+ gtk_dialog_add_action_widget (dialog, create_iconic_button (_("_Merge"), NULL), GTK_RESPONSE_APPLY);
+ }
+
+ if (disable_merge)
+ gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_APPLY, FALSE);
+
+ container = GTK_CONTAINER (gtk_dialog_get_content_area (dialog));
+
+ widget = gtk_grid_new ();
+ g_object_set (G_OBJECT (widget),
+ "orientation", GTK_ORIENTATION_HORIZONTAL,
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ "margin", 12,
+ NULL);
+
+ gtk_container_add (container, widget);
+ container = GTK_CONTAINER (widget);
+
+ widget = gtk_image_new_from_icon_name ("avatar-default", GTK_ICON_SIZE_BUTTON);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", FALSE,
+ "halign", GTK_ALIGN_START,
+ "vexpand", FALSE,
+ "valign", GTK_ALIGN_START,
+ "margin-right", 12,
+ NULL);
+ gtk_container_add (container, widget);
+
+ widget = gtk_grid_new ();
+ g_object_set (G_OBJECT (widget),
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ NULL);
+
+ gtk_container_add (container, widget);
+ container = GTK_CONTAINER (widget);
+
+ if (is_for_commit)
+ text = _("The name or email address of this contact already exists\n"
+ "in this folder. Would you like to save the changes anyway?");
+ else
+ text = _("The name or email address of this contact already exists\n"
+ "in this folder. Would you like to add it anyway?");
+
+ widget = gtk_label_new (text);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", FALSE,
+ "halign", GTK_ALIGN_START,
+ "vexpand", FALSE,
+ "valign", GTK_ALIGN_START,
+ "margin-bottom", 6,
+ NULL);
+ gtk_container_add (container, widget);
+
+ if (is_for_commit)
+ text = _("Changed Contact:");
+ else
+ text = _("New Contact:");
+
+ widget = gtk_label_new (text);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", FALSE,
+ "halign", GTK_ALIGN_START,
+ "vexpand", FALSE,
+ "valign", GTK_ALIGN_START,
+ "margin-bottom", 6,
+ NULL);
+ gtk_container_add (container, widget);
+
+ scrolled = gtk_scrolled_window_new (NULL, NULL);
+ g_object_set (G_OBJECT (scrolled),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
+ "margin-bottom", 6,
+ NULL);
+ gtk_container_add (container, scrolled);
+
+ widget = eab_contact_display_new ();
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ "contact", new_contact,
+ "mode", EAB_CONTACT_DISPLAY_RENDER_COMPACT,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (scrolled), widget);
+
+ if (is_for_commit)
+ text = _("Conflicting Contact:");
+ else
+ text = _("Old Contact:");
+
+ widget = gtk_label_new (text);
+ g_object_set (G_OBJECT (widget),
+ "hexpand", FALSE,
+ "halign", GTK_ALIGN_START,
+ "vexpand", FALSE,
+ "valign", GTK_ALIGN_START,
+ "margin-bottom", 6,
+ NULL);
+ gtk_container_add (container, widget);
+
+ scrolled = gtk_scrolled_window_new (NULL, NULL);
+ g_object_set (G_OBJECT (scrolled),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
+ NULL);
+ gtk_container_add (container, scrolled);
+
+ widget = eab_contact_display_new ();
+ g_object_set (G_OBJECT (widget),
+ "hexpand", TRUE,
+ "halign", GTK_ALIGN_FILL,
+ "vexpand", TRUE,
+ "valign", GTK_ALIGN_FILL,
+ "contact", old_contact,
+ "mode", EAB_CONTACT_DISPLAY_RENDER_COMPACT,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (scrolled), widget);
+
+ gtk_widget_show_all (gtk_dialog_get_content_area (dialog));
+
+ return GTK_WIDGET (dialog);
+}
+
static void
response (GtkWidget *dialog,
gint response,
EContactMergingLookup *lookup)
{
- static gint merge_response;
-
switch (response) {
- case 0:
+ case GTK_RESPONSE_OK:
doit (lookup, FALSE);
break;
- case 1:
+ case GTK_RESPONSE_CANCEL:
cancelit (lookup);
break;
- case 2:
- merge_response = mergeit (lookup);
- if (merge_response)
+ case GTK_RESPONSE_APPLY:
+ if (mergeit (lookup))
break;
return;
case GTK_RESPONSE_DELETE_EVENT:
cancelit (lookup);
break;
+ default:
+ g_warn_if_reached ();
+ break;
}
gtk_widget_destroy (dialog);
@@ -631,7 +813,7 @@ match_query_callback (EContact *contact,
gpointer closure)
{
EContactMergingLookup *lookup = closure;
- gint flag;
+ gboolean flag;
gboolean same_uids;
if (lookup->op == E_CONTACT_MERGING_FIND) {
@@ -656,63 +838,25 @@ match_query_callback (EContact *contact,
if ((gint) type <= (gint) EAB_CONTACT_MATCH_VAGUE || same_uids) {
doit (lookup, same_uids);
} else {
- GtkBuilder *builder;
- GtkWidget *container;
- GtkWidget *merge_button;
- GtkWidget *widget;
-
- builder = gtk_builder_new ();
+ GtkWidget *dialog;
lookup->match = g_object_ref (match);
if (lookup->op == E_CONTACT_MERGING_ADD) {
/* Compares all the values of contacts and return true, if they match */
flag = check_if_same (contact, match);
- e_load_ui_builder_definition (
- builder, "eab-contact-duplicate-detected.ui");
- merge_button = e_builder_get_widget (builder, "button5");
- /* Merge Button not sensitive when all values are same */
- if (flag)
- gtk_widget_set_sensitive (GTK_WIDGET (merge_button), FALSE);
+ dialog = create_duplicate_contact_detected_dialog (match, contact, flag, FALSE);
} else if (lookup->op == E_CONTACT_MERGING_COMMIT) {
- e_load_ui_builder_definition (
- builder, "eab-contact-commit-duplicate-detected.ui");
+ dialog = create_duplicate_contact_detected_dialog (match, contact, FALSE, TRUE);
} else {
doit (lookup, FALSE);
- g_object_unref (builder);
return;
}
- widget = e_builder_get_widget (builder, "custom-old-contact");
- eab_contact_display_set_mode (
- EAB_CONTACT_DISPLAY (widget),
- EAB_CONTACT_DISPLAY_RENDER_COMPACT);
- eab_contact_display_set_contact (
- EAB_CONTACT_DISPLAY (widget), match);
-
- widget = e_builder_get_widget (builder, "custom-new-contact");
- eab_contact_display_set_mode (
- EAB_CONTACT_DISPLAY (widget),
- EAB_CONTACT_DISPLAY_RENDER_COMPACT);
- eab_contact_display_set_contact (
- EAB_CONTACT_DISPLAY (widget), contact);
-
- widget = e_builder_get_widget (builder, "dialog-duplicate-contact");
-
- gtk_widget_ensure_style (widget);
-
- container = gtk_dialog_get_action_area (GTK_DIALOG (widget));
- gtk_container_set_border_width (GTK_CONTAINER (container), 12);
-
- container = gtk_dialog_get_content_area (GTK_DIALOG (widget));
- gtk_container_set_border_width (GTK_CONTAINER (container), 0);
-
g_signal_connect (
- widget, "response",
+ dialog, "response",
G_CALLBACK (response), lookup);
- gtk_widget_show_all (widget);
-
- g_object_unref (builder);
+ gtk_widget_show_all (dialog);
}
}