More work on the buttons

This commit is contained in:
Jaime Thomas 2008-09-19 16:24:47 +00:00
parent d8709c66eb
commit 7bf6b5f7ae
4 changed files with 50 additions and 11 deletions

View File

@ -87,4 +87,34 @@ group {
} }
} }
} }
programs {
program {
name: "b1_selected";
signal: "mouse,down,1";
action: SIGNAL_EMIT "selected" "b1";
source: "b1";
}
program {
name: "b2_selected";
signal: "mouse,down,1";
action: SIGNAL_EMIT "selected" "b2";
source: "b2";
}
program {
name: "b3_selected";
signal: "mouse,down,1";
action: SIGNAL_EMIT "selected" "b3";
source: "b3";
}
program {
name: "b4_selected";
signal: "mouse,down,1";
action: SIGNAL_EMIT "selected" "b4";
source: "b4";
}
}
} }

View File

@ -38,6 +38,7 @@
typedef struct _Ecdb_Main Ecdb_Main; typedef struct _Ecdb_Main Ecdb_Main;
struct _Ecdb_Main struct _Ecdb_Main
{ {
char theme_path[PATH_MAX];
Ecore_Evas *main_win_ee; Ecore_Evas *main_win_ee;
Ecore_List *drives; Ecore_List *drives;
}; };

View File

@ -1,6 +1,8 @@
#include "ecdb.h" #include "ecdb.h"
static void ecdb_handle_typebuf(Evas_Object *gui); static void ecdb_handle_typebuf(Evas_Object *gui);
static void ecdb_cb_welcome_page(void *data, Evas_Object *o,
const char *emission, const char *source);
static void static void
ecdb_cb_enter(Ecore_Evas *ee) ecdb_cb_enter(Ecore_Evas *ee)
@ -213,13 +215,13 @@ ecdb_create_main_gui(void)
welcome_page = edje_object_add(ecore_evas_get(em->main_win_ee)); welcome_page = edje_object_add(ecore_evas_get(em->main_win_ee));
evas_object_name_set(welcome_page, "welcome_page"); evas_object_name_set(welcome_page, "welcome_page");
// XXX Don't hardcode this edje_object_file_set(welcome_page, em->theme_path, "ecdb/welcome_page");
edje_object_file_set(welcome_page, PACKAGE_DATA_DIR
"/themes/default.edj", "ecdb/welcome_page");
edje_object_part_geometry_get(gui, "active_area", &x, &y, &w, &h); edje_object_part_geometry_get(gui, "active_area", &x, &y, &w, &h);
evas_object_move(welcome_page, x, y); evas_object_move(welcome_page, x, y);
evas_object_resize(welcome_page, w, h); evas_object_resize(welcome_page, w, h);
edje_object_part_swallow(gui, "action_area", welcome_page); edje_object_part_swallow(gui, "action_area", welcome_page);
edje_object_signal_callback_add(welcome_page, "selected", "b*",
ecdb_cb_welcome_page, NULL);
evas_object_show(welcome_page); evas_object_show(welcome_page);
/* Buttons next, do properly next */ /* Buttons next, do properly next */
@ -234,8 +236,7 @@ ecdb_create_main_gui(void)
{ {
b = edje_object_add(ecore_evas_get(em->main_win_ee)); b = edje_object_add(ecore_evas_get(em->main_win_ee));
evas_object_name_set(b, names[i]); evas_object_name_set(b, names[i]);
edje_object_file_set(b, PACKAGE_DATA_DIR edje_object_file_set(b, em->theme_path, "ecdb/button");
"/themes/default.edj", "ecdb/button");
edje_object_part_geometry_get(welcome_page, names[i], edje_object_part_geometry_get(welcome_page, names[i],
&x, &y, &w, &h); &x, &y, &w, &h);
edje_object_part_text_set(b, "label", labels[i]); edje_object_part_text_set(b, "label", labels[i]);
@ -274,11 +275,12 @@ ecdb_set_main_theme(const char *theme_name, const char *group)
if (!theme_name) if (!theme_name)
{ {
if (!edje_object_file_set(gui, PACKAGE_DATA_DIR snprintf(em->theme_path, PATH_MAX, "%s/%s", PACKAGE_DATA_DIR,
"/themes/default.edj", group)) "themes/default.edj");
if (!edje_object_file_set(gui, em->theme_path, group))
{ {
printf("Error setting default theme: %s\n", printf("Error setting default theme: %s\n",
PACKAGE_DATA_DIR"/themes/default.edj"); em->theme_path);
return; return;
} }
evas_font_path_append(ecore_evas_get(em->main_win_ee), evas_font_path_append(ecore_evas_get(em->main_win_ee),
@ -386,3 +388,11 @@ ecdb_handle_typebuf(Evas_Object *gui)
edje_object_part_text_set(gui, "filelist_overlay_text", NULL); edje_object_part_text_set(gui, "filelist_overlay_text", NULL);
} }
static void
ecdb_cb_welcome_page(void *data, Evas_Object *o, const char *emission,
const char *source)
{
printf("callback from %s\n", source);
printf("callback %s\n", emission);
}

View File

@ -130,9 +130,7 @@ ecdb_button_icon_swallow(Evas *e, Evas_Object *b, const char *iname)
icon = evas_object_image_add(e); icon = evas_object_image_add(e);
/* FIXME WRONG HERE */ evas_object_image_file_set(icon, em->theme_path, iname);
evas_object_image_file_set(icon, PACKAGE_DATA_DIR"/themes/default.edj",
iname);
edje_object_part_swallow(b, "icon", icon); edje_object_part_swallow(b, "icon", icon);
} }