cpw.nader.asynclogging-3: 21a85065: Fixed the progress bars not being hidden...

morshed.nader at gmail.com morshed.nader at gmail.com
Thu May 19 17:16:17 EDT 2011


----------------------------------------------------------------------
Revision: 21a8506599f230df89091c99ba8face0ab8d56d8
Parent:   47c1a90defbd7efa7ea46a2a1d103c4cf32907a5
Author:   morshed.nader at gmail.com
Date:     05/18/11 06:02:33
Branch:   im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/21a8506599f230df89091c99ba8face0ab8d56d8

Changelog: 

Fixed the progress bars not being hidden in finch
More sanely figured out when/where the log viewer text labels should be added

Changes against parent 47c1a90defbd7efa7ea46a2a1d103c4cf32907a5

  patched  finch/gntlog.c

-------------- next part --------------
============================================================
--- finch/gntlog.c	b61386f63df3f9f566f9f8dc6e83253391ff1e5b
+++ finch/gntlog.c	266bb9e94e883a8717bcffe8a5f84332da450c8c
@@ -221,11 +221,12 @@ finch_log_search_done_cb(_finch_log_data
 static void
 finch_log_search_done_cb(_finch_log_data *finch_log_data)
 {
-/*	if (finch_log_data->is_window_open) {
+	if (finch_log_data->is_window_open) {
 		FinchLogViewer *lv = finch_log_data->log_viewer;
 
 		gnt_widget_hide(finch_log_viewer_get_search_bar(lv));
-	}*/
+		gnt_box_readjust(GNT_BOX(lv));
+	}
 
 	finch_log_data_free(finch_log_data);
 }
@@ -319,7 +320,7 @@ search_cb(GntWidget *button, FinchLogVie
 		"destroy", G_CALLBACK(finch_window_destroy_cb), finch_log_data);
 
 	bar = finch_log_viewer_get_search_bar(lv);
-	/* gnt_widget_show(bar);*/
+	gnt_widget_show(bar);
 	gnt_progress_bar_set_fraction(GNT_PROGRESS_BAR(bar), 0.0);
 
 	cancel = g_cancellable_new();
@@ -534,10 +535,11 @@ finch_log_done_cb(_finch_log_data *finch
 {
 	if (finch_log_data->is_window_open) {
 		FinchLogViewer *lv = finch_log_data->log_viewer;
-/*		GntWidget *bar = finch_log_viewer_get_list_bar(lv);*/
+		GntWidget *bar = finch_log_viewer_get_list_bar(lv);
 		GList *logs = finch_log_viewer_get_logs(lv);
 
-/*		gnt_widget_hide(bar);*/
+		gnt_widget_hide(bar);
+		gnt_box_readjust(GNT_BOX(lv));
 
 		if (logs == NULL) {
 			/* No logs were found. */
@@ -603,6 +605,8 @@ finch_log_size_cb(GObject *object, GAsyn
 	log_size = purple_logs_get_total_size_finish(res, &error);
 	finch_log_data->count--;
 
+	purple_debug_info("gntlog", "log size: %d\n", log_size);
+
 	if (log_size < 0) {
 		if (error->code != G_IO_ERROR_CANCELLED)
 			purple_debug_error("gntlog", "Error getting total log size: %s\n",
@@ -1128,8 +1132,7 @@ finch_log_viewer_set_total_size(FinchLog
 		gchar *sz_txt, *text;
 
 		sz_txt = purple_str_size_to_units(total);
-		text = g_strdup_printf("<span weight='bold'>%s</span> %s",
-			_("Total log size:"), sz_txt);
+		text = g_strdup_printf(_("Total log size: %s"), sz_txt);
 
 		gnt_label_set_text(GNT_LABEL(priv->size_label), text);
 
@@ -1252,18 +1255,9 @@ finch_log_viewer_constructed(GObject *ob
 	/* Log size */
 	need_log_size = finch_log_viewer_get_need_log_size(lv);
 
-	if (need_log_size) {
-		gchar *text;
-
-		/* Strange things associated with the log size being set on
-		   construction that need to be worked out */
-		text = g_strdup_printf("%s %s", _("Total log size:"),
-			_("calculating..."));
-
-		priv->size_label = gnt_label_new(text);
-		gnt_box_add_widget(GNT_BOX(priv->view_box), priv->size_label);
-
-		g_free(text);
+	if (!need_log_size) {
+		gnt_widget_hide(priv->size_label);
+		gnt_box_readjust(GNT_BOX(priv->view_box));
 	}
 
 	/* Hook up all the signals */
@@ -1560,6 +1554,7 @@ finch_log_viewer_init(FinchLogViewer *lv
 	FinchLogViewerPrivate *priv = FINCH_LOG_VIEWER_GET_PRIVATE(lv);
 	GntBox *box = GNT_BOX(lv);
 	GntWidget *vbox, *hbox;
+	gchar *text;
 
 	priv->logs = NULL;
 
@@ -1571,7 +1566,6 @@ finch_log_viewer_init(FinchLogViewer *lv
 	gnt_box_add_widget(box, vbox);
 
 	/* Label */
-	/* Fixme: get the title for this here or move it to constructed */
 	priv->label = gnt_label_new_with_format("", GNT_TEXT_FLAG_BOLD);
 	gnt_box_add_widget(GNT_BOX(vbox), priv->label);
 
@@ -1601,6 +1595,15 @@ finch_log_viewer_init(FinchLogViewer *lv
 	gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(priv->text), priv->entry);
 	gnt_text_view_attach_pager_widget(GNT_TEXT_VIEW(priv->text), priv->entry);
 
+	/* Label */
+	text = g_strdup_printf("%s %s", _("Total log size:"),
+		_("calculating..."));
+
+	priv->size_label = gnt_label_new_with_format(text, GNT_TEXT_FLAG_BOLD);
+	gnt_box_add_widget(GNT_BOX(vbox), priv->size_label);
+
+	g_free(text);
+
 	/* Progress bars */
 	priv->list_bar = gnt_progress_bar_new();
 	priv->search_bar = gnt_progress_bar_new();
@@ -1610,10 +1613,8 @@ finch_log_viewer_init(FinchLogViewer *lv
 	gnt_box_add_widget(GNT_BOX(vbox), priv->list_bar);
 	gnt_box_add_widget(GNT_BOX(vbox), priv->search_bar);
 
-	gnt_widget_show(GNT_WIDGET(lv));
-/*	gnt_widget_show_all(lv);
-	gnt_widget_hide(lv);
-	gnt_widget_hide(priv->search_bar);*/
+	gnt_widget_hide(priv->search_bar);
+	gnt_box_readjust(GNT_BOX(vbox));
 
 	priv->logs = NULL;
 	priv->search = NULL;


More information about the Commits mailing list