Esempio n. 1
0
Ewl_Widget *
widget_new( char *name )
{
	Ewler_Widget *w;

	if( !name )
		return NULL;

	w = spec_new( name );
	if( !w || !w->w )
		return NULL;

	w->selected = false;
	
	ewl_callback_append(w->w, EWL_CALLBACK_REALIZE, realize, w);
	ewl_callback_append(w->w, EWL_CALLBACK_CONFIGURE, configure, w);
	ewl_widget_show(w->w);

	w->bg = ewl_vbox_new();
	w->bg->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
	ewl_widget_appearance_set(w->bg, "select_bg");
	ewl_theme_data_str_set(w->bg, "/select_bg/file", EWLER_EET);
	ewl_theme_data_str_set(w->bg, "/select_bg/group", "select_bg");
	ewl_object_fill_policy_set(EWL_OBJECT(w->bg), EWL_FLAG_FILL_NONE);
	ewl_widget_data_set(w->bg, "EWLER_WIDGET", w);
	ewl_container_child_append(EWL_CONTAINER(w->bg), w->w);
	ewl_widget_show(w->bg);

	w->fg = ewl_vbox_new();
	w->fg->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
	ewl_widget_appearance_set(w->fg, "select_fg");
	ewl_theme_data_str_set(w->fg, "/select_fg/file", EWLER_EET);
	ewl_theme_data_str_set(w->fg, "/select_fg/group", "select_fg");
	ewl_callback_append(w->fg, EWL_CALLBACK_CONFIGURE, fg_configure, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_REALIZE, fg_realize, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_FOCUS_IN, fg_mouse_in, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_FOCUS_OUT, fg_mouse_out, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_MOUSE_DOWN, fg_mouse_down, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_MOUSE_UP, fg_mouse_up, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_MOUSE_MOVE, fg_mouse_move, w);
	ewl_callback_append(w->fg, EWL_CALLBACK_DESTROY, widget_destroy, w);
	ewl_object_fill_policy_set(EWL_OBJECT(w->fg), EWL_FLAG_FILL_NONE);
	ewl_widget_data_set(w->fg, "EWLER_WIDGET", w);
	ewl_container_child_append(EWL_CONTAINER(w->fg), w->bg);
	ewl_widget_show(w->fg);

	w->selectable = true;
	w->configured = false;

	return w->fg;
}
static void
setup_hash()
{

        int i;

        key1 = ecore_hash_new(ecore_str_hash, ecore_str_compare);
        key2 = ecore_hash_new(ecore_str_hash, ecore_str_compare);

        for (i = 0; keywords1[i] != NULL; i++)
                ecore_hash_set(key1, keywords1[i], keywords1[i]);

        for (i = 0; keywords2[i] != NULL; i++)
                ecore_hash_set(key2, keywords2[i], keywords2[i]);
}
Esempio n. 3
0
/**
 * popup menu for managing files in the project
 */
static EWL_CALLBACK_DEFN(project_file_menu)
{
	Ewl_Widget *item;
	Ewl_Event_Mouse_Up *ev = ev_data;

	if( file_menu ) {
		ewl_widget_destroy(file_menu);
		file_menu = NULL;
	} else if( ev->button == 3 ) {
		ewl_window_raise(EWL_WINDOW(project_win));

		file_menu = ewl_imenu_new(NULL, "File Options");
		ewl_object_position_request(EWL_OBJECT(file_menu), ev->x, ev->y);
		ewl_object_fill_policy_set(EWL_OBJECT(file_menu), EWL_FLAG_FILL_NONE);
		ewl_container_child_append(EWL_CONTAINER(project_win), file_menu);
		ewl_callback_append(file_menu, EWL_CALLBACK_CONFIGURE,
												project_file_menu_configure, NULL);
		ewl_callback_call(file_menu, EWL_CALLBACK_SELECT);
		ewl_widget_show(file_menu);

		item = ewl_menu_item_new(NULL, "Save");
		/* HACK FOR NON-STRING DATA HASHES */
		item->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
		ewl_widget_data_set(item, "Action", (void *) EWLER_FILE_SAVE);
		ewl_callback_append(item, EWL_CALLBACK_SELECT,
												project_file_menu_cb, user_data);
		ewl_container_child_append(EWL_CONTAINER(file_menu), item);
		ewl_widget_show(item);

		item = ewl_menu_item_new(NULL, "Settings...");
		/* HACK FOR NON-STRING DATA HASHES */
		item->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
		ewl_widget_data_set(item, "Action", (void *) EWLER_FILE_SETTINGS);
		ewl_callback_append(item, EWL_CALLBACK_SELECT,
												project_file_menu_cb, user_data);
		ewl_container_child_append(EWL_CONTAINER(file_menu), item);
		ewl_widget_show(item);

		item = ewl_menu_item_new(NULL, "Delete");
		/* HACK FOR NON-STRING DATA HASHES */
		item->data = ecore_hash_new(ecore_str_hash, ecore_str_compare);
		ewl_widget_data_set(item, "Action", (void *) EWLER_FILE_DELETE);
		ewl_callback_append(item, EWL_CALLBACK_SELECT,
												project_file_menu_cb, user_data);
		ewl_container_child_append(EWL_CONTAINER(file_menu), item);
		ewl_widget_show(item);
	}
}
Esempio n. 4
0
/**
 * open an existing project from a file.
 */
static int
project_open( char *filename )
{
	Ewler_Project *p;

	p = project_copy();
	if( !p ) {
		ewler_error("project_open: out of memory!");
		return -1;
	}

	active_project->filename = strdup(filename);
	active_project->files = ecore_hash_new(ecore_str_hash, ecore_str_compare);

	if( file_project_open(active_project) == 0 ) {
		project_close(p);
		active_project->dirty = false;
		active_project->ever_saved = true;
		project_update();
	} else {
		project_close(active_project);
		active_project = p;
		ewler_error("Unable to open project file: %s", active_project->filename);
		return -1;
	}

	return 0;
}
Esempio n. 5
0
evfs_plugin_functions *
evfs_plugin_init()
{
   printf("Initialising the file plugin..\n");
   evfs_plugin_functions *functions = calloc(1, sizeof(evfs_plugin_functions));

   posix_monitor_hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);

   functions->evfs_client_disconnect = &evfs_client_disconnect;

   functions->evfs_file_remove = &evfs_file_remove;
   functions->evfs_monitor_start = &evfs_monitor_start;
   functions->evfs_monitor_stop = &evfs_monitor_stop;
   functions->evfs_file_stat = &evfs_file_stat;
   functions->evfs_file_lstat = &evfs_file_lstat;

   functions->evfs_file_open = &evfs_file_open;
   functions->evfs_file_close = &evfs_file_close;
   functions->evfs_dir_list = &evfs_dir_list;

   functions->evfs_file_seek = &evfs_file_seek;
   functions->evfs_file_read = &evfs_file_read;
   functions->evfs_file_write = &evfs_file_write;
   functions->evfs_file_create = &evfs_file_create;
   functions->evfs_file_mkdir = &evfs_file_mkdir;
   functions->evfs_file_rename = &evfs_file_rename;
   return functions;

}
Esempio n. 6
0
/**
 * @return Returns no value
 * @brief Called when the icon theme is changed so we can clean up any
 * caching we have in place
 */
void
ewl_icon_theme_theme_change(void)
{
        const char *icon_theme;

        DENTER_FUNCTION(DLEVEL_STABLE);

        icon_theme = ewl_config_string_get(ewl_config, EWL_CONFIG_THEME_ICON_THEME);

        /* check if this is an edje theme */
        if (icon_theme && (!strncasecmp(icon_theme + (strlen(icon_theme) - 4),
                                              ".edj", 4)))
                ewl_icon_theme_is_edje = 1;
        else
                ewl_icon_theme_is_edje = 0;

        /* destroy the cache and re-create it */
        IF_FREE_HASH(ewl_icon_theme_cache);

        ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
        ecore_hash_free_key_cb_set(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
        ecore_hash_free_value_cb_set(ewl_icon_theme_cache, free);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}
Esempio n. 7
0
void egxp_node_add_child (Egxp_Node * parent, Egxp_Node * child) {
#ifdef EGXP_DEBUG
  printf("TRACE: egxp_node_add_child\n");
#endif
  
  assert (parent && child);

  if (parent->childs == NULL) {
    /* create a hash */
    parent->childs = ecore_hash_new (ecore_direct_hash, ecore_direct_compare);
    /* destroy each element */
    ecore_hash_set_free_value (parent->childs, (Ecore_Free_Cb)ecore_dlist_destroy);
  }
  
  /* try to get the list for the special tag */
  Ecore_DList * ltmp = ECORE_DLIST (ecore_hash_get (parent->childs, (int*)child->tag));
  
  if (ltmp == NULL) {
    /* doesn't exist, so create it */
    ltmp = ecore_dlist_new ();
    ecore_dlist_set_free_cb (ltmp,(Ecore_Free_Cb)egxp_node_free);
    
    /* append the list to the hash, hash is indexed by the tag id */
    ecore_hash_set (parent->childs, (int*)child->tag, ltmp);
  }
  
  /* now append the child to the list */
  egxp_node_add_in_order (ltmp, child);

  /* set the parent for the child */
  child->parent = parent;
}
Esempio n. 8
0
void evfs_auth_cache_init()
{
	if (!_evfs_auth_cache_init) {
		_evfs_auth_cache_init = 1;
		_evfs_auth_hash = ecore_hash_new(ecore_str_hash, 
			ecore_str_compare);

	}
}
Esempio n. 9
0
/**
 * Initialize an xml document structure to some sane starting values.
 * @param   xml The xml to initialize.
 * @return  @c TRUE if successful, @c FALSE if an error occurs.
 * @ingroup EXML_Creation_Group
 */
int exml_init(EXML *xml)
{
	CHECK_PARAM_POINTER_RETURN("xml", xml, FALSE);

	xml->buffers = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
	ecore_hash_free_value_cb_set(xml->buffers, ECORE_FREE_CB(xmlBufferFree));

	return TRUE;
}
Esempio n. 10
0
entropy_thumbnail *
entropy_thumbnail_new ()
{
  entropy_thumbnail *thumb = entropy_malloc (sizeof (entropy_thumbnail));

  thumb->text = ecore_hash_new (ecore_str_hash, ecore_str_compare);
  thumb->keys = 0;

  return thumb;
}
Esempio n. 11
0
/**
 * Initialize an XML_Node to starting values
 * @param   node The node to initialize
 * @return  @c TRUE if successful, @c FALSE if an error occurs.
 * @ingroup EXML_Creation_Group
 */
int exml_node_init(EXML_Node *node)
{
	CHECK_PARAM_POINTER_RETURN("node", node, FALSE);

	node->attributes = ecore_hash_new( ecore_str_hash, ecore_str_compare );
	ecore_hash_free_value_cb_set( node->attributes, free );
	ecore_hash_free_key_cb_set( node->attributes, free );
	node->children = ecore_list_new();
	ecore_list_free_cb_set( node->children, _exml_node_destroy );

	return TRUE;
}
Esempio n. 12
0
/**
 * @return Returns TRUE on success or FALSE on failure
 * @brief Initializes the icon theme system
 */
int
ewl_icon_theme_init(void)
{
        DENTER_FUNCTION(DLEVEL_STABLE);

        if (!ewl_icon_theme_cache)
        {
                ewl_icon_theme_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
                ecore_hash_free_key_cb_set(ewl_icon_theme_cache, ewl_icon_theme_cb_free);
                ecore_hash_free_value_cb_set(ewl_icon_theme_cache, free);

                ewl_icon_fallback_theme_cache = ecore_hash_new(
                                                ecore_str_hash, ecore_str_compare);
                ecore_hash_free_key_cb_set(ewl_icon_fallback_theme_cache,
                                                ewl_icon_theme_cb_free);
                ecore_hash_free_value_cb_set(ewl_icon_fallback_theme_cache,
                                                free);
        }

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Esempio n. 13
0
/**
 * @internal
 * @return Returns TRUE on success or FALSE on failure
 * @brief Initializes the context system
 */
int
ewl_text_context_init(void)
{
        DENTER_FUNCTION(DLEVEL_STABLE);

        if (!context_hash)
        {
                context_hash = ecore_hash_new(ewl_text_context_hash_key,
                                ewl_text_context_hash_cmp);
                ecore_hash_free_value_cb_set(context_hash,
                                                ewl_text_context_cb_free);
        }

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Esempio n. 14
0
Egxp_Opcode * egxp_opcode_new () {
#ifdef EGXP_DEBUG
  printf("TRACE: egxp_opcode_new\n");
#endif
  Egxp_Opcode * tmp = EGXP_OPCODE(malloc (sizeof(Egxp_Opcode)));

  /* initialize the hash map */
  tmp->string_id = ecore_hash_new (ecore_str_hash, ecore_str_compare);
  ecore_hash_set_free_value (tmp->string_id,(Ecore_Free_Cb) free);
  
  tmp->id_string = NULL;
  tmp->id = 0;
  tmp->need_update = 0;

  /* add automaticly the __ROOT__ element */
  egxp_opcode_add (tmp, "__ROOT__");
    
  return tmp;
}
Esempio n. 15
0
/**
 * Initialize the ecore string internal structure.
 * @return  Zero on failure, non-zero on successful initialization.
 */
EAPI int
ecore_string_init()
{
   /*
    * No strings have been loaded at this point, so create the hash
    * table for storing string info for later.
    */
   if (!ecore_string_init_count)
     {
        ecore_strings = ecore_hash_new(ecore_str_hash, ecore_str_compare);
        if (!ecore_strings)
           return 0;

        ecore_hash_free_value_cb_set(ecore_strings, ecore_string_free_cb);
     }

   ecore_string_init_count++;

   return 1;
}
Esempio n. 16
0
static void
eina_bench_lookup_ecore(int request)
{
   Ecore_Hash *hash = NULL;
   Eina_Bench_Ecore *elm;
   unsigned int i;
   unsigned int j;

   hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);

   ecore_hash_free_key_cb_set(hash, NULL);
   ecore_hash_free_value_cb_set(hash, free);

   for (i = 0; i < (unsigned int)request; ++i)
     {
        elm = malloc(sizeof (Eina_Bench_Ecore) + 10);
        if (!elm)
           continue;

        elm->key = (char *)(elm + 1);
        eina_convert_itoa(i, elm->key);
        elm->value = i;

        ecore_hash_set(hash, elm->key, elm);
     }

   srand(time(NULL));

   for (j = 0; j < 200; ++j)
      for (i = 0; i < (unsigned int)request; ++i)
        {
           char tmp_key[10];

           eina_convert_itoa(rand() % request, tmp_key);

           elm = ecore_hash_get(hash, tmp_key);
        }

   ecore_hash_destroy(hash);
}
Esempio n. 17
0
/**
 * @return Returns TRUE on successful initialization, FALSE otherwise
 * @brief Initializes the IO manager system.
 */
int
ewl_io_manager_init(void)
{
        DENTER_FUNCTION(DLEVEL_STABLE);

        if (!ewl_io_manager_ext_icon_map)
        {
                /* XXX this is a dumb way to do this.... */
                ewl_io_manager_ext_icon_map = ecore_hash_new(ecore_str_hash,
                                                ewl_io_manager_strcasecompare);
                /* Images */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".png",
                                                EWL_ICON_IMAGE_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".jpg",
                                                EWL_ICON_IMAGE_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".gif",
                                                EWL_ICON_IMAGE_X_GENERIC);

                /* Videos */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".wmv",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mpg",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mpeg",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".avi",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mov",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".asf",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mp4",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mkv",
                                                EWL_ICON_VIDEO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".ogm",
                                                EWL_ICON_VIDEO_X_GENERIC);

                /* Audio */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mp3",
                                                EWL_ICON_AUDIO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".mka",
                                                EWL_ICON_AUDIO_X_GENERIC);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".ogg",
                                                EWL_ICON_AUDIO_X_GENERIC);

                /* HTML */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".html",
                                                EWL_ICON_TEXT_HTML);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".htm",
                                                EWL_ICON_TEXT_HTML);

                /* Scirpts */
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".pl",
                                                EWL_ICON_TEXT_X_SCRIPT);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".sh",
                                                EWL_ICON_TEXT_X_SCRIPT);
                ecore_hash_set(ewl_io_manager_ext_icon_map, ".ksh",
                                                EWL_ICON_TEXT_X_SCRIPT);

                ewl_io_manager_plugins = ecore_hash_new(ecore_str_hash,
                                                        ecore_str_compare);
                ecore_hash_free_key_cb_set(ewl_io_manager_plugins, free);
                ecore_hash_free_value_cb_set(ewl_io_manager_plugins,
                                                ewl_io_manager_cb_free_plugin);
        }

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Esempio n. 18
0
entropy_gui_component_instance *
entropy_plugin_layout_create (entropy_core * core)
{
  Etk_Widget *window;
  entropy_layout_gui *gui;
  entropy_gui_component_instance *layout;

  void *(*local_plugin_init) (entropy_core * core,
				  entropy_gui_component_instance *,
				  void *data);
  entropy_plugin *local;

  entropy_plugin *meta;
  entropy_plugin *hover;
  entropy_plugin *trackback;
  entropy_gui_component_instance* meta_instance;
  entropy_gui_component_instance* hover_instance;
	  
  Etk_Tree_Col* col;
  Etk_Widget* vbox;
  Etk_Widget* menubar;
  Etk_Widget* menu_item;
  Etk_Widget* menu;

  Eina_List* structures;
  Entropy_Config_Structure* structure;
  int local_viewer_selected = 0;


  /*Entropy related init */
  layout = (entropy_gui_component_instance*)entropy_gui_component_instance_layout_new(); /*Create a component instance */
  gui = entropy_malloc (sizeof (entropy_layout_gui));
  layout->data = gui;
  layout->core = core;
  gui->progress_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
  gui->properties_request_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);

  /*Global init for all layouts*/
  if (!_etk_layout_global_init) {
	  /*Request metadata groups from evfs*/
	entropy_plugin_filesystem_metadata_groups_get(layout);
	  
	  _etk_layout_row_reference = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
	  _etk_layout_structure_plugin_reference = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
	  
	  _etk_layout_global_init = 1;
  }


  /*Register this layout container with the core, so our children can get events */
  entropy_core_layout_register (core, layout);


  /*Register this instance (the layout itself), to receive events that can be safely handled
   * by the layout (and reduce the clutter in the child plugins)
   * i.e. PROGRESS events, Stat for properties, Overwrite yes/no/etc events, etc*/

  /*Handle progress events*/
  entropy_core_component_event_register (layout,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_PROGRESS));

    /*We want to know if the backend needs feedback */
  entropy_core_component_event_register (layout,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_USER_INTERACTION_YES_NO_ABORT));

    /*We want to know if a stat is an 'extended stat' - e.g. a properties dialog etc */
  entropy_core_component_event_register (layout,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_EXTENDED_STAT));

  entropy_core_component_event_register (layout,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT));
  entropy_core_component_event_register (layout,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT_AVAILABLE));

  entropy_core_component_event_register (layout,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_METADATA_GROUPS));

  entropy_core_component_event_register (layout,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_PASTE_REQUEST));

  entropy_core_component_event_register (layout,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_AUTH_REQUEST));

  entropy_core_component_event_register (layout,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_META_ALL_REQUEST));


  /*Etk related init */
  window = etk_window_new ();
  layout->gui_object = window;
  etk_signal_connect("key-down", ETK_OBJECT(window), ETK_CALLBACK(_entropy_etk_layout_key_down_cb), layout);
  
  gui->paned = etk_hpaned_new();
  

  etk_signal_connect ("delete-event", ETK_OBJECT (window),
		      ETK_CALLBACK (_etk_window_deleted_cb), layout);

  etk_window_title_set(ETK_WINDOW(window), "Entropy");
  etk_window_wmclass_set(ETK_WINDOW(window), "entropy", "Entropy");

  vbox = etk_vbox_new(ETK_FALSE,0);
  etk_container_add(ETK_CONTAINER(window), vbox);

  /*Tree init*/
  gui->tree = etk_tree_new();
  gui->tree_shell = etk_vbox_new(ETK_FALSE,0);
  etk_box_append(ETK_BOX(gui->tree_shell), gui->tree, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0); 

  etk_paned_child1_set(ETK_PANED(gui->paned), gui->tree_shell, ETK_FALSE);
  etk_tree_mode_set(ETK_TREE(gui->tree), ETK_TREE_MODE_TREE);
  col = etk_tree_col_new(ETK_TREE(gui->tree), _("Folders"), 60,0.0);
  etk_tree_col_model_add(col, etk_tree_model_image_new());
  etk_tree_col_model_add(col, etk_tree_model_text_new());   
  
  etk_tree_col_expand_set(col, ETK_TRUE);
  etk_tree_build(ETK_TREE(gui->tree));
  etk_widget_size_request_set(ETK_WIDGET(gui->tree), ENTROPY_ETK_WINDOW_PANE_DEFAULT_X, 50);

  /*Register to receive events related to the treeview config*/
  entropy_config_misc_callback_register("general.treeviewer", _entropy_layout_etk_simple_config_cb, gui);

  /*If we're configured not to show tree on start, don't show*/
  if (!entropy_config_misc_is_set("general.treeviewer")) {
	  entropy_etk_layout_tree_show(gui,0);
  } else {
	etk_paned_position_set(ETK_PANED(gui->paned), ENTROPY_ETK_WINDOW_PANE_DEFAULT_X);
  }

  /*LocalShell Init*/
  gui->localshell = etk_vbox_new(ETK_TRUE,0);
  etk_paned_child2_set(ETK_PANED(gui->paned), gui->localshell, ETK_TRUE);

  /*Trackback container init*/
  gui->trackback_shell = etk_vbox_new(ETK_TRUE,0);

  /*Popup init*/
   gui->popup = etk_menu_new();
   etk_signal_connect("row-clicked", ETK_OBJECT( gui->tree  ),
          ETK_CALLBACK(_etk_layout_row_clicked), layout);

   menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Delete this location"),
		   ETK_STOCK_DOCUMENT_OPEN, ETK_MENU_SHELL(gui->popup),NULL);
   etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_etk_layout_location_delete_confirm_cb), layout);
   menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Add a new location"),
		   ETK_STOCK_DOCUMENT_OPEN, ETK_MENU_SHELL(gui->popup),NULL);
   

  for (structures = entropy_config_standard_structures_parse (layout, NULL); structures; ) {
	  structure = structures->data;
	  layout_etk_simple_add_header (layout,structure);
	  structures = structures->next;
  }

  /*Initialise the list view*/
  local = entropy_plugin_gui_get_by_name_toolkit(ENTROPY_TOOLKIT_ETK, "listviewer");
  if (local) {
	  local_plugin_init =
	      dlsym (local->dl_ref, "entropy_plugin_gui_instance_new");   
	  gui->list_viewer = (*local_plugin_init)(core, layout,NULL);
	  gui->list_viewer->plugin = local;
	  
	  if (entropy_config_misc_is_set("general.listviewer")) {
		  gui->list_viewer->active=1;
		  local_viewer_selected = 1;
		  etk_widget_show(gui->list_viewer->gui_object);
		  etk_box_append(ETK_BOX(gui->localshell), gui->list_viewer->gui_object, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
	  } else {
		   gui->list_viewer->active=0;
		   etk_widget_show(gui->list_viewer->gui_object);
	  }
   }

   /*Initialise the icon viewer*/
  /*Initialise the list view*/
  local = entropy_plugin_gui_get_by_name_toolkit(ENTROPY_TOOLKIT_ETK, "iconviewer");
  if (local) {
	  local_plugin_init =
	      dlsym (local->dl_ref, "entropy_plugin_gui_instance_new");   
	  gui->iconbox_viewer = (*local_plugin_init)(core, layout,NULL);
	  gui->iconbox_viewer->plugin = local;

	  if (entropy_config_misc_is_set("general.iconviewer")) {
		  gui->iconbox_viewer->active=1;
		  local_viewer_selected = 1;
		  etk_widget_show(gui->iconbox_viewer->gui_object);
		  etk_box_append(ETK_BOX(gui->localshell), gui->iconbox_viewer->gui_object, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
	  } else {
	  	gui->iconbox_viewer->active=0;
		etk_widget_show(gui->iconbox_viewer->gui_object);
	  }
   }

  /*Initialise the metadata plugin*/
  meta = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT, ENTROPY_PLUGIN_GUI_COMPONENT_INFO_PROVIDER);
  if (meta) {
	  local_plugin_init = 
	  dlsym(meta->dl_ref, "entropy_plugin_gui_instance_new");
	  meta_instance = (*local_plugin_init)(core,layout,NULL);
	  meta_instance->plugin = meta;
  }

  /*Initialise the hover viewer*/
  hover = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT, ENTROPY_PLUGIN_GUI_COMPONENT_HOVER_PROVIDER);
  if (hover) {
	  local_plugin_init = 
	  dlsym(hover->dl_ref, "entropy_plugin_gui_instance_new");
	  hover_instance = (*local_plugin_init)(core,layout,NULL);
	  hover_instance->plugin = hover;
  }


  /*Initialise the trackback*/
  trackback = entropy_plugin_gui_get_by_name_toolkit(ENTROPY_TOOLKIT_ETK, "trackback");
  if (trackback) {
	  local_plugin_init =
	      dlsym (trackback->dl_ref, "entropy_plugin_gui_instance_new");   
	  gui->trackback = (*local_plugin_init)(core, layout,NULL);
	  gui->trackback->plugin = trackback;
	  gui->trackback->active=1;

	  if (entropy_config_misc_is_set("general.trackback")) {
		  etk_box_append(ETK_BOX(gui->trackback_shell), gui->trackback->gui_object, ETK_BOX_START, ETK_BOX_NONE, 0);
	  }
	  entropy_config_misc_callback_register("general.trackback", _entropy_layout_etk_simple_config_cb, gui);
  }



  /*Menu setup*/
  menubar = etk_menu_bar_new();

  /*File menu*/
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("File"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL);
  menu = etk_menu_new();
  etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu));
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Exit"), ETK_STOCK_SYSTEM_SHUTDOWN, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_layout_simple_exit_cb), layout);
  
  /*Edit menu*/
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Edit"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL);
  menu = etk_menu_new();
  etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu));
  
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Cut"), ETK_STOCK_EDIT_CUT, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_layout_etk_cut_cb), layout);
  
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Copy"), ETK_STOCK_EDIT_COPY, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_layout_etk_copy_cb), layout);
  
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Paste"), ETK_STOCK_EDIT_PASTE, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_layout_etk_paste_cb), layout);
  
  
  /*Tools menu*/
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Tools"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL);
  menu = etk_menu_new();
  etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu));
  
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Add Location"), ETK_STOCK_ADDRESS_BOOK_NEW, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_location_add_cb), layout);
 
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("eFolder Wizard.."), ETK_STOCK_ADDRESS_BOOK_NEW, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(_entropy_etk_efolder_dialog_show_cb), layout);
  
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Program Associations.."), 
		  ETK_STOCK_EMBLEM_SYMBOLIC_LINK, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_mime_dialog_cb), layout);

  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Options.."), 
		  ETK_STOCK_EMBLEM_SYMBOLIC_LINK, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(entropy_etk_options_dialog_cb), layout);
  
  /*View menu*/
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("View"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL);
  menu = etk_menu_new();
  etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu));
  
  gui->tree_view_menu = _entropy_etk_menu_check_item_new(_("Tree View"), ETK_MENU_SHELL(menu));
  if (entropy_config_misc_is_set("general.treeviewer")) {
	etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(gui->tree_view_menu),ETK_TRUE );
  }
  etk_signal_connect("activated", ETK_OBJECT(gui->tree_view_menu), ETK_CALLBACK(entropy_etk_layout_tree_cb), layout);

  menu_item = _entropy_etk_menu_check_item_new(_("Trackback view"), ETK_MENU_SHELL(menu));
  if (entropy_config_misc_is_set("general.trackback")) {
	etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(menu_item), ETK_TRUE);
  }
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(entropy_etk_layout_trackback_cb), layout);


  _entropy_etk_menu_item_new(ETK_MENU_ITEM_SEPARATOR, NULL, 
		  ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menu), NULL);

  menu_item = _entropy_etk_radio_item_new(_("List View (Alt-l)"), NULL, ETK_MENU_SHELL(menu));
  etk_object_data_set(ETK_OBJECT(menu_item), "VISUAL", gui->list_viewer);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_local_viewer_cb), layout);
  if (entropy_config_misc_is_set("general.listviewer")) {
	  etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(menu_item), ETK_TRUE);
  }

  
  menu_item = _entropy_etk_radio_item_new(_("Icon View (Alt-i)"), ETK_MENU_ITEM_RADIO(menu_item), ETK_MENU_SHELL(menu));
  etk_object_data_set(ETK_OBJECT(menu_item), "VISUAL", gui->iconbox_viewer);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_local_viewer_cb), layout);
  if (entropy_config_misc_is_set("general.iconviewer")) {
	  etk_menu_item_check_active_set(ETK_MENU_ITEM_CHECK(menu_item), ETK_TRUE);
  }


  /*Debug menu*/
  /*menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Debug"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL); 
  menu = etk_menu_new();
  etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu));
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("File Cache"), ETK_STOCK_PLACES_FOLDER_SAVED_SEARCH, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(etk_file_cache_dialog_cb), layout);*/
  
  /*Help menu*/
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("Help"), ETK_STOCK_NO_STOCK, ETK_MENU_SHELL(menubar), NULL);
  menu = etk_menu_new();
  etk_menu_item_submenu_set(ETK_MENU_ITEM(menu_item), ETK_MENU(menu));
  menu_item = _entropy_etk_menu_item_new(ETK_MENU_ITEM_NORMAL, _("About.."), ETK_STOCK_HELP_BROWSER, ETK_MENU_SHELL(menu), NULL);
  etk_signal_connect("activated", ETK_OBJECT(menu_item), ETK_CALLBACK(entropy_etk_about_dialog_cb), layout);

  etk_box_append(ETK_BOX(vbox), menubar, ETK_BOX_START, ETK_BOX_NONE, 0);
  etk_box_append(ETK_BOX(vbox), gui->trackback_shell, ETK_BOX_START, ETK_BOX_NONE, 0);
  etk_box_append(ETK_BOX(vbox), gui->paned, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
  /*---------------------------*/

  gui->statusbar_box = etk_hbox_new(ETK_TRUE, 0);
  etk_box_append(ETK_BOX(vbox), gui->statusbar_box, ETK_BOX_START, ETK_BOX_NONE, 0);
  
  gui->statusbars[0] = etk_statusbar_new();
  etk_statusbar_has_resize_grip_set(ETK_STATUSBAR(gui->statusbars[0]), ETK_FALSE);
  etk_box_append(ETK_BOX(gui->statusbar_box), gui->statusbars[0], ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
   
  gui->statusbars[1] = etk_statusbar_new();
  etk_statusbar_has_resize_grip_set(ETK_STATUSBAR(gui->statusbars[1]), ETK_FALSE);
  etk_box_append(ETK_BOX(gui->statusbar_box), gui->statusbars[1], ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
   
  gui->statusbars[2] = etk_statusbar_new();
  etk_statusbar_has_resize_grip_set(ETK_STATUSBAR(gui->statusbars[2]), ETK_TRUE);
  etk_box_append(ETK_BOX(gui->statusbar_box), gui->statusbars[2], ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
     
  etk_widget_show_all (window);

  /*Increment the window counter*/
  _etk_layout_window_count++;

  etk_window_resize(ETK_WINDOW(window), ENTROPY_ETK_WINDOW_WIDTH, ENTROPY_ETK_WINDOW_HEIGHT);

  return layout;
}
Esempio n. 19
0
evfs_connection *
evfs_connect(void (*callback_func) (EvfsEvent *, void *), void *obj)
{
   ecore_init();
   ecore_ipc_init();
   int connect_attempts = 0;

   evfs_connection *connection = NEW(evfs_connection);

   connection->id = MAX_CLIENT;
   connection->prog_event = NULL;
   connection->callback_func = callback_func;
   connection->obj = obj;

   evfs_io_initialise();
   evfs_vfolder_initialise();

   if (!_libevfs_init)
     {
        _libevfs_init = 1;
	_libevfs_next_command_id = 1;
	evfs_session_servers = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);

	/*Register the callback*/
        ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, evfs_server_data,
                                NULL);
        client_list = ecore_list_new();

        ecore_list_append(client_list, connection);
     }
   else
     {
        ecore_list_prepend(client_list, connection);
     }

 retry:

   if (connect_attempts > MAX_ATTEMPTS)
     {
        fprintf(stderr, "Could not start server after max attempts\n");
        exit(1);                /*We shouldn't really kill the libraries parent! */
        return NULL;
     }

   if (!
       (connection->server =
        ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, EVFS_IPC_TITLE,0,
                                 connection)))	   
     {	     
        fprintf(stderr,
                "Cannot connect to evfs server with '%s', making new server and trying again..\n",
                EVFS_IPC_TITLE);

        if (!connect_attempts)
          {
             if (evfs_server_spawn())
               {
                  printf("Failure to start evfs server!\n");
               }
          }

        connect_attempts++;
        usleep(100000 * connect_attempts);
        goto retry;

     } else {
	     ecore_hash_set(evfs_session_servers, connection->server, (int*)1);

	     while (connection->id == MAX_CLIENT) {
		        /*printf("Waiting for connection id..\n");*/
			ecore_main_loop_iterate();
	     }
	     /*printf("Got connection ID: %d\n", connection->id);*/
	     
     }

   return connection;
}
Esempio n. 20
0
entropy_gui_component_instance *
entropy_plugin_gui_instance_new (entropy_core * core,
		     entropy_gui_component_instance * layout)
{
  Ewl_Widget *context;

  entropy_gui_component_instance *instance =
    entropy_gui_component_instance_new ();
  entropy_icon_viewer *viewer = entropy_malloc (sizeof (entropy_icon_viewer));

  /*Save a reference to our local data */
  instance->data = viewer;
  instance->layout_parent = layout;

  viewer->iconbox = ewl_iconbox_new ();
  viewer->default_bg = 0;
  instance->gui_object = viewer->iconbox;
  ewl_widget_show (EWL_WIDGET (viewer->iconbox));


  /*Initialise the progress window */
  viewer->progress = entropy_malloc (sizeof (entropy_file_progress_window));

  /*Init the file wait list */
  viewer->file_wait_list =
    ecore_hash_new (ecore_direct_hash, ecore_direct_compare);


  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "New Directory");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_new_dir.png",
			   NULL);
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  /*ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_copy_cb, instance);*/
  ewl_widget_show (context);


  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Copy selection");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_copy.png",
			   NULL);
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_copy_cb, instance);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Paste");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_paste.png", 
			   NULL);
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_paste_cb, instance);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_separator_new ();
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context),
			  "Set custom folder background...");
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_background_set_cb, instance);
  ewl_widget_show (context);

  /*Add some context menu items */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context),
			  "Remove current custom background");
  ewl_iconbox_context_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_background_remove_cb, instance);
  ewl_widget_show (context);

	/*---------------Icon Menu---------------*/

  /*Copy */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Copy");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_copy.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_iconbox_file_copy_cb, instance);
  //

  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Cut");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_cut.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  //ewl_callback_append(context, EWL_CALLBACK_MOUSE_DOWN, icon_properties_cb, instance);


  /*Icon menu */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Rename");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_rename.png",
			   NULL);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_menu_rename_cb, instance);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);

  /*Icon menu */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Delete");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_delete.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_menu_delete_cb, instance);

  /*Icon menu */
  context = ewl_menu_item_new ();
  ewl_button_label_set (EWL_BUTTON (context), "Properties");
  ewl_button_image_set (EWL_BUTTON (context),
			   PACKAGE_DATA_DIR
			   "/icons/e17_button_detail_properties.png",
			   NULL);
  ewl_widget_show (context);
  ewl_iconbox_icon_menu_item_add (EWL_ICONBOX (viewer->iconbox), context);
  ewl_callback_append (context, EWL_CALLBACK_CLICKED, icon_properties_cb,
		       instance);

  /*Properties hover */
  viewer->hover_properties = ewl_text_new ();
  ewl_callback_append (viewer->hover_properties, EWL_CALLBACK_SHOW,
		       icon_hover_properties_show_cb, instance);
  ewl_text_text_set (EWL_TEXT (viewer->hover_properties),
		     "Filename: ewl_text.c\nSize: 50kb\nType: text/c-src");
	/*------------------------*/

  /*FIXME remove the hardocded var */
  ewl_iconbox_icon_size_custom_set (EWL_ICONBOX (viewer->iconbox), 60, 60);


  /*Init the hash */
  viewer->gui_hash = ecore_hash_new (ecore_direct_hash, ecore_direct_compare);
  viewer->icon_hash =
    ecore_hash_new (ecore_direct_hash, ecore_direct_compare);

  /*Set the core back reference */
  instance->core = core;

  /*Register out interest in receiving folder notifications */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FOLDER_CHANGE_CONTENTS_EXTERNAL));

  /*Register our interest in receiving file mod/create/delete notifications */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_CHANGE));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_CREATE));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_REMOVE));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_REMOVE_DIRECTORY));

  /*Register interest in getting stat events */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT));
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT_AVAILABLE));

  /*We want to know about file transfer progress events */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_PROGRESS));

  /*We want to know if the backend needs feedback */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_USER_INTERACTION_YES_NO_ABORT));

  /*We want to know about thumbnail available events */
  entropy_core_component_event_register (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_THUMBNAIL_AVAILABLE));

  ewl_iconbox_controlled_key_callback_register (viewer->iconbox,
						ewl_icon_local_viewer_key_event_cb,
						instance);
  return instance;
}
Esempio n. 21
0
void
gui_event_callback (entropy_notify_event * eevent, void *requestor, void *ret,
		    void *user_data)
{
  entropy_gui_component_instance *comp =
    (entropy_gui_component_instance *) user_data;

  switch (eevent->event_type) {
  case ENTROPY_NOTIFY_FILELIST_REQUEST_EXTERNAL:
  case ENTROPY_NOTIFY_FILELIST_REQUEST:{
      event_idle_processor *proc =
	entropy_malloc (sizeof (event_idle_processor));
      entropy_generic_file *event_file;
      entropy_file_request *request = eevent->data;	/*A file request's data is the dest dir */
      entropy_icon_viewer *view = comp->data;
      Ecore_Hash *tmp_gui_hash;
      Ecore_Hash *tmp_icon_hash;

      printf ("Icon viewer got a directory change order!\n");

      /*Keep a reference to our existing hash */
      tmp_gui_hash = view->gui_hash;
      tmp_icon_hash = view->icon_hash;
      view->gui_hash =
	ecore_hash_new (ecore_direct_hash, ecore_direct_compare);
      view->icon_hash =
	ecore_hash_new (ecore_direct_hash, ecore_direct_compare);

      /*Terminate our last load if we are still going...Not the most elegant solution, but there can only be 1 at once */
      if (view->last_processor)
	view->last_processor->terminate = 1;


      /*Setup the background processor object */
      //proc->eevent = eevent;
      proc->requestor = comp;
      proc->count = 0;
      proc->terminate = 0;
      proc->user_data = ecore_list_new ();
      view->last_processor = proc;

      ecore_list_first_goto (ret);
      while ((event_file = ecore_list_next (ret))) {
	//printf("Populating with '%s'\n", event_file->filename);
	entropy_core_file_cache_add_reference (event_file->md5);
	ecore_list_append (proc->user_data, event_file);
      }

      ecore_idle_enterer_add (idle_add_icons, proc);

      /*Set the current path from the event source... */
      snprintf (view->current_dir, 1024, "%s://%s/%s",
		request->file->uri_base, request->file->path,
		request->file->filename);


      /*Before we begin, see if our file hash is initialized, if so - we must destroy it first */
       /*TODO*/ gui_object_destroy_and_free (comp, tmp_gui_hash);
      ecore_hash_destroy (tmp_icon_hash);

      /*Clear the view, if there's anything to nuke */
      ewl_iconbox_clear (EWL_ICONBOX (view->iconbox));


      /*See if there is a custom BG image for this folder */
      if (entropy_config_str_get ("iconbox_viewer", view->current_dir)) {
	ewl_iconbox_background_set (EWL_ICONBOX (view->iconbox),
				    entropy_config_str_get ("iconbox_viewer",
							    view->
							    current_dir));
	view->default_bg = 0;
      }
      else {			/*if (!view->default_bg) { */
	ewl_iconbox_background_set (EWL_ICONBOX (view->iconbox), NULL);
	view->default_bg = 1;
      }

      /*Goto the root of the iconbox */
      ewl_iconbox_scrollpane_recalculate (EWL_ICONBOX (view->iconbox));
      ewl_iconbox_scrollpane_goto_root (EWL_ICONBOX (view->iconbox));

    }
    break;


  case ENTROPY_NOTIFY_THUMBNAIL_REQUEST:{
      /*Only bother if we have a thumbnail, and a component */
      if (ret && user_data) {
	gui_file *obj;
	entropy_thumbnail *thumb = (entropy_thumbnail *) ret;
	entropy_icon_viewer *view = comp->data;

	obj = ecore_hash_get (view->gui_hash, thumb->parent);

	if (obj) {
	  obj->thumbnail = thumb;

	  /*printf("Received callback notify from notify event..\n"); */
	  /*Make sure the icon still exists */
	  /*if (obj->icon) { */
	  ewl_iconbox_icon_image_set (EWL_ICONBOX_ICON (obj->icon),
				      obj->thumbnail->thumbnail_filename);

	  /*FIXME This is inefficient as all hell - find a better way to do this */
	  //ewl_iconbox_icon_arrange(EWL_ICONBOX(view->iconbox)); 
	}
	else {
	  //printf("ERR: Couldn't find a hash reference for this file!\n");
	}
      }
    }				//End case
    break;


  case ENTROPY_NOTIFY_FILE_CHANGE:{
      //printf ("Received file change event at icon viewer for file %s \n", ((entropy_generic_file*)ret)->filename);

    }
    break;

  case ENTROPY_NOTIFY_FILE_CREATE:{
      //printf ("Received file create event at icon viewer for file %s \n", ((entropy_generic_file*)ret)->filename);
      ewl_icon_local_viewer_add_icon (comp, (entropy_generic_file *) ret,
				      DO_MIME);
    }
    break;

  case ENTROPY_NOTIFY_FILE_REMOVE_DIRECTORY:
  case ENTROPY_NOTIFY_FILE_REMOVE:{
      printf ("Received a remove file notify\n");
      ewl_icon_local_viewer_remove_icon (comp, (entropy_generic_file *) ret);
    }
    break;

  case ENTROPY_NOTIFY_FILE_STAT_EXECUTED:{
      //printf("STAT EXECUTED Response back at ewl_icon_local_viewer\n");
    }
    break;

  case ENTROPY_NOTIFY_USER_INTERACTION_YES_NO_ABORT: {
	printf("Yes/No/Abort to file copy?\n");
	entropy_ewl_user_interaction_dialog_new((entropy_file_operation*)ret);
  }
  break;

  case ENTROPY_NOTIFY_FILE_STAT_AVAILABLE:{

      entropy_file_stat *file_stat = (entropy_file_stat *) eevent->return_struct;
      if (file_stat->file == NULL) {
	printf ("***** File stat file is null\n");
      }
      ewl_icon_local_viewer_show_stat (file_stat);


    }
    break;

  case ENTROPY_NOTIFY_FILE_PROGRESS:{
      entropy_icon_viewer *view = comp->data;
      entropy_file_progress *progress = ret;


      if (!view->progress->progress_window) {
	printf ("Showing progressbar dialog..\n");

	ewl_progress_window_create (view->progress);
	ewl_widget_show (view->progress->progress_window);
      }

      if (view->progress->progress_window) {
	ewl_text_text_set (EWL_TEXT (view->progress->file_from),
			   progress->file_from->filename);
	ewl_text_text_set (EWL_TEXT (view->progress->file_to),
			   progress->file_to->filename);
	ewl_progressbar_value_set (EWL_PROGRESSBAR
				   (view->progress->progressbar),
				   progress->progress);
      }

      /*Is it time to hide (i.e. end) */
      if (progress->type == TYPE_END) {
	printf ("Hiding progressbar dialog..\n");
	ewl_widget_destroy (view->progress->progress_window);
	view->progress->progress_window = NULL;
      }

    }
    break;

  }				//End switch

}
Esempio n. 22
0
int
evfs_io_initialise()
{
   if (io_init)
      return 1;

   io_init = 1;
   
   evfs_io_edd_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);

   /*Stat*/
   _EvfsStat_edd = _NEW_EDD(EvfsStat);
   //EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_dev", st_dev, EET_T_INT);
   //EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_ino", st_ino, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_mode", st_mode, EET_T_INT);
   //EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_nlink", st_nlink, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_uid", st_uid, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_gid", st_gid, EET_T_INT);
   //EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_rdev", st_rdev, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_size", st_size, EET_T_LONG_LONG);
   //EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_blksize", st_blksize, EET_T_INT);
   //EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_blocks", st_blocks, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_atime", ist_atime, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_mtime", ist_mtime, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsStat_edd, EvfsStat, "stat_st_ctime", ist_ctime, EET_T_INT);
   

   /*File_reference eet */
   _EvfsFilereference_edd = _NEW_EDD(EvfsFilereference);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsFilereference_edd, EvfsFilereference,
                                 "file_type", file_type, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsFilereference_edd, EvfsFilereference,
                                 "path", path, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsFilereference_edd, EvfsFilereference,
                                 "plugin_uri", plugin_uri, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsFilereference_edd, EvfsFilereference,
                                 "username", username, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsFilereference_edd, EvfsFilereference,
                                 "password", password, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsFilereference_edd, EvfsFilereference,
                                 "attach", attach, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsFilereference_edd, EvfsFilereference,
                                 "fd", fd, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsFilereference_edd, EvfsFilereference, "parent", parent, 		   
		   _EvfsFilereference_edd);
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsFilereference_edd, EvfsFilereference, "stat", stat, 
		   _EvfsStat_edd);

   /*Evfs_operation eet */
   _EvfsOperation_edd = _NEW_EDD(EvfsOperation);

   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsOperation_edd, evfs_operation, "id", id,
                                 EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsOperation_edd, evfs_operation,
		                                       "misc_str", misc_str, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsOperation_edd, evfs_operation,
		                                       "ret_str_1", misc_str, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsOperation_edd, evfs_operation,
		                                       "ret_str_2", misc_str, EET_T_STRING);
   
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsOperation_edd, evfs_operation, "status",
                                 status, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsOperation_edd, evfs_operation,
                                 "substatus", substatus, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsOperation_edd, evfs_operation,
                                 "response", response, EET_T_INT);

    /*EvfsVfolderEntry_edd*/
    _EvfsVfolderEntry_edd = _NEW_EDD(EvfsVfolderEntry);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsVfolderEntry_edd, EvfsVfolderEntry, "type", type,
                               EET_T_CHAR);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsVfolderEntry_edd, EvfsVfolderEntry, "name", name,
                                   EET_T_STRING);
    EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsVfolderEntry_edd, EvfsVfolderEntry, "value", value,
                                   EET_T_STRING);

				   


   /*Command edd*/
   _EvfsCommandFile_edd = _NEW_EDD(evfs_command_file);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsCommandFile_edd, evfs_command_file,
                   "type", type, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsCommandFile_edd, evfs_command_file,
                   "extra", extra, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsCommandFile_edd, evfs_command_file,
                   "ref", ref, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsCommandFile_edd, evfs_command_file,
                   "ref2", ref2, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_LIST(_EvfsCommandFile_edd, evfs_command_file,
                   "files", files, _EvfsFilereference_edd);
   
   _EvfsCommand_edd = _NEW_EDD(evfs_command);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsCommand_edd, evfs_command,
                                 "EvfsCommand_type", type, EET_T_INT);   
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsCommand_edd, evfs_command,
                                 "EvfsCommand_filecommand", file_command, _EvfsCommandFile_edd);  
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsCommand_edd, evfs_command,
                                 "EvfsCommand_operation", op, _EvfsOperation_edd);   
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsCommand_edd, evfs_command,
                                 "EvfsCommand_id", client_identifier, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsCommand_edd, evfs_command,
                                 "EvfsCommand_options", options, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_LIST(_EvfsCommand_edd, evfs_command,
		   		 "EvfsCommand_entries", entries, _EvfsVfolderEntry_edd);

   /*Base event EDD*/
   _EvfsEvent_edd = _NEW_EDD(EvfsEvent);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsEvent_edd, EvfsEvent,
                                 "EvfsEvent_type", type, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsEvent_edd, EvfsEvent,
                                 "EvfsEvent_retCode", retCode, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsEvent_edd, EvfsEvent,
                                 "EvfsEvent_suffix", suffix, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsEvent_edd, EvfsEvent,
		   		 "EvfsEvent_command", command, _EvfsCommand_edd);

   /*ProgressEventEdd*/
   _EvfsEventProgress_edd = _NEW_EDD(EvfsEventProgress);
   _EVFS_EVENT_BASE_ADD(EvfsEventProgress);
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsEventProgress_edd, EvfsEventProgress, "EvfsEventProgress_from", from, _EvfsFilereference_edd);
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsEventProgress_edd, EvfsEventProgress, "EvfsEventProgress_to", to, _EvfsFilereference_edd);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsEventProgress_edd, EvfsEventProgress, "EvfsEventProgress_progressAmt", progressAmt, EET_T_DOUBLE);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsEventProgress_edd, EvfsEventProgress, "EvfsEventProgress_type", type, EET_T_INT);
   evfs_io_event_edd_set(EVFS_EV_FILE_PROGRESS, _EvfsEventProgress_edd);

   /*DirListEdd*/
   _EvfsEventDirList_edd = _NEW_EDD(EvfsEventDirList);
   _EVFS_EVENT_BASE_ADD(EvfsEventDirList);
   EET_DATA_DESCRIPTOR_ADD_LIST(_EvfsEventDirList_edd, EvfsEventDirList, "EvfsEventDirList_files", files, _EvfsFilereference_edd);
   evfs_io_event_edd_set(EVFS_EV_DIR_LIST, _EvfsEventDirList_edd);

   /*IdNotifyEvent*/
   _EvfsEventIdNotify_edd = _NEW_EDD(EvfsEventIdNotify);
   _EVFS_EVENT_BASE_ADD(EvfsEventIdNotify);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsEventIdNotify_edd, EvfsEventIdNotify, "EvfsEventIdNotify_id", id, EET_T_INT);
   evfs_io_event_edd_set(EVFS_EV_NOTIFY_ID, _EvfsEventIdNotify_edd);
  
   /*DataEvent*/
   /*The actual data is encoded in the suffix*/
   _EvfsEventData_edd = _NEW_EDD(EvfsEventData);
   _EVFS_EVENT_BASE_ADD(EvfsEventData);
   evfs_io_event_edd_set(EVFS_EV_FILE_READ, _EvfsEventData_edd);

   /*EvfsMetaDataEvent*/
   _EvfsMetaObject_edd = _NEW_EDD(EvfsMetaObject);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsMetaObject_edd, EvfsMetaObject, "EvfsMetaObject_key", key, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsMetaObject_edd, EvfsMetaObject, "EvfsMetaObject_value", value, EET_T_STRING);
   _EvfsEventMetadata_edd = _NEW_EDD(EvfsEventMetadata);
   _EVFS_EVENT_BASE_ADD(EvfsEventMetadata);
   EET_DATA_DESCRIPTOR_ADD_LIST(_EvfsEventMetadata_edd, EvfsEventMetadata, "EvfsEventMetadata_list", meta_list,
		   _EvfsMetaObject_edd	);
   evfs_io_event_edd_set(EVFS_EV_METADATA, _EvfsEventMetadata_edd);

   /*EvfsEventStat*/
   _EvfsEventStat_edd = _NEW_EDD(EvfsEventStat);
   _EVFS_EVENT_BASE_ADD(EvfsEventStat);
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsEventStat_edd, EvfsEventStat, "EvfsEventStat_file", file, _EvfsFilereference_edd);
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsEventStat_edd, EvfsEventStat, "EvfsEventStat_stat", stat, _EvfsStat_edd);
   evfs_io_event_edd_set(EVFS_EV_STAT, _EvfsEventStat_edd); 

   /*EvfsMetadataGroup*/
   _EvfsMetadataGroup_edd = _NEW_EDD(EvfsMetadataGroup);   
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsMetadataGroup_edd, EvfsMetadataGroup, "EvfsMetadataGroup_name", name, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsMetadataGroup_edd, EvfsMetadataGroup, "EvfsMetadataGroup_desc", description, EET_T_STRING);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsMetadataGroup_edd, EvfsMetadataGroup, "EvfsMetadataGroup_visualhint", visualhint, EET_T_STRING);
   
   /*EvfsEventMetadataGroups*/
   _EvfsEventMetadataGroups_edd = _NEW_EDD(EvfsEventMetadataGroups); 
   _EVFS_EVENT_BASE_ADD(EvfsEventMetadataGroups);
   EET_DATA_DESCRIPTOR_ADD_LIST(_EvfsEventMetadataGroups_edd, EvfsEventMetadataGroups, "EvfsEventMetadataGroups_list", string_list,
		   _EvfsMetadataGroup_edd	);
   evfs_io_event_edd_set(EVFS_EV_METADATA_GROUPS, _EvfsEventMetadataGroups_edd);

   /*EvfsEventFileMonitor*/
   _EvfsEventFileMonitor_edd = _NEW_EDD(EvfsEventFileMonitor);
   _EVFS_EVENT_BASE_ADD(EvfsEventFileMonitor);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsEventFileMonitor_edd, EvfsEventFileMonitor, "EvfsEventFileMonitor_type", type, EET_T_INT);
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsEventFileMonitor_edd, EvfsEventFileMonitor, "EvfsEventFileMonitor_file", file, _EvfsFilereference_edd);
   evfs_io_event_edd_set(EVFS_EV_FILE_MONITOR, _EvfsEventFileMonitor_edd);
   
   /*EvfsEventAuthFailure*/
   _EvfsEventAuthRequired_edd = _NEW_EDD(EvfsEventAuthRequired);
   _EVFS_EVENT_BASE_ADD(EvfsEventAuthRequired);
   evfs_io_event_edd_set(EVFS_EV_AUTH_REQUIRED, _EvfsEventAuthRequired_edd);

   /*EvfsEventOpen*/
   _EvfsEventOpen_edd = _NEW_EDD(EvfsEventOpen);
   _EVFS_EVENT_BASE_ADD(EvfsEventOpen);
   evfs_io_event_edd_set(EVFS_EV_FILE_OPEN, _EvfsEventOpen_edd);

   /*EvfsEventOperation*/
   _EvfsEventOperation_edd = _NEW_EDD(EvfsEventOperation);
   _EVFS_EVENT_BASE_ADD(EvfsEventOperation);
   EET_DATA_DESCRIPTOR_ADD_SUB(_EvfsEventOperation_edd, EvfsEventOperation, "EvfsEventOperation_operation", operation, _EvfsOperation_edd);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsEventOperation_edd, EvfsEventOperation, "EvfsEventOperation_misc", misc, EET_T_STRING);
   evfs_io_event_edd_set(EVFS_EV_OPERATION, _EvfsEventOperation_edd);

   _EvfsEventMime_edd = _NEW_EDD(EvfsEventMime);
   _EVFS_EVENT_BASE_ADD(EvfsEventMime);
   EET_DATA_DESCRIPTOR_ADD_BASIC(_EvfsEventMime_edd, EvfsEventMime, "EvfsEventMime_mime", mime, EET_T_STRING);
   evfs_io_event_edd_set(EVFS_EV_MIME, _EvfsEventMime_edd);

   /*EvfsEventMetaAll*/
   _EvfsEventMetaAll_edd = _NEW_EDD(EvfsEventMetaAll);
   _EVFS_EVENT_BASE_ADD(EvfsEventMetaAll);
   EET_DATA_DESCRIPTOR_ADD_LIST(_EvfsEventMetaAll_edd, EvfsEventMetaAll, "EvfsEventMetaAll_meta", meta, _EvfsMetaObject_edd);
   evfs_io_event_edd_set(EVFS_EV_METAALL, _EvfsEventMetaAll_edd);

   return 0;

}
Esempio n. 23
0
/**
 * initialize this project manager.  called from main
 */
int
projects_init( char *filename )
{
	Ewl_Widget *vbox, *menu, *project_menu, *settings_menu, *windows_menu, *item;

	/* ui phase... kick on some phat window action */
	project_win = ewl_window_new();
	ewl_window_title_set(EWL_WINDOW(project_win), "Ewler");
	ewl_object_size_request(EWL_OBJECT(project_win), 200, 320);
	ewl_callback_append(project_win, EWL_CALLBACK_DELETE_WINDOW,
											project_exit, NULL);
	ewl_callback_append(project_win, EWL_CALLBACK_KEY_DOWN,
											project_key_down, NULL);

	vbox = ewl_vbox_new();
	ewl_container_child_append(EWL_CONTAINER(project_win), vbox);

	menu = ewl_hmenubar_new();
	ewl_container_child_append(EWL_CONTAINER(vbox), menu);

	project_menu = ewl_menubar_menu_add(EWL_MENUBAR(menu), NULL, "Project");

	item = ewl_menu_item_new(NULL, "New");
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "New Form");
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, form_new, NULL);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Open...");
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, open, NULL);
	ewl_widget_show(item);

	item = ewl_menu_separator_new();
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Save");
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, save, NULL);
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	item = ewl_menu_separator_new();
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Exit");
	ewl_callback_append(item, EWL_CALLBACK_CLICKED,
											project_exit, NULL);
	ewl_container_child_append(EWL_CONTAINER(project_menu), item);
	ewl_widget_show(item);

	ewl_widget_show(project_menu);

	settings_menu = ewl_menubar_menu_add(EWL_MENUBAR(menu), NULL, "Settings");

	item = ewl_menu_item_new(NULL, "Options...");
	ewl_container_child_append(EWL_CONTAINER(settings_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED,
											options, NULL);
	ewl_widget_show(item);

	ewl_widget_show(settings_menu);

	windows_menu = ewl_menubar_menu_add(EWL_MENUBAR(menu), NULL, "Windows");

	item = ewl_menu_item_new(NULL, "Toolbar");
	ewl_container_child_append(EWL_CONTAINER(windows_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, tools_toggle, NULL);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Inspector");
	ewl_container_child_append(EWL_CONTAINER(windows_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, inspector_toggle, NULL);
	ewl_widget_show(item);

	item = ewl_menu_item_new(NULL, "Callbacks");
	ewl_container_child_append(EWL_CONTAINER(windows_menu), item);
	ewl_callback_append(item, EWL_CALLBACK_CLICKED, callbacks_toggle, NULL);
	ewl_widget_show(item);

	ewl_widget_show(windows_menu);

	ewl_widget_show(menu);

	file_tree = ewl_tree_new(1);
	ewl_tree_mode_set(EWL_TREE(file_tree), EWL_TREE_MODE_SINGLE);
	ewl_container_child_append(EWL_CONTAINER(vbox), file_tree);
	ewl_widget_show(file_tree);

	ewl_widget_show(vbox);
	ewl_widget_show(project_win);
	/* end ui phase */

	/* project phase */
	active_project = NEW(Ewler_Project);
	if( !active_project ) {
		ewler_error("projects_init: out of memory!");
		return -1;
	}
	active_project->files = ecore_hash_new(ecore_str_hash, ecore_str_compare);
	ecore_hash_free_key_cb_set(active_project->files, free);
	ecore_hash_free_value_cb_set(active_project->files, free);

	if( !filename || project_open(filename) < 0 ) {
		project_new();
	}
	/* end project phase */

	return 0;
}
Esempio n. 24
0
void
inspector_update( Ecore_List *selected )
{
	Ewl_Widget *prow;
	Ecore_Sheap *slist, *sheap;
	Ecore_Hash *elems;
	Ecore_List *keys;
	Ecore_List *prow_stack, *sheap_stack, *elems_stack;
	Ewler_Widget *w;
	char *key;

	ewl_container_reset(EWL_CONTAINER(tree));

	if( !selected )
		return;
	/* add support for multiple selections later */
	w = ecore_list_first_goto(selected);

	if( !w )
		return;
	
	keys = ecore_hash_keys(w->elems);
	slist = ecore_sheap_new(ecore_str_compare, ecore_list_count(keys));

	while( (key = ecore_list_next(keys)) )
		ecore_sheap_insert(slist, key);

	ecore_list_destroy(keys);
	ecore_sheap_sort(slist);

	sheap = slist;
	elems = w->elems;

	sheap_stack = ecore_list_new();
	elems_stack = ecore_list_new();
	prow_stack = ecore_list_new();
	prow = NULL;

	while( (key = ecore_sheap_extract(sheap)) ) {
		Ewler_Widget_Elem *elem;
		Ewl_Widget *row_items[2], *row;
		Ewl_Widget *text, *entry;
		int len;

		elem = ecore_hash_get(elems, key);
		text = ewl_text_new(key);
		len = ewl_text_length_get(EWL_TEXT(text));
		ewl_text_cursor_position_set(EWL_TEXT(text), 0);
		if( elem->changed )
			ewl_text_color_apply(EWL_TEXT(text), 255, 0, 0, 255, len);

		switch( elem->spec->type ) {
			case EWLER_SPEC_ELEM_STRUCT: entry = NULL; break;
			case EWLER_SPEC_ELEM_ENUM:
				entry = ewl_combo_new(elem_to_s(elem));

				if( elem->items )
					ecore_hash_destroy(elem->items);

				elem->items = ecore_hash_new(ecore_direct_hash, ecore_direct_compare);
				
				keys = ecore_hash_keys(elem->spec->info.edata.map_rev);
				while( (key = ecore_list_next(keys)) ) {
					Ewl_Widget *combo_item;
					int value;

					value = (int) ecore_hash_get(elem->spec->info.edata.map_rev, key);

					combo_item = ewl_menu_item_new(NULL, key);
					ecore_hash_set(elem->items, (void *) value, combo_item);
					ewl_container_child_append(EWL_CONTAINER(entry), combo_item);
					ewl_widget_show(combo_item);
				}

				ecore_list_destroy(keys);

				ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED,
														combo_value_changed, elem);
				break;
			default:
				entry = ewl_entry_new(elem_to_s(elem));
				if( !elem->spec->modifiable )
					ewl_entry_editable_set(EWL_ENTRY(entry), false);

				ewl_callback_append(entry, EWL_CALLBACK_VALUE_CHANGED,
														entry_value_changed, elem);
				ewl_callback_append(entry, EWL_CALLBACK_DESELECT,
														entry_value_changed, elem);
				ewl_callback_append(entry, EWL_CALLBACK_FOCUS_OUT,
														entry_focus_out, elem);
				break;
		}

		elem->text = text;
		elem->entry = entry;

		row_items[0] = text;
		row_items[1] = entry;

		row = ewl_tree_row_add(EWL_TREE(tree), EWL_ROW(prow), row_items);
		ewl_widget_show(text);
		if( entry )
			ewl_widget_show(entry);

		if( elem->spec->type == EWLER_SPEC_ELEM_STRUCT ) {
			ecore_list_prepend(prow_stack, prow);
			ecore_list_prepend(sheap_stack, sheap);
			ecore_list_prepend(elems_stack, elems);

			prow = row;
			elems = elem->info.children;

			/* TODO: check for indexed struct */
			keys = ecore_hash_keys(elems);
			sheap = ecore_sheap_new(ecore_str_compare, ecore_list_count(keys));

			while( (key = ecore_list_next(keys)) )
				ecore_sheap_insert(sheap, key);

			ecore_list_destroy(keys);
			ecore_sheap_sort(sheap);
		}

		if( sheap->size == 0 && ecore_list_count(sheap_stack) ) {
			ecore_sheap_destroy(sheap);

			prow = ecore_list_first_remove(prow_stack);
			sheap = ecore_list_first_remove(sheap_stack);
			elems = ecore_list_first_remove(elems_stack);
		}
	}

	ecore_list_destroy(sheap_stack);
	ecore_list_destroy(elems_stack);
	ecore_sheap_destroy(slist);
}
Esempio n. 25
0
void eli_highscore_init(const char * app)
{
    char buffer[1024];
    char * home;
    Eet_File * ef;
    eet_init();

    edd_entry = eet_data_descriptor_new("Eli_Highscore_Entry",
                                        sizeof(Eli_Highscore_Entry),
                                        (list_next) eina_list_next,
                                        (list_append) eina_list_append,
                                        (list_data) eina_list_data_get,
                                        (list_free) eina_list_free,
                                        (hash_foreach) eina_hash_foreach,
                                        (hash_add) eina_hash_add /* FIXME: YOU SHOULD NOT USE EINA_HASH_ADD DIRECTLY */,
                                        (hash_free) eina_hash_free);

    EET_DATA_DESCRIPTOR_ADD_BASIC(edd_entry, Eli_Highscore_Entry,
                                  "username", username, EET_T_STRING);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd_entry, Eli_Highscore_Entry,
                                  "points", points, EET_T_FLOAT);
    EET_DATA_DESCRIPTOR_ADD_BASIC(edd_entry, Eli_Highscore_Entry,
                                  "type", type, EET_T_INT);

    edd_hiscore = eet_data_descriptor_new("Eli_Highscore",
                                          sizeof(Eli_Highscore),
                                          (list_next) eina_list_next,
                                          (list_append) eina_list_append,
                                          (list_data) eina_list_data_get,
                                          (list_free) eina_list_free,
                                          (hash_foreach) eina_hash_foreach,
                                          (hash_add) eina_hash_add /* FIXME: YOU SHOULD NOT USE EINA_HASH_ADD DIRECTLY */,
                                          (hash_free) eina_hash_free);

    EET_DATA_DESCRIPTOR_ADD_LIST(edd_hiscore, Eli_Highscore,
                                 "entries", entries, edd_entry);

    /* this is just a temporally hack, the right path should be
     * some thing like /var/games/elitaire.score, but
     * for some reasons eet segv when the directory is not
     * writable, although the file is */
    home = getenv("HOME");
    if (!home)
	    home = "/tmp";

    snprintf(buffer, sizeof(buffer), 
		    "%s/.e/apps/%s/score.eet", home, app);
    eet_file_name = strdup(buffer);

    /*
     * setup the hiscore hash
     */
    hiscore_hash = ecore_hash_new(ecore_str_hash, ecore_str_compare);
    ecore_hash_free_key_cb_set(hiscore_hash, free);

    /*
     * fill the hash
     */
    ef = eet_open(eet_file_name, EET_FILE_MODE_READ);

    if (ef) {
        char **list;
	int num, i;

	list = eet_list(ef, "*", &num);
	
	for(i = 0; i < num; i++) {
	    Eli_Highscore * hiscore;

	    hiscore = eet_data_read(ef, edd_hiscore, list[i]);
	    ecore_hash_set(hiscore_hash, strdup(list[i]), hiscore->entries);
	}
	free(list);
	eet_close(ef);
    }
}