Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_button.c ewl_calendar.c ewl_filelist.c ewl_filelist.h
ewl_filelist_column.c ewl_filelist_icon.c ewl_icon_theme.h
Log Message:
- hook the icon theme into the stock icons
- add a few different images to the file dialog based on file extension
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_button.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- ewl_button.c 10 Jul 2006 09:12:24 -0000 1.36
+++ ewl_button.c 6 Sep 2006 15:16:11 -0000 1.37
@@ -12,22 +12,22 @@
char *label;
char *image_key;
} ewl_stock_items[] = {
- {"Apply", "/stock/apply"},
- {/*Arrow*/"Down", "/stock/arrow/down"},
- {/*Arrow*/"Left", "/stock/arrow/left"},
- {/*Arrow*/"Right", "/stock/arrow/right"},
- {/*Arrow*/"Up", "/stock/arrow/up"},
- {"Cancel", "/stock/cancel"},
- {"FF", "/stock/ff"},
- {"Home", "/stock/home"},
- {"Ok", "/stock/ok"},
- {"Open", "/stock/open"},
- {"Pause", "/stock/pause"},
- {"Play", "/stock/play"},
- {"Quit", "/stock/quit"},
- {"Rewind", "/stock/rewind"},
- {"Save", "/stock/save"},
- {"Stop", "/stock/stop"}
+ {"Apply", EWL_ICON_DIALOG_APPLY},
+ {/*Arrow*/"Down", EWL_ICON_GO_DOWN},
+ {/*Arrow*/"Left", EWL_ICON_GO_PREVIOUS},
+ {/*Arrow*/"Right", EWL_ICON_GO_NEXT},
+ {/*Arrow*/"Up", EWL_ICON_GO_UP},
+ {"Cancel", EWL_ICON_DIALOG_CANCEL},
+ {"FF", EWL_ICON_MEDIA_SEEK_FORWARD},
+ {"Home", EWL_ICON_GO_HOME},
+ {"Ok", EWL_ICON_DIALOG_OK},
+ {"Open", EWL_ICON_DOCUMENT_OPEN},
+ {"Pause", EWL_ICON_MEDIA_PLAYBACK_PAUSE},
+ {"Play", EWL_ICON_MEDIA_PLAYBACK_START},
+ {"Quit", EWL_ICON_SYSTEM_LOG_OUT},
+ {"Rewind", EWL_ICON_MEDIA_SEEK_BACKWARD},
+ {"Save", EWL_ICON_DOCUMENT_SAVE},
+ {"Stop", EWL_ICON_MEDIA_PLAYBACK_STOP}
};
/**
@@ -190,15 +190,13 @@
ewl_button_label_set(b, ewl_stock_items[b->stock_type].label);
/* check for an image key */
- data = ewl_theme_data_str_get(EWL_WIDGET(b),
- ewl_stock_items[b->stock_type].image_key);
- if (data) {
- char *theme;
-
- theme = ewl_theme_path_get();
- ewl_button_image_set(b, theme, data);
- FREE(theme);
- }
+ data = ewl_icon_theme_icon_path_get(
+ ewl_stock_items[b->stock_type].image_key,
+ EWL_ICON_SIZE_MEDIUM);
+
+ if (data)
+ ewl_button_image_set(b, data,
+ ewl_stock_items[b->stock_type].image_key);
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_calendar.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_calendar.c 11 Jul 2006 01:52:25 -0000 1.19
+++ ewl_calendar.c 6 Sep 2006 15:16:11 -0000 1.20
@@ -87,7 +87,10 @@
prev_button = ewl_button_new();
ewl_container_child_append(EWL_CONTAINER(top_hbox), prev_button);
- ewl_button_label_set(EWL_BUTTON(prev_button), "<");
+ ewl_button_image_set(EWL_BUTTON(prev_button),
+
ewl_icon_theme_icon_path_get(EWL_ICON_GO_PREVIOUS,
+
EWL_ICON_SIZE_SMALL),
+ EWL_ICON_GO_PREVIOUS);
ewl_object_maximum_size_set(EWL_OBJECT(prev_button), 20,10);
ewl_callback_append(prev_button, EWL_CALLBACK_MOUSE_DOWN,
ewl_calendar_prev_month_cb, ib);
ewl_widget_show(prev_button);
@@ -100,9 +103,13 @@
next_button = ewl_button_new();
ewl_container_child_append(EWL_CONTAINER(top_hbox), next_button);
- ewl_button_label_set(EWL_BUTTON(next_button), ">");
+ ewl_button_image_set(EWL_BUTTON(next_button),
+ ewl_icon_theme_icon_path_get(EWL_ICON_GO_NEXT,
+ EWL_ICON_SIZE_SMALL),
+ EWL_ICON_GO_NEXT);
ewl_object_maximum_size_set(EWL_OBJECT(next_button), 20,10);
- ewl_callback_append(next_button, EWL_CALLBACK_MOUSE_DOWN,
ewl_calendar_next_month_cb, ib);
+ ewl_callback_append(next_button, EWL_CALLBACK_MOUSE_DOWN,
+ ewl_calendar_next_month_cb, ib);
ewl_widget_show(next_button);
ib->grid = ewl_grid_new();
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ewl_filelist.c 26 May 2006 17:25:59 -0000 1.17
+++ ewl_filelist.c 6 Sep 2006 15:16:11 -0000 1.18
@@ -3,6 +3,9 @@
#include "ewl_macros.h"
#include "ewl_private.h"
+static Ecore_Hash *ewl_filelist_ext_icon = NULL;
+
+static int ewl_filelist_strcasecompare(const void *key1, const void *key2);
static void ewl_filelist_signal_between(Ewl_Filelist *fl, Ewl_Container *c,
int add, const char *signal,
int a_idx, Ewl_Widget *a,
@@ -18,6 +21,32 @@
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR_RET("fl", fl, FALSE);
+ if (!ewl_filelist_ext_icon)
+ {
+ ewl_filelist_ext_icon = ecore_hash_new(ecore_str_hash,
+
ewl_filelist_strcasecompare);
+
+ ecore_hash_set(ewl_filelist_ext_icon, ".png",
EWL_ICON_IMAGE_X_GENERIC);
+ ecore_hash_set(ewl_filelist_ext_icon, ".jpg",
EWL_ICON_IMAGE_X_GENERIC);
+ ecore_hash_set(ewl_filelist_ext_icon, ".gif",
EWL_ICON_IMAGE_X_GENERIC);
+
+ ecore_hash_set(ewl_filelist_ext_icon, ".wmv",
EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_filelist_ext_icon, ".mpg",
EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_filelist_ext_icon, ".mpeg",
EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_filelist_ext_icon, ".avi",
EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_filelist_ext_icon, ".mov",
EWL_ICON_VIDEO_X_GENERIC);
+ ecore_hash_set(ewl_filelist_ext_icon, ".asf",
EWL_ICON_VIDEO_X_GENERIC);
+
+ ecore_hash_set(ewl_filelist_ext_icon, ".mp3",
EWL_ICON_AUDIO_X_GENERIC);
+
+ ecore_hash_set(ewl_filelist_ext_icon, ".html",
EWL_ICON_TEXT_HTML);
+ ecore_hash_set(ewl_filelist_ext_icon, ".htm",
EWL_ICON_TEXT_HTML);
+
+ ecore_hash_set(ewl_filelist_ext_icon, ".pl",
EWL_ICON_TEXT_X_SCRIPT);
+ ecore_hash_set(ewl_filelist_ext_icon, ".sh",
EWL_ICON_TEXT_X_SCRIPT);
+ ecore_hash_set(ewl_filelist_ext_icon, ".ksh",
EWL_ICON_TEXT_X_SCRIPT);
+ }
+
if (!ewl_box_init(EWL_BOX(fl)))
DRETURN_INT(FALSE, DLEVEL_STABLE);
@@ -605,6 +634,31 @@
DRETURN_INT(fl->scroll_flags.h, DLEVEL_STABLE);
}
+char *
+ewl_filelist_stock_icon_get(Ewl_Filelist *fl, const char *path)
+{
+ char *ret = NULL, *ptr = NULL;
+
+ DENTER_FUNCTION(DLEVEL_STABLE);
+ DCHECK_PARAM_PTR_RET("fl", fl, NULL);
+ DCHECK_PARAM_PTR_RET("path", path, NULL);
+ DCHECK_TYPE_RET("fl", fl, EWL_FILELIST_TYPE, NULL);
+
+ if (ecore_file_is_dir(path))
+ DRETURN_PTR(EWL_ICON_FOLDER, DLEVEL_STABLE);
+
+ ptr = strrchr(path, '.');
+ ret = ecore_hash_get(ewl_filelist_ext_icon, ptr);
+ if (ret) DRETURN_PTR(ret, DLEVEL_STABLE);
+
+ if (ecore_file_can_exec(path))
+ ret = EWL_ICON_APPLICATION_X_EXECUTABLE;
+ else
+ ret = EWL_ICON_TEXT_X_GENERIC;
+
+ DRETURN_PTR(ret, DLEVEL_STABLE);
+}
+
/**
* @param fl: The filelist to get the path from
* @param dir: The dir name to append to the path
@@ -1025,4 +1079,23 @@
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
+
+static int
+ewl_filelist_strcasecompare(const void *key1, const void *key2)
+{
+ DENTER_FUNCTION(DLEVEL_STABLE);
+
+ if (!key1 || !key2)
+ {
+ DRETURN_INT(ecore_direct_compare(key1, key2), DLEVEL_STABLE);
+ }
+ else if (key1 == key2)
+ {
+ DRETURN_INT(0, DLEVEL_STABLE);
+ }
+
+ DRETURN_INT(strcasecmp((const char *)key1,
+ (const char *)key2), DLEVEL_STABLE);
+}
+
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_filelist.h 11 May 2006 04:01:20 -0000 1.9
+++ ewl_filelist.h 6 Sep 2006 15:16:11 -0000 1.10
@@ -119,6 +119,8 @@
Ewl_Scrollpane_Flags h);
Ewl_Scrollpane_Flags ewl_filelist_hscroll_flag_get(Ewl_Filelist *fl);
+char *ewl_filelist_stock_icon_get(Ewl_Filelist *fl, const char
*path);
+
char *ewl_filelist_expand_path(Ewl_Filelist *fl, const char *dir);
void ewl_filelist_directory_read(Ewl_Filelist *fl,
const char *dir,
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist_column.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- ewl_filelist_column.c 24 May 2006 02:55:15 -0000 1.14
+++ ewl_filelist_column.c 6 Sep 2006 15:16:11 -0000 1.15
@@ -434,6 +434,7 @@
Ewl_Filelist_Column *list;
Ewl_Widget *icon;
char *stock, path[PATH_MAX];
+ const char *img;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("fl", fl);
@@ -452,20 +453,15 @@
snprintf(path, PATH_MAX, "%s/%s", dir, file);
if (ecore_file_is_dir(path))
- {
- stock = "/stock/open";
ewl_callback_append(icon, EWL_CALLBACK_CLICKED,
ewl_filelist_column_cb_dir_clicked, fl);
- }
else
- {
- stock = "/stock/arrow/right";
ewl_callback_append(icon, EWL_CALLBACK_CLICKED,
ewl_filelist_column_cb_file_clicked, fl);
- }
- ewl_icon_image_set(EWL_ICON(icon), ewl_theme_path_get(),
- ewl_theme_data_str_get(EWL_WIDGET(icon), stock));
+ stock = ewl_filelist_stock_icon_get(fl, path);
+ img = ewl_icon_theme_icon_path_get(stock, EWL_ICON_SIZE_MEDIUM);
+ ewl_icon_image_set(EWL_ICON(icon), img, stock);
ewl_container_child_append(EWL_CONTAINER(data), icon);
ewl_widget_show(icon);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_filelist_icon.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ewl_filelist_icon.c 24 May 2006 02:55:15 -0000 1.8
+++ ewl_filelist_icon.c 6 Sep 2006 15:16:11 -0000 1.9
@@ -243,6 +243,7 @@
Ewl_Filelist_Icon *list;
Ewl_Widget *icon;
char *stock, path[PATH_MAX];
+ const char *img;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("fl", fl);
@@ -259,20 +260,15 @@
snprintf(path, PATH_MAX, "%s/%s", dir, file);
if (ecore_file_is_dir(path))
- {
- stock = "/stock/open";
ewl_callback_append(icon, EWL_CALLBACK_CLICKED,
ewl_filelist_icon_cb_dir_clicked, fl);
- }
else
- {
- stock = "/stock/arrow/right";
ewl_callback_append(icon, EWL_CALLBACK_CLICKED,
ewl_filelist_icon_cb_icon_clicked, fl);
- }
- ewl_icon_image_set(EWL_ICON(icon), ewl_theme_path_get(),
- ewl_theme_data_str_get(EWL_WIDGET(icon), stock));
+ stock = ewl_filelist_stock_icon_get(fl, path);
+ img = ewl_icon_theme_icon_path_get(stock, EWL_ICON_SIZE_MEDIUM);
+ ewl_icon_image_set(EWL_ICON(icon), img, stock);
ewl_container_child_append(EWL_CONTAINER(list->freebox), icon);
ewl_widget_show(icon);
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_icon_theme.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_icon_theme.h 20 Aug 2006 18:59:35 -0000 1.2
+++ ewl_icon_theme.h 6 Sep 2006 15:16:11 -0000 1.3
@@ -21,6 +21,7 @@
#define EWL_ICON_APPLICATION_EXIT "application-exit" /**< */
#define EWL_ICON_APPOINTMENT_NEW "appointment-new" /**< */
#define EWL_ICON_CONTACT_NEW "contact-new" /**< */
+#define EWL_ICON_DIALOG_APPLY "dialog-apply" /**< */
#define EWL_ICON_DIALOG_CANCEL "dialog-cancel" /**< */
#define EWL_ICON_DIALOG_CLOSE "dialog-close" /**< */
#define EWL_ICON_DIALOG_OK "dialog-ok" /**< */
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs