Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/lib
Modified Files:
ewl_attach.h ewl_notebook2.c
Log Message:
- use attach data to keep pointers to the tab and the page
this is a lot lighter then using widget_data
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_attach.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_attach.h 31 Jan 2006 05:11:59 -0000 1.4
+++ ewl_attach.h 3 Feb 2006 18:14:30 -0000 1.5
@@ -74,6 +74,20 @@
#define ewl_attach_name_get(w) \
ewl_attach_get(w, EWL_ATTACH_TYPE_NAME)
+/**
+ * @def ewl_attach_notebook_data_set(w, data)
+ * Convience method to attach data to a notebook item
+ */
+#define ewl_attach_notebook_data_set(w, data) \
+ ewl_attach_other_set(w, EWL_ATTACH_TYPE_NOTEBOOK_DATA, data)
+
+/**
+ * @def ewl_attach_notebook_data_get(w)
+ * Convience method to get the data attached to a notebook item
+ */
+#define ewl_attach_notebook_data_get(w) \
+ ewl_attach_get(w, EWL_ATTACH_TYPE_NOTEBOOK_DATA)
+
void ewl_attach_text_set(Ewl_Widget *w, Ewl_Attach_Type t, const char *data);
void ewl_attach_widget_set(Ewl_Widget *w, Ewl_Attach_Type t, Ewl_Widget *data);
void ewl_attach_other_set(Ewl_Widget *w, Ewl_Attach_Type t, void *data);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_notebook2.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_notebook2.c 3 Feb 2006 16:21:24 -0000 1.4
+++ ewl_notebook2.c 3 Feb 2006 18:14:30 -0000 1.5
@@ -3,9 +3,6 @@
#include "ewl_macros.h"
#include "ewl_private.h"
-#define EWL_NOTEBOOK2_TAB "ewl_notebook2_tab"
-#define EWL_NOTEBOOK2_PAGE "ewl_notebook2_page"
-
/**
* @brief Create a new notebook widget
* @return Returns a newly allocated notebook on success. NULL on failure
@@ -237,12 +234,11 @@
if (page == n->cur_page)
DRETURN(DLEVEL_STABLE);
- /* XXX make these and attach */
if (n->cur_page)
{
Ewl_Widget *w;
- t = ewl_widget_data_get(n->cur_page, EWL_NOTEBOOK2_TAB);
+ t = ewl_attach_notebook_data_get(n->cur_page);
if (t) ewl_widget_state_set(t, "default");
/* make sure we set n->cur_page null first or the hide
@@ -255,7 +251,7 @@
n->cur_page = page;
ewl_widget_show(n->cur_page);
- t = ewl_widget_data_get(n->cur_page, EWL_NOTEBOOK2_TAB);
+ t = ewl_attach_notebook_data_get(n->cur_page);
if (t) ewl_widget_state_set(t, "selected");
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -351,14 +347,13 @@
ewl_widget_show(tab);
}
- /* XXX make this attach data */
- t = ewl_widget_data_get(page, EWL_NOTEBOOK2_TAB);
+ t = ewl_attach_notebook_data_get(page);
if (!t)
{
t = ewl_hbox_new();
ewl_widget_appearance_set(t, "tab");
- ewl_widget_data_set(page, EWL_NOTEBOOK2_TAB, t);
- ewl_widget_data_set(t, EWL_NOTEBOOK2_PAGE, page);
+ ewl_attach_notebook_data_set(page, t);
+ ewl_attach_notebook_data_set(t, page);
ewl_widget_show(t);
ewl_callback_append(t, EWL_CALLBACK_CLICKED,
@@ -394,7 +389,7 @@
DCHECK_TYPE_RET("n", n, EWL_NOTEBOOK2_TYPE, NULL);
DCHECK_TYPE_RET("page", page, EWL_WIDGET_TYPE, NULL);
- t = ewl_widget_data_get(page, EWL_NOTEBOOK2_TAB);
+ t = ewl_attach_notebook_data_get(page);
if (!t)
{
DWARNING("We have a notebook page with no tab, bad, very
bad.\n");
@@ -491,9 +486,8 @@
DCHECK_TYPE("c", c, EWL_CONTAINER_TYPE);
DCHECK_TYPE("w", w, EWL_WIDGET_TYPE);
- /* XXX nasty data_get */
n = EWL_NOTEBOOK2(EWL_WIDGET(c)->parent);
- t = ewl_widget_data_get(w, EWL_NOTEBOOK2_TAB);
+ t = ewl_attach_notebook_data_get(w);
if (t) ewl_container_child_remove(EWL_CONTAINER(n->body.tabbar), t);
DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -509,8 +503,7 @@
n = data;
- /* XXX nast data_get */
- page = ewl_widget_data_get(w, EWL_NOTEBOOK2_PAGE);
+ page = ewl_attach_notebook_data_get(w);
ewl_notebook2_visible_page_set(n, page);
DLEAVE_FUNCTION(DLEVEL_STABLE);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs