[libgda/LIBGDA_4.2] GdaBrowser: LDAP search filter UI improvements
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/LIBGDA_4.2] GdaBrowser: LDAP search filter UI improvements
- Date: Mon, 6 Jun 2011 19:05:01 +0000 (UTC)
commit 295c54eb4521d37d76086ed332bf8c850e139d54
Author: Vivien Malerba <malerba gnome-db org>
Date: Mon Jun 6 20:44:37 2011 +0200
GdaBrowser: LDAP search filter UI improvements
tools/browser/ldap-browser/filter-editor.c | 27 +++++++++++++++++++++++++
tools/browser/ldap-browser/filter-editor.h | 3 ++
tools/browser/ldap-browser/ldap-search-page.c | 14 ++++++++++--
3 files changed, 41 insertions(+), 3 deletions(-)
---
diff --git a/tools/browser/ldap-browser/filter-editor.c b/tools/browser/ldap-browser/filter-editor.c
index 14a1328..1fce75f 100644
--- a/tools/browser/ldap-browser/filter-editor.c
+++ b/tools/browser/ldap-browser/filter-editor.c
@@ -42,6 +42,13 @@ static void filter_editor_dispose (GObject *object);
static GObjectClass *parent_class = NULL;
+/* signals */
+enum {
+ ACTIVATE,
+ LAST_SIGNAL
+};
+
+gint filter_editor_signals [LAST_SIGNAL] = { 0 };
/*
* FilterEditor class implementation
@@ -54,6 +61,14 @@ filter_editor_class_init (FilterEditorClass *klass)
parent_class = g_type_class_peek_parent (klass);
+ filter_editor_signals [ACTIVATE] =
+ g_signal_new ("activate",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (FilterEditorClass, activate),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ klass->activate = NULL;
object_class->dispose = filter_editor_dispose;
}
@@ -105,6 +120,12 @@ filter_editor_get_type (void)
return type;
}
+static void
+activated_cb (GtkEntry *entry, FilterEditor *feditor)
+{
+ g_signal_emit (feditor, filter_editor_signals [ACTIVATE], 0);
+}
+
/**
* filter_editor_new:
*
@@ -149,14 +170,20 @@ filter_editor_new (BrowserConnection *bcnc)
entry = gtk_entry_new ();
gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, 0, 1);
feditor->priv->base_dn = entry;
+ g_signal_connect (entry, "activate",
+ G_CALLBACK (activated_cb), feditor);
entry = gtk_entry_new ();
gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, 1, 2);
feditor->priv->filter = entry;
+ g_signal_connect (entry, "activate",
+ G_CALLBACK (activated_cb), feditor);
entry = gtk_entry_new ();
gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, 2, 3);
feditor->priv->attributes = entry;
+ g_signal_connect (entry, "activate",
+ G_CALLBACK (activated_cb), feditor);
model = gda_data_model_array_new_with_g_types (2, G_TYPE_INT, G_TYPE_STRING);
g_value_set_string ((v1 = gda_value_new (G_TYPE_STRING)), "Base (search the base DN only)");
diff --git a/tools/browser/ldap-browser/filter-editor.h b/tools/browser/ldap-browser/filter-editor.h
index fcfbd72..bf2039a 100644
--- a/tools/browser/ldap-browser/filter-editor.h
+++ b/tools/browser/ldap-browser/filter-editor.h
@@ -46,6 +46,9 @@ struct _FilterEditor {
struct _FilterEditorClass {
GtkVBoxClass parent_class;
+
+ /* signals */
+ void (*activate) (FilterEditor *feditor);
};
GType filter_editor_get_type (void) G_GNUC_CONST;
diff --git a/tools/browser/ldap-browser/ldap-search-page.c b/tools/browser/ldap-browser/ldap-search-page.c
index 6f18198..f1b481f 100644
--- a/tools/browser/ldap-browser/ldap-search-page.c
+++ b/tools/browser/ldap-browser/ldap-search-page.c
@@ -204,7 +204,7 @@ update_history_actions (LdapSearchPage *epage)
static void
search_done_cb (G_GNUC_UNUSED BrowserConnection *bcnc,
- gpointer out_result, LdapSearchPage *epage, GError *error)
+ gpointer out_result, LdapSearchPage *epage, G_GNUC_UNUSED GError *error)
{
if (epage->priv->result_view) {
gtk_widget_destroy (epage->priv->result_view);
@@ -227,7 +227,7 @@ search_done_cb (G_GNUC_UNUSED BrowserConnection *bcnc,
}
static void
-filter_exec_clicked_cb (GtkWidget *button, LdapSearchPage *epage)
+filter_exec_clicked_cb (G_GNUC_UNUSED GtkWidget *button, LdapSearchPage *epage)
{
guint id;
gchar *base_dn, *filter, *attributes;
@@ -253,11 +253,17 @@ filter_exec_clicked_cb (GtkWidget *button, LdapSearchPage *epage)
}
static void
-filter_clear_clicked_cb (GtkWidget *button, LdapSearchPage *epage)
+filter_clear_clicked_cb (G_GNUC_UNUSED GtkWidget *button, LdapSearchPage *epage)
{
filter_editor_clear (FILTER_EDITOR (epage->priv->search_entry));
}
+static void
+search_entry_activated_cb (G_GNUC_UNUSED FilterEditor *feditor, LdapSearchPage *epage)
+{
+ filter_exec_clicked_cb (NULL, epage);
+}
+
/**
* ldap_search_page_new:
* @bcnc:
@@ -307,6 +313,8 @@ ldap_search_page_new (BrowserConnection *bcnc, const gchar *base_dn)
GDA_LDAP_SEARCH_SUBTREE);
gtk_box_pack_start (GTK_BOX (hb), wid, TRUE, TRUE, 0);
epage->priv->search_entry = wid;
+ g_signal_connect (wid, "activate",
+ G_CALLBACK (search_entry_activated_cb), epage);
bb = gtk_vbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (bb), GTK_BUTTONBOX_END);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]