SF.net SVN: geany: [1079] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Dec 10 22:21:15 UTC 2006
Revision: 1079
http://svn.sourceforge.net/geany/?rev=1079&view=rev
Author: eht16
Date: 2006-12-10 14:21:15 -0800 (Sun, 10 Dec 2006)
Log Message:
-----------
Use a table to layout the word count dialog.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/dialogs.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-12-10 21:29:04 UTC (rev 1078)
+++ trunk/ChangeLog 2006-12-10 22:21:15 UTC (rev 1079)
@@ -4,6 +4,7 @@
src/prefs.c, src/vte.c, src/vte.h:
Added option to execute programs in the VTE instead of executing
them in a terminal emulation window (closes #1594456).
+ * src/dialogs.c: Use a table to layout the word count dialog.
2006-12-09 Nick Treleaven <nick.treleaven at btinternet.com>
Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c 2006-12-10 21:29:04 UTC (rev 1078)
+++ trunk/src/dialogs.c 2006-12-10 22:21:15 UTC (rev 1079)
@@ -429,10 +429,10 @@
void dialogs_show_word_count()
{
- GtkWidget *dialog, *label, *vbox;
+ GtkWidget *dialog, *label, *vbox, *table;
gint idx;
guint chars, lines, words;
- gchar *string, *text, *range;
+ gchar *text, *range;
idx = document_get_cur_idx();
if (idx == -1 || ! doc_list[idx].is_valid) return;
@@ -446,24 +446,77 @@
{
text = g_malloc0(sci_get_selected_text_length(doc_list[idx].sci) + 1);
sci_get_selected_text(doc_list[idx].sci, text);
- utils_wordcount(text, &chars, &lines, &words);
- g_free(text);
range = _("selection");
}
else
{
text = g_malloc(sci_get_length(doc_list[idx].sci) + 1);
sci_get_text(doc_list[idx].sci, sci_get_length(doc_list[idx].sci) + 1 , text);
- utils_wordcount(text, &chars, &lines, &words);
- g_free(text);
range = _("whole document");
}
- string = g_strdup_printf(_("Range:\t\t%s\n\nLines:\t\t%d\nWords:\t\t%d\nCharacters:\t%d"),
- range, lines, words, chars);
- label = gtk_label_new(string);
- g_free(string);
- gtk_container_add(GTK_CONTAINER(vbox), label);
+ utils_wordcount(text, &chars, &lines, &words);
+ g_free(text);
+ table = gtk_table_new(4, 2, FALSE);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 5);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 10);
+
+ label = gtk_label_new(_("Range:"));
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
+
+ label = gtk_label_new(range);
+ gtk_table_attach(GTK_TABLE(table), label, 1, 2, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+
+ label = gtk_label_new(_("Lines:"));
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
+
+ text = g_strdup_printf("%d", lines);
+ label = gtk_label_new(text);
+ gtk_table_attach(GTK_TABLE(table), label, 1, 2, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ g_free(text);
+
+ label = gtk_label_new(_("Words:"));
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
+
+ text = g_strdup_printf("%d", words);
+ label = gtk_label_new(text);
+ gtk_table_attach(GTK_TABLE(table), label, 1, 2, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ g_free(text);
+
+ label = gtk_label_new(_("Characters:"));
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment(GTK_MISC(label), 1, 0);
+
+ text = g_strdup_printf("%d", chars);
+ label = gtk_label_new(text);
+ gtk_table_attach(GTK_TABLE(table), label, 1, 2, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+ g_free(text);
+
+ gtk_container_add(GTK_CONTAINER(vbox), table);
+
g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog);
g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_destroy), dialog);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list