Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : proto
Dir : e17/proto/entropy/src/plugins
Modified Files:
etk_list_viewer.c
Log Message:
* Right click menu for etk
===================================================================
RCS file:
/cvsroot/enlightenment/e17/proto/entropy/src/plugins/etk_list_viewer.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -3 -r1.31 -r1.32
--- etk_list_viewer.c 2 Mar 2006 00:57:11 -0000 1.31
+++ etk_list_viewer.c 2 Mar 2006 01:46:23 -0000 1.32
@@ -29,6 +29,8 @@
entropy_file_progress_window* progress;
Etk_Widget *last_selected_label;
+
+ Etk_Widget* popup;
};
typedef struct event_file_core event_file_core;
@@ -48,6 +50,12 @@
Etk_Tree_Row *icon;
};
+typedef enum _Etk_Menu_Item_Type
+{
+ ETK_MENU_ITEM_NORMAL,
+ ETK_MENU_ITEM_SEPARATOR
+} Etk_Menu_Item_Type;
+
void
gui_file_destroy (gui_file * file)
@@ -82,6 +90,38 @@
}
+static Etk_Widget *_entropy_etk_menu_item_new(Etk_Menu_Item_Type item_type,
const char *label,
+ Etk_Stock_Id stock_id, Etk_Menu_Shell *menu_shell, Etk_Widget *statusbar)
+{
+ Etk_Widget *menu_item = NULL;
+
+ switch (item_type)
+ {
+ case ETK_MENU_ITEM_NORMAL:
+ menu_item = etk_menu_item_new_with_label(label);
+ break;
+ case ETK_MENU_ITEM_SEPARATOR:
+ menu_item = etk_menu_separator_new();
+ break;
+ default:
+ return NULL;
+ }
+ if (stock_id != ETK_STOCK_NO_STOCK)
+ {
+ Etk_Widget *image;
+
+ image = etk_image_new_from_stock(stock_id, ETK_STOCK_SMALL);
+ etk_menu_item_image_set(ETK_MENU_ITEM(menu_item), ETK_IMAGE(image));
+ }
+ etk_menu_shell_append(menu_shell, ETK_MENU_ITEM(menu_item));
+
+ /*etk_signal_connect("selected", ETK_OBJECT(menu_item),
ETK_CALLBACK(_etk_test_menu_item_selected_cb), statusbar);
+ etk_signal_connect("deselected", ETK_OBJECT(menu_item),
ETK_CALLBACK(_etk_test_menu_item_deselected_cb), statusbar);*/
+
+ return menu_item;
+}
+
+
/* Compares two rows of the tree */
static int _entropy_etk_list_filename_compare_cb(Etk_Tree *tree, Etk_Tree_Row
*row1, Etk_Tree_Row *row2, Etk_Tree_Col *col, void *data)
{
@@ -367,7 +407,7 @@
- if (event->flags & EVAS_BUTTON_DOUBLE_CLICK) {
+ if (event->flags & EVAS_BUTTON_DOUBLE_CLICK && event->button == 1) {
printf("Row clicked, file is: %s\n", file->file->filename);
gui_event = entropy_malloc (sizeof (entropy_gui_event));
@@ -375,6 +415,9 @@
entropy_core_gui_event_get (ENTROPY_GUI_EVENT_ACTION_FILE);
gui_event->data = file->file;
entropy_core_layout_notify_event (file->instance, gui_event,
ENTROPY_EVENT_GLOBAL);
+ } else if (event->button == 3) {
+ etk_tree_row_select(row);
+ etk_menu_popup(ETK_MENU(viewer->popup));
}
}
@@ -759,6 +802,17 @@
entropy_core_gui_event_get
(ENTROPY_GUI_EVENT_THUMBNAIL_AVAILABLE));
+
+
+ /*Popup init*/
+ viewer->popup = etk_menu_new();
+ _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Copy"),
ETK_STOCK_EDIT_COPY, ETK_MENU_SHELL(viewer->popup),NULL);
+ _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Cut"),
ETK_STOCK_EDIT_CUT, ETK_MENU_SHELL(viewer->popup),NULL);
+ _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Paste"),
ETK_STOCK_EDIT_PASTE, ETK_MENU_SHELL(viewer->popup),NULL);
+ _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Delete"),
ETK_STOCK_EDIT_COPY, ETK_MENU_SHELL(viewer->popup),NULL);
+ _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Properties"),
ETK_STOCK_EDIT_COPY, ETK_MENU_SHELL(viewer->popup),NULL);
+
+
if (!etk_callback_setup) {
etk_callback_setup = 1;
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs