X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Ftint2conf%2Ftheme_view.c;h=4e169c19cae8c0207d8b7b8403eee136e68bfa74;hb=f9b3fb96571db1b9f67000a907e540888097cf11;hp=6b7e4dc2937b7498533782faf6c06bb4fb6cff47;hpb=3fe84f48719226f0b23390df15c62eafbf7ed15c;p=chaz%2Ftint2 diff --git a/src/tint2conf/theme_view.c b/src/tint2conf/theme_view.c index 6b7e4dc..4e169c1 100644 --- a/src/tint2conf/theme_view.c +++ b/src/tint2conf/theme_view.c @@ -1,8 +1,24 @@ - -#include -#include -#include - +/************************************************************************** +* +* Tint2conf +* +* Copyright (C) 2009 Thierry lorthiois (lorthiois@bbsoft.fr) from Omega distribution +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +**************************************************************************/ + + +#include "main.h" #include "theme_view.h" // The data columns that we export via the tree model interface @@ -15,9 +31,9 @@ GtkCellRenderer *g_renderer; GtkWidget *create_view() { - GtkTreeViewColumn *col; - GtkCellRenderer *renderer; - GtkWidget *view; + GtkTreeViewColumn *col; + GtkCellRenderer *renderer; + GtkWidget *view; g_store = gtk_list_store_new(NB_COL, G_TYPE_STRING, GDK_TYPE_PIXBUF); @@ -46,6 +62,9 @@ GtkWidget *create_view() gtk_tree_view_column_add_attribute(col, g_renderer, "pixbuf", COL_SNAPSHOT); gtk_tree_view_append_column(GTK_TREE_VIEW(view),col); + GtkTreeSortable *sortable; + sortable = GTK_TREE_SORTABLE(g_store); + gtk_tree_sortable_set_sort_column_id(sortable, COL_THEME_FILE, GTK_SORT_ASCENDING); return view; } @@ -106,12 +125,12 @@ gboolean update_snapshot() pixWidth = gdk_pixbuf_get_width(pixbuf); pixHeight = gdk_pixbuf_get_height(pixbuf); - if (g_width_list < pixWidth) { + if (g_width_list != pixWidth) { g_width_list = pixWidth; changeSize = TRUE; } - if (g_height_list < (pixHeight+6)) { - g_height_list = pixHeight+6; + if (g_height_list != (pixHeight+30)) { + g_height_list = pixHeight+30; changeSize = TRUE; } if (changeSize) @@ -124,43 +143,3 @@ gboolean update_snapshot() -void custom_list_append2(const gchar *name) -{ - GtkTreeIter iter; - gchar *snap, *cmd; - gint pixWidth, pixHeight; - gboolean changeSize = FALSE; - GdkPixbuf *icon; - - // build panel's snapshot - snap = g_build_filename (g_get_user_config_dir(), "tint2", "snap.jpg", NULL); - g_remove(snap); - - cmd = g_strdup_printf("tint2 -c \'%s\' -s \'%s\'", name, snap); - system(cmd); - g_free(cmd); - - // load - icon = gdk_pixbuf_new_from_file(snap, NULL); - g_free(snap); - if (!icon) - return; - - pixWidth = gdk_pixbuf_get_width(icon); - pixHeight = gdk_pixbuf_get_height(icon); - if (g_width_list < pixWidth) { - g_width_list = pixWidth; - changeSize = TRUE; - } - if (g_height_list < (pixHeight+6)) { - g_height_list = pixHeight+6; - changeSize = TRUE; - } - if (changeSize) - gtk_cell_renderer_set_fixed_size(g_renderer, g_width_list, g_height_list); - - gtk_list_store_append(g_store, &iter); - gtk_list_store_set(g_store, &iter, COL_THEME_FILE, name, COL_SNAPSHOT, icon, -1); -} - -