"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/dpformat.c" between
gentoo-0.20.6.tar.gz and gentoo-0.20.7.tar.gz

About: gentoo is a graphically configurable file manager (requires GTK+).

dpformat.c  (gentoo-0.20.6):dpformat.c  (gentoo-0.20.7)
skipping to change at line 154 skipping to change at line 154
static GtkTreeModel * get_content_model(void) static GtkTreeModel * get_content_model(void)
{ {
GtkListStore *store; GtkListStore *store;
gsize i; gsize i;
store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
for(i = 0; i < sizeof content_info / sizeof *content_info; i++) for(i = 0; i < sizeof content_info / sizeof *content_info; i++)
{ {
GtkTreeIter iter; GtkTreeIter iter;
gtk_list_store_append(store, &iter); gtk_list_store_insert_with_values(store, &iter,-1, 0, _(content_i
gtk_list_store_set(store, &iter, 0, _(content_info[i].name_full), nfo[i].name_full), 1, content_info[i].id, -1);
1, content_info[i].id, -1);
} }
return GTK_TREE_MODEL(store); return GTK_TREE_MODEL(store);
} }
GtkWidget * dpf_get_content_combo_box(GCallback func, gpointer user) GtkWidget * dpf_get_content_combo_box(GCallback func, gpointer user)
{ {
GtkTreeModel *model = get_content_model(); GtkTreeModel *model = get_content_model();
GtkWidget *wid; GtkWidget *wid;
GtkCellRenderer *cr; GtkCellRenderer *cr;
skipping to change at line 286 skipping to change at line 285
fmt->sort.content = DPC_NAME; fmt->sort.content = DPC_NAME;
fmt->sort.invert = FALSE; fmt->sort.invert = FALSE;
fmt->sort.mode = DPS_DIRS_FIRST; fmt->sort.mode = DPS_DIRS_FIRST;
strcpy(fmt->def_path, "file:///"); strcpy(fmt->def_path, "file:///");
fmt->path_above = FALSE; fmt->path_above = FALSE;
fmt->hide_allowed = TRUE; fmt->hide_allowed = TRUE;
fmt->scrollbar_always = TRUE; fmt->scrollbar_always = TRUE;
fmt->huge_parent = FALSE; fmt->huge_parent = FALSE;
fmt->set_font = FALSE; fmt->set_font = FALSE;
fmt->rubber_banding = FALSE; fmt->rubber_banding = FALSE;
fmt->rules = FALSE;
cfg->dp_format[1] = cfg->dp_format[0]; /* Duplicate default formats for second pane. */ cfg->dp_format[1] = cfg->dp_format[0]; /* Duplicate default formats for second pane. */
cfg->dp_paning.orientation = DPORIENT_HORIZ; cfg->dp_paning.orientation = DPORIENT_HORIZ;
cfg->dp_paning.mode = DPSPLIT_RATIO; cfg->dp_paning.mode = DPSPLIT_RATIO;
cfg->dp_paning.value = 0.5; cfg->dp_paning.value = 0.5;
cfg->dp_history.select = TRUE; cfg->dp_history.select = TRUE;
cfg->dp_history.save = TRUE; /* Slightly out of place, but hey. */ cfg->dp_history.save = TRUE; /* Slightly out of place, but hey. */
} }
skipping to change at line 453 skipping to change at line 451
ft = dp_row_get_ftype(model, row); ft = dp_row_get_ftype(model, row);
if(ft != NULL) if(ft != NULL)
st = ft->style; st = ft->style;
else else
st = NULL; st = NULL;
dpf_cell_set_style_colors(r, st, do_fg, do_bg); dpf_cell_set_style_colors(r, st, do_fg, do_bg);
} }
} }
/* 2012-05-29 - Figure out whether the DirPane being formatted using <ext
ra> would like to override the background
** color for pane rows, or not. This is Rather Extreme Trickery, you
're not expected to consider this
** much of a shining beacon when it comes to design. But it is kind
of practical, and should be safe
** as far as I know.
*/
static gboolean get_do_bg(GtkTreeViewColumn *tc, const DpCExtra *extra)
{
/* Rely on the fact that the DpCExtra is embedded in a DpCFmt,
** which in turn is part of a DPFormat which has the bit we're after.
** If only we knew the column's index ...
*/
const DpCFmt *cfmt = (const DpCFmt *) ((const unsigned char *) extra -
offsetof(DpCFmt, extra));
const gint index = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(tc),
"index"));
const DPFormat *dpf = (const DPFormat *) ((const unsigned char *) cfmt -
offsetof(DPFormat, format[index]));
return !dpf->rules;
}
static void cdf_name(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeM odel *model, GtkTreeIter *iter, gpointer user) static void cdf_name(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeM odel *model, GtkTreeIter *iter, gpointer user)
{ {
const DC_Name *cfg = user; const DC_Name *cfg = user;
const gchar *dname = dp_row_get_name_display(model, iter); const gchar *dname = dp_row_get_name_display(model, iter);
if(cfg->show_type || cfg->show_linkname) if(cfg->show_type || cfg->show_linkname)
{ {
gchar buf[1024]; gchar buf[1024];
const gchar *type = "", *tdname; const gchar *type = "", *tdname;
skipping to change at line 507 skipping to change at line 487
if(cfg->show_linkname && (tdname = dp_row_get_link_target(model, iter)) != NULL) if(cfg->show_linkname && (tdname = dp_row_get_link_target(model, iter)) != NULL)
g_snprintf(buf, sizeof buf, "%s%s \xe2\x86\x92 %s", dname , type, tdname); g_snprintf(buf, sizeof buf, "%s%s \xe2\x86\x92 %s", dname , type, tdname);
else else
g_snprintf(buf, sizeof buf, "%s%s", dname, type); g_snprintf(buf, sizeof buf, "%s%s", dname, type);
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
} }
else else
g_object_set(renderer, "text", dname, NULL); g_object_set(renderer, "text", dname, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_size(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeM odel *model, GtkTreeIter *iter, gpointer user) static void cdf_size(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeM odel *model, GtkTreeIter *iter, gpointer user)
{ {
const DC_Size *cfg = user; const DC_Size *cfg = user;
goffset size; goffset size;
gchar buf[64]; gchar buf[64];
if(!cfg->dir_show_fs_size && dp_row_get_file_type(model, iter, TRUE) == G _FILE_TYPE_DIRECTORY) if(!cfg->dir_show_fs_size && dp_row_get_file_type(model, iter, TRUE) == G _FILE_TYPE_DIRECTORY)
{ {
g_object_set(renderer, "text", "", NULL); g_object_set(renderer, "text", "", NULL);
return; return;
} }
size = dp_row_get_size(model, iter); size = dp_row_get_size(model, iter);
sze_put_offset(buf, sizeof buf, size, cfg->unit, cfg->digits, cfg->ticks ? cfg->tick : '\0'); sze_put_offset(buf, sizeof buf, size, cfg->unit, cfg->digits, cfg->ticks ? cfg->tick : '\0');
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, (const DpCE xtra *) cfg)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_blocks(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_blocks(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
guint64 blocks; guint64 blocks;
gchar buf[64]; gchar buf[64];
blocks = dp_row_get_blocks(model, iter); blocks = dp_row_get_blocks(model, iter);
g_snprintf(buf, sizeof buf, "%" G_GUINT64_FORMAT, blocks); g_snprintf(buf, sizeof buf, "%" G_GUINT64_FORMAT, blocks);
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_icon(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeM odel *model, GtkTreeIter *iter, gpointer user) static void cdf_icon(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeM odel *model, GtkTreeIter *iter, gpointer user)
{ {
FType *ftype; FType *ftype;
if((ftype = dp_row_get_ftype(model, iter)) != NULL) if((ftype = dp_row_get_ftype(model, iter)) != NULL)
{ {
const Style *stl = ftype->style; const Style *stl = ftype->style;
const gchar *iname; const gchar *iname;
skipping to change at line 582 skipping to change at line 562
buf[0] = '\0'; buf[0] = '\0';
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
} }
else else
g_object_set(renderer, "text", "", NULL); g_object_set(renderer, "text", "", NULL);
format_colors_row(model, iter, renderer, TRUE, do_bg); format_colors_row(model, iter, renderer, TRUE, do_bg);
} }
static void cdf_atime(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTree Model *model, GtkTreeIter *iter, gpointer user) static void cdf_atime(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTree Model *model, GtkTreeIter *iter, gpointer user)
{ {
do_cdf_time(col, renderer, model, iter, user, dp_row_get_time_accessed(mo del, iter), get_do_bg(col, user)); do_cdf_time(col, renderer, model, iter, user, dp_row_get_time_accessed(mo del, iter), TRUE);
} }
static void cdf_crtime(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_crtime(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
do_cdf_time(col, renderer, model, iter, user, dp_row_get_time_created(mod el, iter), get_do_bg(col, user)); do_cdf_time(col, renderer, model, iter, user, dp_row_get_time_created(mod el, iter), TRUE);
} }
static void cdf_mtime(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTree Model *model, GtkTreeIter *iter, gpointer user) static void cdf_mtime(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTree Model *model, GtkTreeIter *iter, gpointer user)
{ {
do_cdf_time(col, renderer, model, iter, user, dp_row_get_time_modified(mo del, iter), get_do_bg(col, user)); do_cdf_time(col, renderer, model, iter, user, dp_row_get_time_modified(mo del, iter), TRUE);
} }
static void cdf_chtime(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_chtime(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
do_cdf_time(col, renderer, model, iter, user, dp_row_get_time_changed(mod el, iter), get_do_bg(col, user)); do_cdf_time(col, renderer, model, iter, user, dp_row_get_time_changed(mod el, iter), TRUE);
} }
static void cdf_devmax(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_devmax(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
gchar buf[16]; gchar buf[16];
g_snprintf(buf, sizeof buf, user, dp_row_get_device(model, iter) >> 8); g_snprintf(buf, sizeof buf, user, dp_row_get_device(model, iter) >> 8);
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_device(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_device(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
gchar buf[16]; gchar buf[16];
g_snprintf(buf, sizeof buf, user, dp_row_get_device(model, iter)); g_snprintf(buf, sizeof buf, user, dp_row_get_device(model, iter));
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_devmin(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_devmin(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
gchar buf[16]; gchar buf[16];
g_snprintf(buf, sizeof buf, user, dp_row_get_device(model, iter) & 255); g_snprintf(buf, sizeof buf, user, dp_row_get_device(model, iter) & 255);
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_gidnum(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_gidnum(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
gchar buf[16]; gchar buf[16];
g_snprintf(buf, sizeof buf, user, dp_row_get_gid(model, iter)); g_snprintf(buf, sizeof buf, user, dp_row_get_gid(model, iter));
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_gidstr(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_gidstr(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
guint32 gid; guint32 gid;
const gchar *group; const gchar *group;
gid = dp_row_get_gid(model, iter); gid = dp_row_get_gid(model, iter);
if((group = usr_lookup_gname(gid)) != NULL) if((group = usr_lookup_gname(gid)) != NULL)
g_object_set(renderer, "text", group, NULL); g_object_set(renderer, "text", group, NULL);
else else
{ {
gchar buf[16]; gchar buf[16];
g_snprintf(buf, sizeof buf, user, gid); g_snprintf(buf, sizeof buf, user, gid);
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
} }
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_modenum(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTr eeModel *model, GtkTreeIter *iter, gpointer user) static void cdf_modenum(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTr eeModel *model, GtkTreeIter *iter, gpointer user)
{ {
gchar buf[32]; gchar buf[32];
g_snprintf(buf, sizeof buf, user, dp_row_get_mode(model, iter)); g_snprintf(buf, sizeof buf, user, dp_row_get_mode(model, iter));
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_modestr(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTr eeModel *model, GtkTreeIter *iter, gpointer user) static void cdf_modestr(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTr eeModel *model, GtkTreeIter *iter, gpointer user)
{ {
gchar buf[16]; gchar buf[16];
stu_mode_to_text(buf, sizeof buf, dp_row_get_mode(model, iter)); stu_mode_to_text(buf, sizeof buf, dp_row_get_mode(model, iter));
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_type(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeM odel *model, GtkTreeIter *iter, gpointer user) static void cdf_type(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeM odel *model, GtkTreeIter *iter, gpointer user)
{ {
const FType *ft; const FType *ft;
if((ft = dp_row_get_ftype(model, iter)) != NULL) if((ft = dp_row_get_ftype(model, iter)) != NULL)
{ {
g_object_set(renderer, "text", ft->name, NULL); g_object_set(renderer, "text", ft->name, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, use r)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
} }
static void cdf_uidnum(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_uidnum(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
gchar buf[16]; gchar buf[16];
g_snprintf(buf, sizeof buf, "%u", dp_row_get_uid(model, iter)); g_snprintf(buf, sizeof buf, "%u", dp_row_get_uid(model, iter));
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_uidstr(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user) static void cdf_uidstr(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTre eModel *model, GtkTreeIter *iter, gpointer user)
{ {
guint32 uid; guint32 uid;
const gchar *name; const gchar *name;
uid = dp_row_get_uid(model, iter); uid = dp_row_get_uid(model, iter);
if((name = usr_lookup_uname(uid)) != NULL) if((name = usr_lookup_uname(uid)) != NULL)
g_object_set(renderer, "text", name, NULL); g_object_set(renderer, "text", name, NULL);
else else
{ {
gchar buf[32]; gchar buf[32];
g_snprintf(buf, sizeof buf, user, uid); g_snprintf(buf, sizeof buf, user, uid);
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
} }
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_nlink(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTree Model *model, GtkTreeIter *iter, gpointer user) static void cdf_nlink(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTree Model *model, GtkTreeIter *iter, gpointer user)
{ {
gchar buf[16]; gchar buf[16];
g_snprintf(buf, sizeof buf, "%u", dp_row_get_nlink(model, iter)); g_snprintf(buf, sizeof buf, "%u", dp_row_get_nlink(model, iter));
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, user)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
static void cdf_uri(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeMo del *model, GtkTreeIter *iter, gpointer user) static void cdf_uri(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeMo del *model, GtkTreeIter *iter, gpointer user)
{ {
DirPane *dp = user; DirPane *dp = user;
GFile *file; GFile *file;
if((file = dp_get_file_from_row(dp, iter)) != NULL) if((file = dp_get_file_from_row(dp, iter)) != NULL)
{ {
gchar *uri, buf[512]; gchar *uri, buf[512];
skipping to change at line 740 skipping to change at line 720
{ {
if(strncmp(uri, "file://", 7) == 0) if(strncmp(uri, "file://", 7) == 0)
g_snprintf(buf, sizeof buf, "%s", uri + 7); g_snprintf(buf, sizeof buf, "%s", uri + 7);
else else
g_snprintf(buf, sizeof buf, "%s", uri); g_snprintf(buf, sizeof buf, "%s", uri);
g_free(uri); g_free(uri);
} }
else else
g_snprintf(buf, sizeof buf, "(failed)"); g_snprintf(buf, sizeof buf, "(failed)");
g_object_set(renderer, "text", buf, NULL); g_object_set(renderer, "text", buf, NULL);
format_colors_row(model, iter, renderer, TRUE, get_do_bg(col, use r)); format_colors_row(model, iter, renderer, TRUE, TRUE);
} }
} }
GtkTreeCellDataFunc dpf_get_cell_data_func(DirPane *dp, gint column, gpointer *u ser) GtkTreeCellDataFunc dpf_get_cell_data_func(DirPane *dp, gint column, gpointer *u ser)
{ {
DPFormat *fmt; DPFormat *fmt;
DpCFmt *col_fmt; DpCFmt *col_fmt;
fmt = &dp->main->cfg.dp_format[dp->index]; fmt = &dp->main->cfg.dp_format[dp->index];
if(column >= fmt->num_columns) if(column >= fmt->num_columns)
 End of changes. 22 change blocks. 
47 lines changed or deleted 21 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS