static void prefs_themes_get_theme_info (ThemesData *tdata);
static void prefs_themes_display_theme_info (ThemesData *tdata, const ThemeInfo *info);
static void prefs_themes_get_themes_and_names (ThemesData *tdata);
+static int prefs_themes_cmp_name(gconstpointer a, gconstpointer b);
static void prefs_themes_free_names (ThemesData *tdata);
static void prefs_themes_set_themes_menu (GtkOptionMenu *opmenu, const ThemesData *tdata);
base = g_path_get_basename(filename);
if (TRUE == is_dir_exist(filename)) {
- if (!((base[0] == '.') || (base[0] == '.' && base[1] == '.')))
- g_warning("prefs_themes_file_remove(): subdir in theme dir skipped.\n");
+ if (strcmp(base, ".") != 0 && strcmp(base, "..") != 0)
+ g_warning("prefs_themes_file_remove(): subdir in theme dir skipped: '%s'.\n",
+ base);
}
else if (0 != g_unlink(filename)) {
(*status) = g_strdup(filename);
base = g_path_get_basename(filename);
if (TRUE == is_dir_exist(filename)) {
- if (!((base[0] == '.') || (base[0] == '.' && base[1] == '.')))
- g_warning("prefs_themes_file_install(): subdir in theme dir skipped.\n");
+ if (strcmp(base, ".") != 0 && strcmp(base, "..") !=0 )
+ g_warning("prefs_themes_file_install(): subdir in theme dir skipped: '%s'.\n",
+ base);
}
else {
gchar *fulldest;
GtkWidget *menu;
GtkWidget *item;
gint i = 0, active = 0;
+ GList *sorted_list = NULL;
g_return_if_fail(opmenu != NULL);
-
+
gtk_option_menu_remove_menu(opmenu);
-
+
+ /* sort theme data list by data name */
menu = gtk_menu_new ();
+ while (themes != NULL) {
+ ThemeName *tname = (ThemeName *)(themes->data);
+
+ sorted_list = g_list_insert_sorted(sorted_list, (gpointer)(tname),
+ (GCompareFunc)prefs_themes_cmp_name);
+
+ themes = g_list_next(themes);
+ }
+
+ /* feed gtk_menu w/ sorted themes names */
+ themes = sorted_list;
while (themes != NULL) {
ThemeName *tname = (ThemeName *)(themes->data);
gchar *tpath = (gchar *)(tname->item->data);
-
+
item = gtk_menu_item_new_with_label(tname->name);
gtk_widget_show(item);
g_signal_connect(G_OBJECT(item), "activate",
if (tdata->displayed != NULL && tdata->displayed == tpath)
active = i;
+ ++i;
themes = g_list_next(themes);
- ++i;
}
-
+
+ g_list_free(sorted_list);
+
gtk_menu_set_active(GTK_MENU(menu), active);
gtk_option_menu_set_menu (opmenu, menu);
}
+static int prefs_themes_cmp_name(gconstpointer a_p, gconstpointer b_p)
+{
+ /* compare two ThemeData structures by their name attribute */
+ return strcmp2((gchar *)(((ThemeName*)a_p)->name),
+ (gchar *)(((ThemeName*)b_p)->name));
+}
+
static void prefs_themes_get_themes_and_names(ThemesData *tdata)
{
GList *tpaths;
static void prefs_themes_btn_more_clicked_cb(GtkWidget *widget, gpointer data)
{
- open_uri(CLAWS_THEMES_URI, prefs_common.uri_cmd);
+ open_uri(THEMES_URI, prefs_common.uri_cmd);
}
static void prefs_themes_menu_item_activated_cb(GtkWidget *widget, gpointer data)
if (IS_INTERNAL_THEME(path)) {
info->name = g_strdup(_("Default internal theme"));
- info->author = g_strdup(_("The Sylpheed Claws Team"));
+ info->author = g_strdup(_("The Sylpheed-Claws Team"));
info->url = g_strdup(HOMEPAGE_URI);
info->status = g_strdup_printf(_("Internal theme has %d icons"), N_STOCK_PIXMAPS);
}