. Free 'nprefix', closing a memory leak. Spaced out the code a bit to make

.
        * gtk/gtkcombo.c (gtk_combo_entry_key_press):
        Free 'nprefix', closing a memory leak.
        Spaced out the code a bit to make it more readable.

        * gtk/gtkhbox.[ch] (gtk_hbox_new),
          gtk/gtkvbox.[ch] (gtk_vbox_new):
        Change 'homogenous' arg from gint to gboolean.

        * gtk/gtktogglebutton.[ch]:
        New function gtk_toggle_button_get_active().
This commit is contained in:
Jeff Garzik 1999-01-21 00:37:48 +00:00
parent df21a7064f
commit 6e3e247b9a
14 changed files with 129 additions and 15 deletions

View File

@ -1,3 +1,16 @@
1999-01-20 Jeff Garzik <jgarzik@pobox.com>
* gtk/gtkcombo.c (gtk_combo_entry_key_press):
Free 'nprefix', closing a memory leak.
Spaced out the code a bit to make it more readable.
* gtk/gtkhbox.[ch] (gtk_hbox_new),
gtk/gtkvbox.[ch] (gtk_vbox_new):
Change 'homogenous' arg from gint to gboolean.
* gtk/gtktogglebutton.[ch]:
New function gtk_toggle_button_get_active().
1999-01-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act

View File

@ -1,3 +1,16 @@
1999-01-20 Jeff Garzik <jgarzik@pobox.com>
* gtk/gtkcombo.c (gtk_combo_entry_key_press):
Free 'nprefix', closing a memory leak.
Spaced out the code a bit to make it more readable.
* gtk/gtkhbox.[ch] (gtk_hbox_new),
gtk/gtkvbox.[ch] (gtk_vbox_new):
Change 'homogenous' arg from gint to gboolean.
* gtk/gtktogglebutton.[ch]:
New function gtk_toggle_button_get_active().
1999-01-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act

View File

@ -1,3 +1,16 @@
1999-01-20 Jeff Garzik <jgarzik@pobox.com>
* gtk/gtkcombo.c (gtk_combo_entry_key_press):
Free 'nprefix', closing a memory leak.
Spaced out the code a bit to make it more readable.
* gtk/gtkhbox.[ch] (gtk_hbox_new),
gtk/gtkvbox.[ch] (gtk_vbox_new):
Change 'homogenous' arg from gint to gboolean.
* gtk/gtktogglebutton.[ch]:
New function gtk_toggle_button_get_active().
1999-01-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act

View File

@ -1,3 +1,16 @@
1999-01-20 Jeff Garzik <jgarzik@pobox.com>
* gtk/gtkcombo.c (gtk_combo_entry_key_press):
Free 'nprefix', closing a memory leak.
Spaced out the code a bit to make it more readable.
* gtk/gtkhbox.[ch] (gtk_hbox_new),
gtk/gtkvbox.[ch] (gtk_vbox_new):
Change 'homogenous' arg from gint to gboolean.
* gtk/gtktogglebutton.[ch]:
New function gtk_toggle_button_get_active().
1999-01-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act

View File

@ -1,3 +1,16 @@
1999-01-20 Jeff Garzik <jgarzik@pobox.com>
* gtk/gtkcombo.c (gtk_combo_entry_key_press):
Free 'nprefix', closing a memory leak.
Spaced out the code a bit to make it more readable.
* gtk/gtkhbox.[ch] (gtk_hbox_new),
gtk/gtkvbox.[ch] (gtk_vbox_new):
Change 'homogenous' arg from gint to gboolean.
* gtk/gtktogglebutton.[ch]:
New function gtk_toggle_button_get_active().
1999-01-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act

View File

@ -1,3 +1,16 @@
1999-01-20 Jeff Garzik <jgarzik@pobox.com>
* gtk/gtkcombo.c (gtk_combo_entry_key_press):
Free 'nprefix', closing a memory leak.
Spaced out the code a bit to make it more readable.
* gtk/gtkhbox.[ch] (gtk_hbox_new),
gtk/gtkvbox.[ch] (gtk_vbox_new):
Change 'homogenous' arg from gint to gboolean.
* gtk/gtktogglebutton.[ch]:
New function gtk_toggle_button_get_active().
1999-01-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act

View File

@ -1,3 +1,16 @@
1999-01-20 Jeff Garzik <jgarzik@pobox.com>
* gtk/gtkcombo.c (gtk_combo_entry_key_press):
Free 'nprefix', closing a memory leak.
Spaced out the code a bit to make it more readable.
* gtk/gtkhbox.[ch] (gtk_hbox_new),
gtk/gtkvbox.[ch] (gtk_vbox_new):
Change 'homogenous' arg from gint to gboolean.
* gtk/gtktogglebutton.[ch]:
New function gtk_toggle_button_get_active().
1999-01-20 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkdnd.c (gtk_drag_get_event_action): Allow button 2 to act

View File

@ -125,27 +125,37 @@ gtk_combo_entry_key_press (GtkEntry * entry, GdkEventKey * event, GtkCombo * com
gchar* nprefix = NULL;
gint pos;
if ( !GTK_LIST(combo->list)->children )
if ( !GTK_LIST (combo->list)->children )
return FALSE;
gtk_signal_emit_stop_by_name (GTK_OBJECT (entry), "key_press_event");
cmpl = g_completion_new((GCompletionFunc)gtk_combo_func);
g_completion_add_items(cmpl, GTK_LIST(combo->list)->children);
pos = GTK_EDITABLE(entry)->current_pos;
prefix = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, pos);
cmpl = g_completion_new ((GCompletionFunc)gtk_combo_func);
g_completion_add_items (cmpl, GTK_LIST (combo->list)->children);
pos = GTK_EDITABLE (entry)->current_pos;
prefix = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, pos);
g_completion_complete(cmpl, prefix, &nprefix);
if (nprefix && strlen(nprefix) > strlen(prefix))
if (nprefix && strlen (nprefix) > strlen (prefix))
{
gtk_editable_insert_text(GTK_EDITABLE(entry), nprefix+pos,
strlen(nprefix)-strlen(prefix), &pos);
GTK_EDITABLE(entry)->current_pos = pos;
gtk_editable_insert_text (GTK_EDITABLE (entry), nprefix + pos,
strlen (nprefix) - strlen (prefix), &pos);
GTK_EDITABLE (entry)->current_pos = pos;
}
g_free(prefix);
g_completion_free(cmpl);
if (nprefix)
g_free (nprefix);
g_free (prefix);
g_completion_free (cmpl);
return TRUE;
}
if (!combo->use_arrows || !GTK_LIST (combo->list)->children)
return FALSE;
li = g_list_find (GTK_LIST (combo->list)->children, gtk_combo_find (combo));
if ((event->keyval == GDK_Up)

View File

@ -69,7 +69,7 @@ gtk_hbox_init (GtkHBox *hbox)
}
GtkWidget*
gtk_hbox_new (gint homogeneous,
gtk_hbox_new (gboolean homogeneous,
gint spacing)
{
GtkHBox *hbox;

View File

@ -51,7 +51,7 @@ struct _GtkHBoxClass
GtkType gtk_hbox_get_type (void);
GtkWidget* gtk_hbox_new (gint homogeneous,
GtkWidget* gtk_hbox_new (gboolean homogeneous,
gint spacing);

View File

@ -267,6 +267,7 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
}
}
void
gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
gboolean is_active)
@ -280,6 +281,17 @@ gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
gtk_button_clicked (GTK_BUTTON (toggle_button));
}
gboolean
gtk_toggle_button_get_active (GtkToggleButton *toggle_button)
{
g_return_val_if_fail (toggle_button != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button), FALSE);
return (toggle_button->active) ? TRUE : FALSE;
}
void
gtk_toggle_button_toggled (GtkToggleButton *toggle_button)
{

View File

@ -64,6 +64,7 @@ void gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
gboolean draw_indicator);
void gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
gboolean is_active);
gboolean gtk_toggle_button_get_active (GtkToggleButton *toggle_button);
void gtk_toggle_button_toggled (GtkToggleButton *toggle_button);

View File

@ -69,7 +69,7 @@ gtk_vbox_init (GtkVBox *vbox)
}
GtkWidget*
gtk_vbox_new (gint homogeneous,
gtk_vbox_new (gboolean homogeneous,
gint spacing)
{
GtkVBox *vbox;

View File

@ -51,7 +51,7 @@ struct _GtkVBoxClass
GtkType gtk_vbox_get_type (void);
GtkWidget* gtk_vbox_new (gint homogeneous,
GtkWidget* gtk_vbox_new (gboolean homogeneous,
gint spacing);