summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/e_shelf.c52
-rw-r--r--src/bin/e_shelf.h2
2 files changed, 54 insertions, 0 deletions
diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c
index dd8abfa..849270b 100644
--- a/src/bin/e_shelf.c
+++ b/src/bin/e_shelf.c
@@ -20,6 +20,7 @@ static Eina_Bool _e_shelf_cb_mouse_in(void *data, int type, void *event);
20static Eina_Bool _e_shelf_cb_mouse_out(void *data, int type, void *event); 20static Eina_Bool _e_shelf_cb_mouse_out(void *data, int type, void *event);
21static void _e_shelf_cb_mouse_out2(E_Shelf *es, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Out *ev); 21static void _e_shelf_cb_mouse_out2(E_Shelf *es, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Out *ev);
22static int _e_shelf_cb_id_sort(const void *data1, const void *data2); 22static int _e_shelf_cb_id_sort(const void *data1, const void *data2);
23static void _e_shelf_cb_menu_rename(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__);
23static Eina_Bool _e_shelf_cb_hide_animator(void *data); 24static Eina_Bool _e_shelf_cb_hide_animator(void *data);
24static Eina_Bool _e_shelf_cb_hide_animator_timer(void *data); 25static Eina_Bool _e_shelf_cb_hide_animator_timer(void *data);
25static Eina_Bool _e_shelf_cb_hide_urgent_timer(void *data); 26static Eina_Bool _e_shelf_cb_hide_urgent_timer(void *data);
@@ -290,6 +291,14 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
290} 291}
291 292
292EAPI void 293EAPI void
294e_shelf_rename_dialog(E_Shelf *es)
295{
296 if (!es) return;
297 if (es->rename_dialog) return;
298 _e_shelf_cb_menu_rename(es, NULL, NULL);
299}
300
301EAPI void
293e_shelf_zone_move_resize_handle(E_Zone *zone) 302e_shelf_zone_move_resize_handle(E_Zone *zone)
294{ 303{
295 Eina_List *l; 304 Eina_List *l;
@@ -1889,6 +1898,44 @@ _e_shelf_cb_instant_hide_timer(void *data)
1889} 1898}
1890 1899
1891static void 1900static void
1901_e_shelf_cb_menu_rename_yes_cb(char *text, void *data)
1902{
1903 E_Shelf *es = e_object_data_get(data);
1904 Eina_List *l;
1905 E_Config_Shelf *cf_es;
1906
1907 EINA_LIST_FOREACH(e_config->shelves, l, cf_es)
1908 if ((!strcmp(cf_es->name, text)) && (cf_es->id == es->id))
1909 {
1910 e_util_dialog_internal(_("Error"), _("A shelf with that name and id already exists!"));
1911 return;
1912 }
1913 e_shelf_name_set(es, text);
1914 e_config_save_queue();
1915}
1916
1917static void
1918_e_shelf_cb_menu_rename_cb(void *data)
1919{
1920 E_Shelf *es = e_object_data_get(data);
1921 es->rename_dialog = NULL;
1922}
1923
1924static void
1925_e_shelf_cb_menu_rename(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
1926{
1927 E_Shelf *es = data;
1928 if (es->rename_dialog) return;
1929 es->rename_dialog = e_entry_dialog_show(_("Rename Shelf"), "edit-rename",
1930 _("Name:"), es->name, NULL, NULL,
1931 _e_shelf_cb_menu_rename_yes_cb,
1932 NULL, es);
1933 E_OBJECT(es->rename_dialog)->data = es;
1934 e_object_del_attach_func_set(E_OBJECT(es->rename_dialog),
1935 _e_shelf_cb_menu_rename_cb);
1936}
1937
1938static void
1892_e_shelf_menu_pre_cb(void *data, E_Menu *m) 1939_e_shelf_menu_pre_cb(void *data, E_Menu *m)
1893{ 1940{
1894 E_Shelf *es; 1941 E_Shelf *es;
@@ -1922,6 +1969,11 @@ _e_shelf_menu_pre_cb(void *data, E_Menu *m)
1922 e_menu_item_separator_set(mi, 1); 1969 e_menu_item_separator_set(mi, 1);
1923 1970
1924 mi = e_menu_item_new(m); 1971 mi = e_menu_item_new(m);
1972 e_menu_item_label_set(mi, _("Rename"));
1973 e_util_menu_item_theme_icon_set(mi, "edit-rename");
1974 e_menu_item_callback_set(mi, _e_shelf_cb_menu_rename, es);
1975
1976 mi = e_menu_item_new(m);
1925 e_menu_item_label_set(mi, _("Delete")); 1977 e_menu_item_label_set(mi, _("Delete"));
1926 e_util_menu_item_theme_icon_set(mi, "list-remove"); 1978 e_util_menu_item_theme_icon_set(mi, "list-remove");
1927 e_menu_item_callback_set(mi, _e_shelf_cb_menu_delete, es); 1979 e_menu_item_callback_set(mi, _e_shelf_cb_menu_delete, es);
diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h
index 2c210c4..ba00fce 100644
--- a/src/bin/e_shelf.h
+++ b/src/bin/e_shelf.h
@@ -27,6 +27,7 @@ struct _E_Shelf
27 E_Config_Shelf *cfg; 27 E_Config_Shelf *cfg;
28 int size; 28 int size;
29 E_Config_Dialog *config_dialog; 29 E_Config_Dialog *config_dialog;
30 E_Entry_Dialog *rename_dialog;
30 E_Menu *menu; 31 E_Menu *menu;
31 Ecore_Timer *hide_timer; 32 Ecore_Timer *hide_timer;
32 Ecore_Animator *hide_animator; 33 Ecore_Animator *hide_animator;
@@ -83,6 +84,7 @@ EAPI void e_shelf_style_set(E_Shelf *es, const char *style);
83EAPI void e_shelf_popup_set(E_Shelf *es, int popup); 84EAPI void e_shelf_popup_set(E_Shelf *es, int popup);
84EAPI E_Shelf *e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es); 85EAPI E_Shelf *e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es);
85EAPI void e_shelf_name_set(E_Shelf *es, const char *name); 86EAPI void e_shelf_name_set(E_Shelf *es, const char *name);
87EAPI void e_shelf_rename_dialog(E_Shelf *es);
86 88
87#endif 89#endif
88#endif 90#endif