Update ephoto to the api breakage for ewl mvc widgets.

SVN revision: 28978
master
titan 16 years ago committed by titan
parent 074a152cab
commit 59c934ac54
  1. 59
      src/bin/ephoto_list_view.c
  2. 31
      src/bin/ephoto_main.c

@ -1,7 +1,6 @@
#include "ephoto.h"
static Ewl_Widget *list_view_new(void);
static void list_view_assign(Ewl_Widget *w, void *data);
static Ewl_Widget *list_view_new(void *data, int column, int row);
static Ewl_Widget *list_header_fetch(void *data, int column);
static void *list_data_fetch(void *data, unsigned int row, unsigned int column);
static int list_data_count(void *data);
@ -61,8 +60,7 @@ Ewl_Widget *add_ltree(Ewl_Widget *c)
ewl_widget_show(tree);
view = ewl_view_new();
ewl_view_constructor_set(view, list_view_new);
ewl_view_assign_set(view, list_view_assign);
ewl_view_widget_fetch_set(view, list_view_new);
ewl_view_header_fetch_set(view, list_header_fetch);
ewl_tree2_column_append(EWL_TREE2(tree), view, FALSE);
@ -71,49 +69,38 @@ Ewl_Widget *add_ltree(Ewl_Widget *c)
/* The view of the images */
static Ewl_Widget *list_view_new(void)
static Ewl_Widget *list_view_new(void *data, int row, int column)
{
Ewl_Widget *hbox;
const char *image;
char info[PATH_MAX];
int size, width, height;
Ewl_Widget *hbox, *img, *text;
image = data;
image_pixels_int_get(image, &width, &height);
size = ecore_file_size(image);
snprintf(info, PATH_MAX, "Name: %s\nPixels: %s\nSize: %s\n",
basename((char *)image),
image_pixels_string_get(image),
file_size_get(size));
hbox = ewl_hbox_new();
ewl_box_spacing_set(EWL_BOX(hbox), 10);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL);
ewl_callback_append(hbox, EWL_CALLBACK_CLICKED, set_active_list_view, NULL);
ewl_widget_name_set(hbox, image);
ewl_widget_show(hbox);
img = add_image(hbox, image, 1, NULL, NULL);
ewl_image_constrain_set(EWL_IMAGE(img), 64);
text = add_text(hbox, info);
ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_SHRINK);
ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_LEFT);
return hbox;
}
/*The row that is added to the tree*/
static void list_view_assign(Ewl_Widget *w, void *data)
{
const char *image;
char info[PATH_MAX];
int size;
int width, height;
Ewl_Widget *img, *text;
image = data;
image_pixels_int_get(image, &width, &height);
img = add_image(w, image, 1, NULL, NULL);
ewl_image_constrain_set(EWL_IMAGE(img), 64);
ewl_widget_name_set(w, image);
size = ecore_file_size(image);
snprintf(info, PATH_MAX, "Name: %s\nPixels: %s\nSize: %s\n",
basename((char *)image),
image_pixels_string_get(image),
file_size_get(size));
text = add_text(w, info);
ewl_object_fill_policy_set(EWL_OBJECT(text), EWL_FLAG_FILL_SHRINK);
ewl_object_alignment_set(EWL_OBJECT(text), EWL_FLAG_ALIGN_LEFT);
return;
}
/* The header for the tree */
static Ewl_Widget *list_header_fetch(void *data, int column)
{

@ -9,8 +9,7 @@ static void window_fullscreen(Ewl_Widget *w, void *event, void *data);
static Ewl_Widget *add_atree(Ewl_Widget *c);
/*Ephoto MVC Callbacks*/
static Ewl_Widget *album_view_new(void);
static void album_view_assign(Ewl_Widget *w, void *data);
static Ewl_Widget *album_view_new(void *data, int column, int row);
static Ewl_Widget *album_header_fetch(void *data, int column);
static void *album_data_fetch(void *data, unsigned int row, unsigned int column);
static int album_data_count(void *data);
@ -246,8 +245,7 @@ static Ewl_Widget *add_atree(Ewl_Widget *c)
ewl_widget_show(tree);
view = ewl_view_new();
ewl_view_constructor_set(view, album_view_new);
ewl_view_assign_set(view, album_view_assign);
ewl_view_widget_fetch_set(view, album_view_new);
ewl_view_header_fetch_set(view, album_header_fetch);
ewl_tree2_column_append(EWL_TREE2(tree), view, FALSE);
@ -256,35 +254,28 @@ static Ewl_Widget *add_atree(Ewl_Widget *c)
/* The view of the users albums */
static Ewl_Widget *album_view_new(void)
static Ewl_Widget *album_view_new(void *data, int column, int row)
{
const char *album;
Ewl_Widget *icon;
album = data;
icon = ewl_icon_new();
ewl_icon_thumbnailing_set(EWL_ICON(icon), FALSE);
ewl_icon_image_set(EWL_ICON(icon), PACKAGE_DATA_DIR "/images/image.png", NULL);
ewl_icon_label_set(EWL_ICON(icon), album);
ewl_icon_constrain_set(EWL_ICON(icon), 25);
ewl_box_orientation_set(EWL_BOX(icon), EWL_ORIENTATION_HORIZONTAL);
ewl_object_alignment_set(EWL_OBJECT(icon), EWL_FLAG_ALIGN_LEFT);
ewl_object_fill_policy_set(EWL_OBJECT(icon), EWL_FLAG_FILL_ALL);
ewl_callback_append(icon, EWL_CALLBACK_CLICKED, populate, NULL);
ewl_widget_name_set(icon, album);
ewl_widget_show(icon);
return icon;
}
/*The row that is added to the tree*/
static void album_view_assign(Ewl_Widget *w, void *data)
{
const char *album;
album = data;
ewl_icon_image_set(EWL_ICON(w), PACKAGE_DATA_DIR "/images/image.png", NULL);
ewl_icon_label_set(EWL_ICON(w), album);
ewl_icon_constrain_set(EWL_ICON(w), 25);
ewl_widget_name_set(w, album);
ewl_callback_append(w, EWL_CALLBACK_CLICKED, populate, NULL);
return;
}
/* The header for the tree */
static Ewl_Widget *album_header_fetch(void *data, int column)
{

Loading…
Cancel
Save