[Goodies-commits] r2080 - in xfce4-dict-plugin/trunk: . panel-plugin

Enrico Troeger enrico at xfce.org
Sun Oct 1 17:21:08 CEST 2006


Author: enrico
Date: 2006-10-01 15:21:06 +0000 (Sun, 01 Oct 2006)
New Revision: 2080

Modified:
   xfce4-dict-plugin/trunk/ChangeLog
   xfce4-dict-plugin/trunk/configure.in.in
   xfce4-dict-plugin/trunk/panel-plugin/dict.c
Log:
* Added "Clear" button to the main window.
* New release: 0.2.0

Modified: xfce4-dict-plugin/trunk/ChangeLog
===================================================================
--- xfce4-dict-plugin/trunk/ChangeLog	2006-10-01 12:34:31 UTC (rev 2079)
+++ xfce4-dict-plugin/trunk/ChangeLog	2006-10-01 15:21:06 UTC (rev 2080)
@@ -1,3 +1,10 @@
+2006-10-01 enrico
+
+	* New release: 0.2.0
+	* Set focus to the search entry when showing the main window.
+	* Added "Clear" button to the main window(suggested by Joe Klemmer).
+
+
 2006-09-26 enrico
 
 	* Added optional text field in the panel.

Modified: xfce4-dict-plugin/trunk/configure.in.in
===================================================================
--- xfce4-dict-plugin/trunk/configure.in.in	2006-10-01 12:34:31 UTC (rev 2079)
+++ xfce4-dict-plugin/trunk/configure.in.in	2006-10-01 15:21:06 UTC (rev 2080)
@@ -4,7 +4,7 @@
 dnl
 
 dnl version info
-m4_define([dict_version], [0.1.1])
+m4_define([dict_version], [0.2.0])
 
 dnl init autoconf
 AC_INIT([xfce4-dict-plugin], [dict_version], [goodies-dev at xfce.org])

Modified: xfce4-dict-plugin/trunk/panel-plugin/dict.c
===================================================================
--- xfce4-dict-plugin/trunk/panel-plugin/dict.c	2006-10-01 12:34:31 UTC (rev 2079)
+++ xfce4-dict-plugin/trunk/panel-plugin/dict.c	2006-10-01 15:21:06 UTC (rev 2080)
@@ -793,6 +793,22 @@
 }
 
 
+static void clear_button_clicked_cb(GtkButton *button, DictData *dd)
+{
+	GtkTextIter start_iter, end_iter;
+
+	// clear the TextBuffer
+	gtk_text_buffer_get_start_iter(dd->main_textbuffer, &start_iter);
+	gtk_text_buffer_get_end_iter(dd->main_textbuffer, &end_iter);
+	gtk_text_buffer_delete(dd->main_textbuffer, &start_iter, &end_iter);
+	// clear the entries
+	gtk_entry_set_text(GTK_ENTRY(dd->main_entry), "");
+	gtk_entry_set_text(GTK_ENTRY(dd->panel_entry), "");
+
+	dict_status_add(dd, _("Ready."));
+}
+
+
 static void close_button_clicked(GtkWidget *button, DictData *dd)
 {
 	gtk_widget_hide(dd->window);
@@ -802,14 +818,14 @@
 static void dict_create_main_dialog(DictData *dd)
 {
 	GtkWidget *main_box;
-	GtkWidget *entry_box, *label_box, *entry_label, *entry_button, *close_button;
+	GtkWidget *entry_box, *label_box, *entry_label, *entry_button, *clear_button, *close_button;
 	GtkWidget *scrolledwindow_results;
 	//GtkWidget *dict_box, *dict_label, *combo_event_box;
 
 	dd->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 	gtk_window_set_title(GTK_WINDOW(dd->window), "xfce4-dict-plugin");
 	gtk_window_set_icon(GTK_WINDOW(dd->window), dd->icon);
-	gtk_window_set_default_size(GTK_WINDOW(dd->window), 450, 250);
+	gtk_window_set_default_size(GTK_WINDOW(dd->window), 500, 300);
 
 	g_signal_connect(G_OBJECT(dd->window), "delete_event", G_CALLBACK(gtk_widget_hide), NULL);
 
@@ -841,6 +857,11 @@
 	gtk_box_pack_start(GTK_BOX(entry_box), entry_button, FALSE, FALSE, 0);
 	g_signal_connect(entry_button, "clicked", G_CALLBACK(entry_button_clicked_cb), dd);
 
+	clear_button = gtk_button_new_from_stock("gtk-clear");
+	gtk_widget_show(clear_button);
+	gtk_box_pack_start(GTK_BOX(entry_box), clear_button, FALSE, FALSE, 0);
+	g_signal_connect(clear_button, "clicked", G_CALLBACK(clear_button_clicked_cb), dd);
+
 	close_button = gtk_button_new_from_stock("gtk-close");
 	gtk_widget_show(close_button);
 	gtk_box_pack_end(GTK_BOX(entry_box), close_button, FALSE, FALSE, 5);
@@ -949,6 +970,7 @@
 			dict_ask_server(dd, panel_text);
 			gtk_entry_set_text(GTK_ENTRY(dd->main_entry), panel_text);
 		}
+		gtk_widget_grab_focus(dd->main_entry);
 		gtk_widget_show(dd->window);
 	}
 }




More information about the Goodies-commits mailing list