2 * Copyright © 2009 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 aoview_fullname (char *dir, char *file)
24 int dlen = strlen (dir);
25 int flen = strlen (file);
28 if (dir[dlen-1] != '/')
30 new = malloc (dlen + slen + flen + 1);
41 aoview_basename(char *file)
45 b = strrchr(file, '/');
52 aoview_mkdir(char *dir)
60 slash = strchr (d, '/');
62 slash = d + strlen(d);
65 part = strndup(dir, slash - dir);
66 if (!access(part, F_OK))
67 if (mkdir(part, 0777) < 0)
76 aoview_add_plain_text_column (GtkTreeView *view, const gchar *title, gint model_column, gint width)
78 GtkCellRenderer *renderer;
79 GtkTreeViewColumn *column;
81 renderer = gtk_cell_renderer_text_new ();
82 g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_NONE, NULL);
83 g_object_set(renderer, "width-chars", width, NULL);
84 column = gtk_tree_view_column_new_with_attributes (title, renderer,
87 gtk_tree_view_column_set_resizable (column, FALSE);
88 gtk_tree_view_append_column (view, column);