Commit 6e3e247b authored by Jeff Garzik's avatar Jeff Garzik
Browse files

. 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().
parent df21a706
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
......
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
......
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
......
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
......
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
......
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
......
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
......
......@@ -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)
......
......@@ -69,7 +69,7 @@ gtk_hbox_init (GtkHBox *hbox)
}
GtkWidget*
gtk_hbox_new (gint homogeneous,
gtk_hbox_new (gboolean homogeneous,
gint spacing)
{
GtkHBox *hbox;
......
......@@ -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);
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -69,7 +69,7 @@ gtk_vbox_init (GtkVBox *vbox)
}
GtkWidget*
gtk_vbox_new (gint homogeneous,
gtk_vbox_new (gboolean homogeneous,
gint spacing)
{
GtkVBox *vbox;
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment