small patch to add a close button to the find bar for logview
- From: "David Hugh-Jones" <davidhughjones gmail com>
- To: gnome-utils-list gnome org
- Subject: small patch to add a close button to the find bar for logview
- Date: Sun, 17 Aug 2008 20:09:58 +0200
This is just me dipping my toe into Gnome coding - comments welcome.
David Hugh-Jones
PhD Candidate
Essex University Department of Government
http://davidhughjones.googlepages.com
Index: logview/logview-findbar.c
===================================================================
--- logview/logview-findbar.c (revision 8008)
+++ logview/logview-findbar.c (working copy)
@@ -27,6 +27,7 @@ struct LogviewFindBarPriv
{
GtkWidget *entry;
GtkWidget *clear_button;
+ GtkWidget *close_button;
gchar *search_string;
gpointer logview;
};
@@ -63,6 +64,16 @@ logview_findbar_clear (GtkWidget *widget
gtk_entry_set_text (GTK_ENTRY (findbar->priv->entry), "");
gtk_widget_hide (GTK_WIDGET (findbar));
}
+
+static void
+logview_findbar_close (GtkWidget *widget, gpointer data)
+{
+ LogviewFindBar *findbar = LOGVIEW_FINDBAR (data);
+ gtk_entry_set_text (GTK_ENTRY (findbar->priv->entry), "");
+ gtk_widget_hide (GTK_WIDGET (findbar));
+}
+
+
static gboolean
logview_findbar_entry_timeout (gpointer data)
@@ -138,6 +149,8 @@ logview_findbar_connect (LogviewFindBar
G_CALLBACK (logview_findbar_entry_changed_cb), findbar);
g_signal_connect (G_OBJECT (findbar->priv->clear_button), "clicked",
G_CALLBACK (logview_findbar_clear), findbar);
+ g_signal_connect(G_OBJECT (findbar->priv->close_button), "clicked",
+ G_CALLBACK (logview_findbar_close), findbar);
}
static void
@@ -155,10 +168,15 @@ logview_findbar_init (LogviewFindBar *fi
gtk_label_set_mnemonic_widget (GTK_LABEL (label), findbar->priv->entry);
findbar->priv->clear_button = gtk_button_new_with_mnemonic (_("_Clear"));
+ //findbar->priv->close_button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ findbar->priv->close_button = gtk_button_new ();
+ gtk_container_add(GTK_CONTAINER (findbar->priv->close_button),
+ gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_SMALL_TOOLBAR));
gtk_box_pack_start (GTK_BOX (findbar), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (findbar), findbar->priv->entry, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (findbar), findbar->priv->clear_button, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (findbar), findbar->priv->close_button, FALSE, FALSE, 0);
findbar->priv->search_string = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]