[evolution-kolab] EPlugin: simplification and layout fixes for sync conflict dialog



commit e9a0f299546996c4fe977513422a18ab9db44032
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Mon Jun 4 11:13:58 2012 +0200

    EPlugin: simplification and layout fixes for sync conflict dialog
    
    * removed entire "Take Option Duration" block
    * added "Remember my chioce" check button for
      user selection of sync conflict resolution
    * layouting fixes
    * added context to translatable strings

 src/eplugin/e-kolab-backend-sync-conflict.c |  200 ++++++++++++---------------
 1 files changed, 89 insertions(+), 111 deletions(-)
---
diff --git a/src/eplugin/e-kolab-backend-sync-conflict.c b/src/eplugin/e-kolab-backend-sync-conflict.c
index 76dd2d4..40715a9 100644
--- a/src/eplugin/e-kolab-backend-sync-conflict.c
+++ b/src/eplugin/e-kolab-backend-sync-conflict.c
@@ -45,15 +45,11 @@ struct _KolabBackendSyncConflictUIWidgets {
 	GtkWidget *lbl_local_modtime;
 	GtkWidget *lbl_remote_subject;
 	GtkWidget *lbl_remote_modtime;
-	GSList *radio_group;
-	GtkWidget *radio_btn_this_sync;
-	GtkWidget *radio_btn_this_session;
-	GtkWidget *radio_btn_permanent;
-	GtkWidget *radio_btn_ask_again;
 	GtkWidget *btn_strategy_newer;
 	GtkWidget *btn_strategy_server;
 	GtkWidget *btn_strategy_client;
 	GtkWidget *btn_strategy_dupe;
+	GtkWidget *chk_strategy_notaskagain;
 };
 
 typedef struct _KolabBackendSyncConflictUIData KolabBackendSyncConflictUIData;
@@ -83,12 +79,37 @@ enum {
 /*----------------------------------------------------------------------------*/
 /* internal statics (UI) */
 
+static GtkGrid*
+kolab_backend_sync_conflict_ui_grid_new (void)
+{
+	GtkGrid *grid = NULL;
 
-/*----------------------------------------------------------------------------*/
-/* API functions (non-UI) */
+	grid = GTK_GRID (gtk_grid_new ());
+	gtk_grid_set_row_homogeneous (grid, FALSE);
+	gtk_grid_set_row_spacing (grid, 6);
+	gtk_grid_set_column_homogeneous (grid, FALSE);
+	gtk_grid_set_column_spacing (grid, 16);
+	gtk_container_set_border_width (GTK_CONTAINER (grid), KOLAB_SYNC_CONFLICT_WIDGET_BORDER_WIDTH);
+	/* gtk_container_set_resize_mode (GTK_CONTAINER (grid), GTK_RESIZE_QUEUE); */
 
-/*----------------------------------------------------------------------------*/
-/* API functions (UI) */
+	return grid;
+}
+
+static GtkWidget*
+kolab_backend_sync_conflict_ui_label_new (const gchar *text,
+                                          gboolean add_bottom_space)
+{
+	GtkWidget *label = gtk_label_new (text);
+
+	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+
+	if (add_bottom_space)
+		gtk_widget_set_margin_bottom (label, 5);
+
+	gtk_misc_set_alignment (GTK_MISC (label), 0.0, 1.0);
+
+	return label;
+}
 
 static KolabBackendSyncConflictUIData*
 kolab_backend_sync_conflict_ui_new (void)
@@ -97,7 +118,6 @@ kolab_backend_sync_conflict_ui_new (void)
 	GtkWidget *content = NULL;
 	GtkWidget *ev_box = NULL;
 	GtkWidget *frame_info = NULL;
-	GtkWidget *frame_take_dur = NULL;
 	GtkWidget *frame_take = NULL;
 	GtkGrid *grid = NULL;
 	GtkWidget *widget = NULL;
@@ -116,6 +136,7 @@ kolab_backend_sync_conflict_ui_new (void)
 
 	/* sync conflict information */
 	frame_info = gtk_frame_new (NULL);
+	gtk_frame_set_shadow_type (GTK_FRAME (frame_info), GTK_SHADOW_ETCHED_IN);
 	gtk_container_set_border_width (GTK_CONTAINER (frame_info), KOLAB_SYNC_CONFLICT_WIDGET_BORDER_WIDTH);
 	gtk_container_add (GTK_CONTAINER (content), frame_info);
 	ev_box = gtk_event_box_new ();
@@ -124,183 +145,133 @@ kolab_backend_sync_conflict_ui_new (void)
 	gtk_container_add (GTK_CONTAINER (frame_info), ev_box);
 	widget = gtk_label_new (NULL);
 	gtk_label_set_text (GTK_LABEL (widget),
-	                    _("A synchronization error occured: \nProbably someone modified an entry remotely (i.e. on the server), \nwhich you have also modified locally (i.e. on your client)."));
+	                    C_("Sync Conflict Resolution",
+	                       "A synchronization error occured: \nProbably someone modified an entry remotely (i.e. on the server), \nwhich you have also modified locally (i.e. on your client)."));
 	gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_LEFT);
+	gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
 	gtk_container_add (GTK_CONTAINER (ev_box), widget);
 
 	/* object detail */
 
-	grid = GTK_GRID (gtk_grid_new ());
-	gtk_grid_set_row_homogeneous (grid, TRUE);
-	gtk_grid_set_row_spacing (grid, 6);
-	gtk_grid_set_column_homogeneous (grid, FALSE);
-	gtk_grid_set_column_spacing (grid, 6);
-	gtk_container_set_border_width (GTK_CONTAINER (grid), KOLAB_SYNC_CONFLICT_WIDGET_BORDER_WIDTH);
-	/* gtk_container_set_resize_mode (GTK_CONTAINER (grid), GTK_RESIZE_QUEUE); */
+	grid = kolab_backend_sync_conflict_ui_grid_new ();
 	gtk_container_add (GTK_CONTAINER (content), GTK_WIDGET (grid));
-
 	row = 0;
 
 	/* conflict folder name */
-	tmp_str = g_strconcat (_("Conflict in folder"), ":", NULL);
-	label = gtk_label_new (tmp_str);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-	g_free (tmp_str);
+	label = kolab_backend_sync_conflict_ui_label_new (C_("Sync Conflict Resolution",
+	                                                     "Conflict in folder:"),
+	                                                  TRUE);
 	gtk_grid_attach (grid, label, 0, row, 1, 1);
-	label = gtk_label_new (NULL /* FIXME add folder path here */);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+	label = kolab_backend_sync_conflict_ui_label_new ("INBOX/Calendar" /* FIXME add folder path here */,
+	                                                  TRUE);
 	uidata->widgets->lbl_folder_name = label;
 	gtk_grid_attach (grid, label, 1, row, 1, 1);
 
 	row++;
 
 	/* local object - subject */
-	tmp_str = g_strconcat (_("Local entry"), ":", NULL);
-	label = gtk_label_new (tmp_str);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-	g_free (tmp_str);
+	label = kolab_backend_sync_conflict_ui_label_new (C_("Sync Conflict Resolution",
+	                                                     "Local entry:"),
+	                                                  FALSE);
 	gtk_grid_attach (grid, label, 0, row, 1, 1);
-	label = gtk_label_new (NULL /* FIXME add subject here */);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+	label = kolab_backend_sync_conflict_ui_label_new ("Meeting" /* FIXME add subject here */,
+	                                                  FALSE);
 	uidata->widgets->lbl_local_subject = label;
 	gtk_grid_attach (grid, label, 1, row, 1, 1);
 
 	row++;
 
 	/* local object - last modified */
-	tmp_str = g_strconcat (_("Last modified"), ":", NULL);
-	label = gtk_label_new (tmp_str);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-	g_free (tmp_str);
+	label = kolab_backend_sync_conflict_ui_label_new (C_("Sync Conflict Resolution",
+	                                                     "Last modified:"),
+	                                                  TRUE);
 	gtk_grid_attach (grid, label, 0, row, 1, 1);
-	label = gtk_label_new (NULL /* FIXME add modtime here */);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+	label = kolab_backend_sync_conflict_ui_label_new ("2012-06-01 18:05" /* FIXME add modtime here */,
+	                                                  TRUE);
 	uidata->widgets->lbl_local_modtime = label;
 	gtk_grid_attach (grid, label, 1, row, 1, 1);
 
 	row++;
 
 	/* remote object - subject */
-	tmp_str = g_strconcat (_("Remote entry"), ":", NULL);
-	label = gtk_label_new (tmp_str);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-	g_free (tmp_str);
+	label = kolab_backend_sync_conflict_ui_label_new (C_("Sync Conflict Resolution",
+	                                                     "Remote entry:"),
+	                                                  FALSE);
 	gtk_grid_attach (grid, label, 0, row, 1, 1);
-	label = gtk_label_new (NULL /* FIXME add subject here */);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+	label = kolab_backend_sync_conflict_ui_label_new ("Meeting - modified" /* FIXME add subject here */,
+	                                                  FALSE);
 	uidata->widgets->lbl_remote_subject = label;
 	gtk_grid_attach (grid, label, 1, row, 1, 1);
 
 	row++;
 
 	/* remote object - last modified */
-	tmp_str = g_strconcat (_("Last modified"), ":", NULL);
-	label = gtk_label_new (tmp_str);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-	g_free (tmp_str);
+	label = kolab_backend_sync_conflict_ui_label_new (C_("Sync Conflict Resolution",
+	                                                     "Last modified:"),
+	                                                  TRUE);
 	gtk_grid_attach (grid, label, 0, row, 1, 1);
-	label = gtk_label_new (NULL /* FIXME add modtime here */);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+	label = kolab_backend_sync_conflict_ui_label_new ("2012-06-01 18:05" /* FIXME add modtime here */,
+	                                                  TRUE);
 	uidata->widgets->lbl_remote_modtime = label;
 	gtk_grid_attach (grid, label, 1, row, 1, 1);
 
-	row++;
-
-	/* take option duration */
-
-	frame_take_dur = gtk_frame_new (_("Take option duration"));
-	gtk_container_set_border_width (GTK_CONTAINER (frame_take_dur), KOLAB_SYNC_CONFLICT_WIDGET_BORDER_WIDTH);
-	gtk_container_add (GTK_CONTAINER (content), frame_take_dur);
-
-	grid = GTK_GRID (gtk_grid_new ());
-	gtk_grid_set_row_homogeneous (grid, TRUE);
-	gtk_grid_set_row_spacing (grid, 0);
-	gtk_grid_set_column_homogeneous (grid, FALSE);
-	gtk_grid_set_column_spacing (grid, 6);
-	gtk_container_set_border_width (GTK_CONTAINER (grid), 6);
-	/* gtk_container_set_resize_mode (GTK_CONTAINER (grid), GTK_RESIZE_QUEUE); */
-	gtk_container_add (GTK_CONTAINER (frame_take_dur), GTK_WIDGET (grid));
-
-	row = 0;
-
-	tmp_str = g_strconcat (_("Please choose how long the \"Take option\" specified below \nshould remain in effect"), ":", NULL);
-	label = gtk_label_new (tmp_str);
-	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-	g_free (tmp_str);
-	gtk_grid_attach (grid, label, 1, row, 1, 1);
-
-	row++;
-
-	widget = gtk_radio_button_new_with_label (NULL, _("Apply to all conflicts occuring during this synchronization"));
-	uidata->widgets->radio_btn_this_sync = widget;
-	uidata->widgets->radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
-	gtk_grid_attach (grid, widget, 1, row, 1, 1);
-
-	row++;
-
-	widget = gtk_radio_button_new_with_label (uidata->widgets->radio_group, _("Apply to all conflicts occuring during this Evolution session"));
-	uidata->widgets->radio_btn_this_session = widget;
-	gtk_grid_attach (grid, widget, 1, row, 1, 1);
-
-	row++;
-
-	widget = gtk_radio_button_new_with_label (uidata->widgets->radio_group, _("Apply always and permanently"));
-	uidata->widgets->radio_btn_permanent = widget;
-	gtk_grid_attach (grid, widget, 1, row, 1, 1);
-
-	row++;
-
-	widget = gtk_radio_button_new_with_label (uidata->widgets->radio_group, _("Apply only to this conflict (ask each time)"));
-	uidata->widgets->radio_btn_permanent = widget;
-	gtk_grid_attach (grid, widget, 1, row, 1, 1);
 
 	/* take options (actions!) */
 
-	frame_take = gtk_frame_new (_("Take options"));
+	frame_take = gtk_frame_new (C_("Sync Conflict Resolution",
+	                               "Take Option"));
+	gtk_frame_set_shadow_type (GTK_FRAME (frame_take), GTK_SHADOW_ETCHED_IN);
 	gtk_container_set_border_width (GTK_CONTAINER (frame_take), KOLAB_SYNC_CONFLICT_WIDGET_BORDER_WIDTH);
 	gtk_container_add (GTK_CONTAINER (content), frame_take);
 
-	grid = GTK_GRID (gtk_grid_new ());
-	gtk_grid_set_row_homogeneous (grid, TRUE);
-	gtk_grid_set_row_spacing (grid, 2);
-	gtk_grid_set_column_homogeneous (grid, FALSE);
-	gtk_grid_set_column_spacing (grid, 6);
-	gtk_container_set_border_width (GTK_CONTAINER (grid), 6);
-	/* gtk_container_set_resize_mode (GTK_CONTAINER (grid), GTK_RESIZE_QUEUE); */
+	grid = kolab_backend_sync_conflict_ui_grid_new ();
 	gtk_container_add (GTK_CONTAINER (frame_take), GTK_WIDGET (grid));
 
 	row = 0;
 
-	tmp_str = g_strconcat (_("Please choose which of the two entries should be retained"), ":", NULL);
+	tmp_str = g_strconcat (C_("Sync Conflict Resolution",
+	                          "Please choose which of the two entries should be retained"), ":", NULL);
 	label = gtk_label_new (tmp_str);
 	gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+	gtk_widget_set_hexpand (GTK_WIDGET (label), TRUE);
 	g_free (tmp_str);
 	gtk_grid_attach (grid, label, 1, row, 2, 1);
 
 	row++;
 
-	widget = gtk_button_new_with_label (_("Take Newer (last modified)"));
+	widget = gtk_button_new_with_label (C_("Sync Conflict Resolution",
+	                                       "Take Newer (last modified)"));
 	uidata->widgets->btn_strategy_newer = widget;
 	gtk_grid_attach (grid, widget, 1, row, 1, 1);
 
 	row++;
 
-	widget = gtk_button_new_with_label (_("Take Remote (server-side)"));
+	widget = gtk_button_new_with_label (C_("Sync Conflict Resolution",
+	                                       "Take Remote (server-side)"));
 	uidata->widgets->btn_strategy_server = widget;
 	gtk_grid_attach (grid, widget, 1, row, 1, 1);
 
 	row++;
 
-	widget = gtk_button_new_with_label (_("Take Local (client-side)"));
+	widget = gtk_button_new_with_label (C_("Sync Conflict Resolution",
+	                                       "Take Local (client-side)"));
 	uidata->widgets->btn_strategy_client = widget;
 	gtk_grid_attach (grid, widget, 1, row, 1, 1);
 
 	row++;
 
-	widget = gtk_button_new_with_label (_("Take Both (resulting in two different, parallel entries)"));
+	widget = gtk_button_new_with_label (C_("Sync Conflict Resolution",
+	                                       "Take Both (resulting in two different, parallel entries)"));
 	uidata->widgets->btn_strategy_dupe = widget;
 	gtk_grid_attach (grid, widget, 1, row, 1, 1);
 
+	row++;
+
+	widget = gtk_check_button_new_with_label (C_("Sync Conflict Resolution",
+	                                             "Remember my choice and do not ask me again for this folder"));
+	uidata->widgets->chk_strategy_notaskagain = widget;
+	gtk_grid_attach (grid, widget, 1, row, 1, 1);
+
 	/* FIXME connect signals */
 	g_warning ("%s: FIXME connect signals", __func__);
 
@@ -348,6 +319,13 @@ e_kolab_backend_sync_ui_conflict_response_cb (GObject *dialog,
 	g_warning ("%s: FIXME implement me", __func__);
 }
 
+/*----------------------------------------------------------------------------*/
+/* API functions (non-UI) */
+
+
+/*----------------------------------------------------------------------------*/
+/* API functions (UI) */
+
 void
 e_kolab_backend_sync_ui_conflict_cb (EShellView *shell_view)
 {



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