[balsa] toolbar-factory and -prefs: Simplify API
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] toolbar-factory and -prefs: Simplify API
- Date: Sat, 26 May 2018 18:30:40 +0000 (UTC)
commit 28285f6bf0dbbf2d64594518fcb964a083522f2c
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat May 26 14:28:07 2018 -0400
toolbar-factory and -prefs: Simplify API
The 'position' argument to balsa_toolbar_model_insert_icon() was always
-1, meaning to append the icon. Remove it, and rename the method to
balsa_toolbar_model_append_icon.
src/toolbar-factory.c | 9 +++------
src/toolbar-factory.h | 4 ++--
src/toolbar-prefs.c | 5 ++---
3 files changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/src/toolbar-factory.c b/src/toolbar-factory.c
index f044d4ad8..b0256dcd1 100644
--- a/src/toolbar-factory.c
+++ b/src/toolbar-factory.c
@@ -381,8 +381,8 @@ balsa_toolbar_model_is_standard(BalsaToolbarModel * model)
/* Add an icon to the list of current icons in a BalsaToolbarModel.
*/
void
-balsa_toolbar_model_insert_icon(BalsaToolbarModel * model, gchar * icon,
- gint position)
+balsa_toolbar_model_append_icon(BalsaToolbarModel * model,
+ gchar * icon)
{
const gchar *real_button = balsa_toolbar_sanitize_id(icon);
@@ -391,10 +391,7 @@ balsa_toolbar_model_insert_icon(BalsaToolbarModel * model, gchar * icon,
entry.action = g_strdup(g_hash_table_lookup(model->legal, real_button));
entry.icon = g_strdup(real_button);
- if (position >= 0)
- g_array_insert_val(model->current, position, entry);
- else
- g_array_append_val(model->current, entry);
+ g_array_append_val(model->current, entry);
} else
g_warning(_("Unknown toolbar icon ā%sā"), icon);
}
diff --git a/src/toolbar-factory.h b/src/toolbar-factory.h
index 2831abf01..7a664fbc3 100644
--- a/src/toolbar-factory.h
+++ b/src/toolbar-factory.h
@@ -84,8 +84,8 @@ void balsa_toolbar_model_add_entries(BalsaToolbarModel * model,
GHashTable *balsa_toolbar_model_get_legal(BalsaToolbarModel * model);
GArray *balsa_toolbar_model_get_current(BalsaToolbarModel * model);
gboolean balsa_toolbar_model_is_standard(BalsaToolbarModel * model);
-void balsa_toolbar_model_insert_icon(BalsaToolbarModel * model,
- gchar * icon, gint position);
+void balsa_toolbar_model_append_icon(BalsaToolbarModel * model,
+ gchar * icon);
void balsa_toolbar_model_delete_icon(BalsaToolbarModel * model,
gchar * icon);
void balsa_toolbar_model_clear(BalsaToolbarModel * model);
diff --git a/src/toolbar-prefs.c b/src/toolbar-prefs.c
index bc0d820fb..09383dc63 100644
--- a/src/toolbar-prefs.c
+++ b/src/toolbar-prefs.c
@@ -718,9 +718,8 @@ tp_page_refresh_preview(ToolbarPage * page)
gtk_tree_model_get(model, &iter, TP_ITEM_COLUMN, &item, -1);
if (item >= 0 && item < toolbar_button_count)
- balsa_toolbar_model_insert_icon(page->model,
- toolbar_buttons[item].pixmap_id,
- -1);
+ balsa_toolbar_model_append_icon(page->model,
+ toolbar_buttons[item].pixmap_id);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]