Skip to content

Commit

Permalink
Slight code redundancy reduction.
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Monin committed Aug 24, 2008
1 parent 1e7b2c3 commit f20dd48
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/ui_tabcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,9 @@ static void tab_completion_destroy(GtkWidget *widget, gpointer data)
g_free(td);
}

static gint tab_completion_emit_enter_signal(TabCompData *td)
static gchar *tab_completion_get_text(TabCompData *td)
{
gchar *text;
if (!td->enter_func) return FALSE;

text = g_strdup(gtk_entry_get_text(GTK_ENTRY(td->entry)));

Expand All @@ -156,6 +155,15 @@ static gint tab_completion_emit_enter_signal(TabCompData *td)
g_free(t);
}

return text;
}

static gint tab_completion_emit_enter_signal(TabCompData *td)
{
gchar *text;
if (!td->enter_func) return FALSE;

text = tab_completion_get_text(td);
td->enter_func(text, td->enter_data);
g_free(text);

Expand All @@ -167,15 +175,7 @@ static void tab_completion_emit_tab_signal(TabCompData *td)
gchar *text;
if (!td->tab_func) return;

text = g_strdup(gtk_entry_get_text(GTK_ENTRY(td->entry)));

if (text[0] == '~')
{
gchar *t = text;
text = expand_tilde(text);
g_free(t);
}

text = tab_completion_get_text(td);
td->tab_func(text, td->tab_data);
g_free(text);
}
Expand Down

0 comments on commit f20dd48

Please sign in to comment.