Esempio n. 1
0
int
posix_monitor_add(evfs_client * client, evfs_command * command)
{
   Ecore_List *mon_list =
      ecore_hash_get(posix_monitor_hash, evfs_command_first_file_get(command)->path);
   evfs_file_monitor *mon;
   evfs_file_monitor *old;

   mon = calloc(1, sizeof(evfs_file_monitor));
   mon->client = client;
   mon->monitor_path = strdup(evfs_command_first_file_get(command)->path);

   /*Check if we are already monitoring, if not, make a new list of monitors.. */
   if (!mon_list)
     {
        /*printf("No previous instance, making a new list, monitoring..\n"); */

        mon_list = ecore_list_new();
        ecore_hash_set(posix_monitor_hash, mon->monitor_path, mon_list);

        printf("Adding monitor on path '%s'\n", mon->monitor_path);
        if (!
            (mon->em =
             ecore_file_monitor_add(mon->monitor_path,
                                    &evfs_file_monitor_fam_handler,
                                    mon->monitor_path)))
          {
             fprintf(stderr, "EVFS: Error monitoring '%s'\n",
                     mon->monitor_path);
          }

        ecore_list_append(mon_list, mon);
     }
   else
     {
        if (!client_already_monitoring(client, mon_list))
          {
             /*We assume there is something already in the list.  This is probably bad a bad assumption */
             ecore_list_first_goto(mon_list);
             old = ecore_list_current(mon_list);

             /*Make sure we have the ecore ref, so the last monitor can nuke it */
             mon->em = old->em;
             ecore_list_append(mon_list, mon);
          }
        else
          {
             printf("Oi, dufus, you're already monitoring this object\n");
          }

     }

   return 0;

}
Esempio n. 2
0
Epsilon_Plugin *
epsilon_plugin_init (void)
{
  Epsilon_Plugin *plugin = calloc (1, sizeof (Epsilon_Plugin));
  plugin->epsilon_generate_thumb = &epsilon_generate_thumb;
  plugin->mime_types = ecore_list_new ();

  ecore_list_append (plugin->mime_types, "video/mpeg");
  ecore_list_append (plugin->mime_types, "video/x-ms-wmv");
  ecore_list_append (plugin->mime_types, "video/x-msvideo");
  ecore_list_append (plugin->mime_types, "video/quicktime");

  return plugin;
}
/**
 * Retrieves an ecore_list of all keys in the given hash.
 * @param   hash          The given hash.
 * @return  new ecore_list on success, NULL otherwise
 * @ingroup Ecore_Data_Hash_ADT_Traverse_Group
 */
EAPI Ecore_List *
ecore_hash_keys(Ecore_Hash *hash)
{
   unsigned int i = 0;
   Ecore_List *keys;

   CHECK_PARAM_POINTER_RETURN("hash", hash, NULL);

   keys = ecore_list_new();
   while (i < ecore_prime_table[hash->size])
     {
        if (hash->buckets[i])
          {
             Ecore_Hash_Node *node;

             for (node = hash->buckets[i]; node; node = node->next)
               {
                  ecore_list_append(keys, node->key);
               }
          }

        i++;
     }
   ecore_list_first_goto(keys);

   return keys;
}
static Group       *
GroupCreate(int gid)
{
   Group              *g;

   g = ECALLOC(Group, 1);
   if (!g)
      return NULL;

   if (!group_list)
      group_list = ecore_list_new();
   ecore_list_append(group_list, g);

   if (gid == -1)
     {
	/* Create new group id */
	/* ... using us time. Should really be checked for uniqueness. */
	g->index = (int)GetTimeUs();
     }
   else
     {
	/* Use given group id */
	g->index = gid;
     }
   g->cfg.iconify = Conf_groups.dflt.iconify;
   g->cfg.kill = Conf_groups.dflt.kill;
   g->cfg.move = Conf_groups.dflt.move;
   g->cfg.raise = Conf_groups.dflt.raise;
   g->cfg.set_border = Conf_groups.dflt.set_border;
   g->cfg.stick = Conf_groups.dflt.stick;
   g->cfg.shade = Conf_groups.dflt.shade;

   Dprintf("grp=%p gid=%d\n", g, g->index);
   return g;
}
Esempio n. 5
0
File: gui_ewl.c Progetto: Limsik/e17
static Ecore_List *
_list_keys_order (Ecore_List *keys)
{
  Ecore_List *l;
  char       *key;

  l = ecore_list_new ();
  ecore_list_first_goto(keys);
  while ((key = ecore_list_next(keys)))
    {
      char *str;

      ecore_list_first_goto (l);
      while ((str = ecore_list_next(l)) &&
             (strcasecmp (key, str) >= 0)) { }

      if (!str)
        ecore_list_append (l, key);
      else
        {
          ecore_list_index_goto (l, ecore_list_index (l) - 1);
          ecore_list_insert (l, key);
        }
    }

  ecore_list_destroy (keys);

  return l;
}
Esempio n. 6
0
/**
 * @brief get the dns list
 * @return Return the dns list
 */
Ecore_List* exalt_dns_get_list()
{
    FILE* f;
    char buf[1024];
    char *addr;
    Ecore_List* l;

    f = fopen(EXALT_RESOLVCONF_FILE, "ro");
    EXALT_ASSERT_RETURN(f!=NULL);

    l = ecore_list_new();
    l->free_func = free;
    while(fgets(buf,1024,f))
    {
        buf[strlen(buf)-1] = '\0';
        //jump nameserver
        if(strlen(buf) > 13)
        {
            addr = buf + 11;
            if(exalt_is_address(addr))
                ecore_list_append(l, strdup(addr));
        }
    }
    EXALT_FCLOSE(f);
    return l;
}
Esempio n. 7
0
/**
 * Create a new child tag for the current node level, and sets it to current
 * @param   xml The xml document to add the tag to
 * @return  @c TRUE if successful, @c FALSE if an error occurs.
 * @ingroup EXML_Create_Element_Group
 */
int exml_start(EXML *xml)
{
	EXML_Node *node;

	CHECK_PARAM_POINTER_RETURN("xml", xml, FALSE);

	if (xml->current == NULL && xml->top)
		return FALSE;

	node = exml_node_new();
	if (!node)
		return FALSE;

	node->parent = xml->current;

	/* no sanity check on xml->current pointer */

	if (xml->top == NULL)
		xml->current = xml->top = node;
	else {
		ecore_list_append( xml->current->children, node );
		xml->current = node;
	}

	return TRUE;
}
Esempio n. 8
0
int entropy_notify_loop(void* data) {
	entropy_notification_engine* notify = (entropy_notification_engine*)data;
	entropy_notify_event* next;

	
	void* (*call_func)(void* arg);

	ecore_list_first_goto (notify->op_queue);
	if ( (next = ecore_list_next(notify->op_queue)) ) {
		next->processed = 1;

		
		/*printf ("*************************************** Notify loop - Processing event..\n");	*/
		/*printf("Calling function '%s'\n", next->function);*/
		call_func = dlsym(next->plugin->dl_ref, next->function);	
		next->return_struct = (*call_func)(next->data);

		/*Relock to remove next*/
		ecore_list_first_remove(notify->op_queue);

		ecore_list_append(notify->exe_queue, next);

		ecore_ipc_server_send(notify->server, ENTROPY_IPC_EVENT_CORE, 6, 0, 0, 0, NULL, 0);
	} else {
	}
		

	return 1;
}
Esempio n. 9
0
void eim_config_init (Eim *e) {
#ifdef CORE_DEBUG
  printf("TRACE: eim_initialize\n");
#endif
  assert (e);

  int nb_account = 0;
  int i;
  
  /* read config file to get account properties */
  if (ecore_config_init ("eim") == ECORE_CONFIG_ERR_FAIL) {
    printf("WARNING: config file not available\n");
    /* load default config and save it*/
    _eim_load_default_config ();
    ecore_config_save ();
  }
  
  /* here we can load each configuration */
  ecore_config_load();
  nb_account = ecore_config_int_get(EIM_CONFIG_NB_ACCOUNT);
  for (i = 0; i < nb_account; i++) {
    ecore_list_append (e->account_properties, 
		       account_properties_new_from_config (i));
  }
}
Esempio n. 10
0
Ecore_List* entropy_plugins_type_get(int type, int subtype) {
	entropy_plugin* list_item;

	Ecore_List* plugins = entropy_core_get_core()->plugin_list;
	
	if (plugin_list) {
		ecore_list_destroy(plugin_list);
	}

	plugin_list = ecore_list_new();
	
	ecore_list_first_goto(plugins);
	while ( (list_item = ecore_list_next(plugins)) ) {
		/*printf("Scanning plugin: %s\n", list_item->filename);*/
		if (list_item->type == type && 
		   (subtype == ENTROPY_PLUGIN_SUB_TYPE_ALL || subtype == list_item->subtype)
		   && (type != ENTROPY_PLUGIN_GUI_COMPONENT || 
		(type == ENTROPY_PLUGIN_GUI_COMPONENT && 
		 !strcmp(list_item->toolkit, entropy_layout_global_toolkit_get())))) {
			ecore_list_append(plugin_list, list_item);
		}
	}
	
	return plugin_list;	
}
Esempio n. 11
0
void entropy_notify_event_callback_add(entropy_notify_event* event, void* cb, void* data) {
	entropy_notify_event_cb_data* cb_data = entropy_malloc(sizeof(entropy_notify_event_cb_data));

	cb_data->cb = cb;
	cb_data->data = data;
	
	ecore_list_append(event->cb_list, cb_data);
}
void entropy_etk_delete_dialog_single_new(entropy_gui_component_instance* instance, entropy_generic_file* file)
{
	Ecore_List* files;

	files = ecore_list_new();
	ecore_list_append(files,file);

	entropy_etk_delete_dialog_new(instance,files);
}
Esempio n. 13
0
void entropy_notify_event_bulk_commit(entropy_notification_engine* engine, Ecore_List* list) {
	entropy_notify_event* ev;
	
	while ( (ev = ecore_list_first_remove(list))) {
		ecore_list_append(engine->op_queue, ev);
	}

	ecore_list_destroy(list);

}
Esempio n. 14
0
File: gui_ewl.c Progetto: Limsik/e17
void
ecrin_ewl_list_fill_package (char *aiguille)
{
  Ewl_Widget *row;
  char       *key;

  if (list_rows)
    ecore_list_destroy (list_rows);

  list_rows = ecore_list_new ();

  if (!aiguille)
    aiguille = "";

  ecore_list_first_goto(sorted_keys);
  while ((key = ecore_list_next(sorted_keys)))
    {
      Ecrin_Hash_Data *data;
      
      data = ecrin_hash_data_get (key);

      if (strstr (key, aiguille))
        {
          row = ewl_tree_text_row_add (EWL_TREE (list), NULL,
                                       &data->data_name);

          ecore_list_append (list_rows, row);

          switch (data->type)
            {
            case HASH_DATA_ENUM:
              ewl_callback_append (row, EWL_CALLBACK_CLICKED, _enum_display, data);
              break;
            case HASH_DATA_DEFINE:
              ewl_callback_append (row, EWL_CALLBACK_CLICKED, _define_display, data);
              break;
            case HASH_DATA_FUNCTION:
              ewl_callback_append (row, EWL_CALLBACK_CLICKED, _function_display, data);
              break;
            default:
              break;
            }
        }
    }

}
Esempio n. 15
0
int
evfs_client_disconnect(evfs_client * client)
{
   Ecore_List *mon_list;
   Ecore_List *indiv_list;
   evfs_file_monitor *mon;
   char *key;
   Ecore_List *watched_keys = ecore_list_new();

   /*printf("Received disconnect for client at evfs_fs_posix.c for client %lu\n",
          client->id);
   printf("Scanning monitors for client and removing...\n");*/

   mon_list = ecore_hash_keys(posix_monitor_hash);
   if (mon_list)
     {
        while ((key = ecore_list_first_remove(mon_list)))
          {
             /*printf("Looking for clients for '%s'\n", key);*/

             indiv_list = ecore_hash_get(posix_monitor_hash, key);
             ecore_list_first_goto(indiv_list);

             while ((mon = ecore_list_next(indiv_list)))
               {
                  if (mon->client == client)
                    {
                       ecore_list_append(watched_keys, key);
                    }
               }
          }
        ecore_list_destroy(mon_list);
     }
   else
     {
        /*printf("No directories/files monitored by any client\n");*/
     }

   while ((key = ecore_list_first_remove(watched_keys)))
     {
        evfs_posix_monitor_remove(client, key);
     }
   ecore_list_destroy(watched_keys);
   return 1;
}
Esempio n. 16
0
void ewl_entropy_tip_window_create_tips()
{
    tool_tips = ecore_list_new();
    ecore_list_append(tool_tips, "You can add a new 'location' by clicking on \"Add Location\"\nin the Tools menu");
    ecore_list_append(tool_tips, "Entropy can browse .tar.gz and .tar.bz2 files.  Just click on the\n file, and it will be"
                      "treated as a regular folder");
    ecore_list_append(tool_tips, "To copy a file, drag the icon from the icon view to a folder in the left hand pane");
    ecore_list_append(tool_tips, "The icon view supports keyboard navigation.  Arrow keys, and special keys\n like 'Delete'"
                      "will execute appropriate actions");
    ecore_list_append(tool_tips, "File properties can be viewed by selecting an icon, and clicking 'Properties'");
    ecore_list_append(tool_tips, "You can change the action that is executed for a particular file type\n"
                      "by opening the 'Properties' dialog for a file of that type, and clicking\n"
                      "'Open With..'");
    ecore_list_append(tool_tips, "The MIME-Type dialog allows fine grained control over the action executed\n"
                      "for a file type.");
    ecore_list_append(tool_tips, "Entropy is able to thumbnail images in any filesystem supported by EVFS.\n"
                      "For instance, this means that Entropy can thumbnail files in a .tar.bz2\n"
                      "file on a Samba share!\n");


}
Esempio n. 17
0
/**
 * @param w: the window to be initialized to default values and callbacks
 * @return Returns TRUE or FALSE depending on if initialization succeeds.
 * @brief Initialize a window to default values and callbacks
 *
 * Sets the values and callbacks of a window @a w to their defaults.
 */
int
ewl_window_init(Ewl_Window *w)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(w, FALSE);

        /*
         * Initialize the fields of the inherited container class
         */
        if (!ewl_embed_init(EWL_EMBED(w)))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_appearance_set(EWL_WIDGET(w), EWL_WINDOW_TYPE);
        ewl_widget_inherit(EWL_WIDGET(w), EWL_WINDOW_TYPE);
        ewl_object_fill_policy_set(EWL_OBJECT(w), EWL_FLAG_FILL_FILL);
        ewl_embed_render_set(EWL_EMBED(w), TRUE);

        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
                             ewl_window_cb_realize, NULL);
        ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_REALIZE,
                             ewl_window_cb_postrealize, NULL);
        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_UNREALIZE,
                             ewl_window_cb_unrealize, NULL);
        ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_SHOW,
                            ewl_window_cb_show, NULL);
        ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_EXPOSE,
                            ewl_window_cb_expose, NULL);
        ewl_callback_append(EWL_WIDGET(w), EWL_CALLBACK_HIDE,
                            ewl_window_cb_hide, NULL);
        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_DESTROY,
                             ewl_window_cb_destroy, NULL);
        /*
         * Override the default configure callbacks since the window
         * has special needs for placement.
         */
        ewl_callback_prepend(EWL_WIDGET(w), EWL_CALLBACK_CONFIGURE,
                             ewl_window_cb_configure, NULL);

        ecore_list_append(ewl_window_list, w);

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Esempio n. 18
0
Epsilon_Plugin *
epsilon_plugin_init ()
{
   Epsilon_Plugin *plugin;

   plugin = calloc (1, sizeof (Epsilon_Plugin));
   if (!plugin) return NULL;

   plugin->mime_types = ecore_list_new ();
   if (!plugin->mime_types)
     {
        free(plugin);
	return NULL;
     }
   plugin->epsilon_generate_thumb = &epsilon_generate_thumb;

   ecore_list_append (plugin->mime_types, "application/dvi");

   return plugin;
}
Esempio n. 19
0
void egxp_node_add_condition (Egxp_Node * cn, Egxp_Condition * cond) {
#ifdef EGXP_DEBUG
  printf("TRACE: egxp_node_add_condition\n");
#endif
  
  assert (cn && cond);
   
  /* check if the node is already attached to a parent. If it is already 
     attached we generate an error */
  assert (cn->parent == NULL);

  /* check if the conditions lists is created */
  if (cn->conditions == NULL) {
    cn->conditions = ecore_list_new ();
    ecore_list_set_free_cb (cn->conditions, (Ecore_Free_Cb)egxp_condition_free);
  }
  
  /* append the condition */
  ecore_list_append (cn->conditions, cond);
}
Esempio n. 20
0
Menu               *
MenuCreate(const char *name, const char *title, Menu * parent, MenuStyle * ms)
{
   Menu               *m;

   m = ECALLOC(Menu, 1);
   if (!m)
      return m;

   m->parent = parent;
   MenuSetName(m, name);
   MenuSetTitle(m, title);
   if (ms)
      MenuSetStyle(m, ms);
   m->icon_size = -1;		/* Use image size */

   if (!menu_list)
      menu_list = ecore_list_new();
   ecore_list_append(menu_list, m);

   return m;
}
Esempio n. 21
0
/**
 * Write the transformed xml document out to a memory location.
 * @param   xml The xml document
 * @param  xsl The xml stylesheet
 * @param  params The transform parameters
 * @param   ptr The source xml output location
 * @param   len The size of the memory buffer
 * @return	a pointer to the memory location, or NULL if 
 * @ingroup EXML_XSLT_Group
 */
void *exml_transform_mem_write( EXML *xml, EXML_XSL *xsl, const char *params[],
                                ssize_t *len )
{
	xmlDocPtr res, doc;
	xmlChar *buf;
	int ret;

	CHECK_PARAM_POINTER_RETURN("xml", xml, NULL);
	CHECK_PARAM_POINTER_RETURN("xsl", xsl, NULL);
	
	exml_doc_write(xml, &doc);

	res = xsltApplyStylesheet(xsl->cur, doc, params);

	xmlFreeDoc(doc);

	if( !res ) {
		return NULL;
	}

	ret = xsltSaveResultToString(&buf, len, res, xsl->cur);

	xmlFreeDoc(res);

	if( ret < 0 ) {
		*len = 0;

		xsltCleanupGlobals();

		return NULL;
	}

	ecore_list_append( xsl->buffers, buf );

	xsltCleanupGlobals();

	return buf;
}
Esempio n. 22
0
static void
epdf_index_fill (Ecore_List *items,
                 GooList    *gitems)
{
  if (!items || !gitems)
    return;

  for (int i = 0; i < gitems->getLength (); i++) {
    Epdf_Index_Item *item;
    OutlineItem     *oitem = (OutlineItem *)gitems->get (i);
    Unicode         *utitle = oitem->getTitle ();

    item = epdf_index_item_new ();
    item->title = unicode_to_char (utitle, oitem->getTitleLength ());
    item->action = oitem->getAction ();
    oitem->open ();
    if (oitem->hasKids () && oitem->getKids ()) {
      item->children = ecore_list_new ();
      epdf_index_fill (item->children, oitem->getKids ());
    }
    ecore_list_append (items, item);
  }
}
Esempio n. 23
0
void
ewl_icon_local_viewer_delete_selected (entropy_gui_component_instance *
				       instance)
{
  Ewl_Iconbox *ib =
    EWL_ICONBOX (((entropy_icon_viewer *) instance->data)->iconbox);
  entropy_icon_viewer *viewer = instance->data;

  Ecore_List *new_file_list = ecore_list_new ();
  Ecore_List *icon_list;
  gui_file *local_file;
  Ewl_Iconbox_Icon *list_item;

  Ewl_Widget *dialog_win;
  Ewl_Widget *dialog_label;
  Ewl_Widget *button;

  /*This is kind of awkward - the first item on the list is
   * the plugin instance reference*/
  ecore_list_append (new_file_list, instance);

  dialog_win = ewl_dialog_new ();
  ewl_window_title_set (EWL_WINDOW (dialog_win), "Delete?");

  ewl_dialog_active_area_set (EWL_DIALOG (dialog_win), EWL_POSITION_TOP);
  dialog_label = ewl_label_new ();
  ewl_label_text_set (EWL_LABEL (dialog_label),
		      "Are you sure you want to delete these files?");
  ewl_container_child_append (EWL_CONTAINER (dialog_win), dialog_label);
  ewl_widget_show (dialog_label);

  ewl_dialog_active_area_set (EWL_DIALOG (dialog_win), EWL_POSITION_BOTTOM);



  //////////////////////
  icon_list = ewl_iconbox_get_selection (EWL_ICONBOX (ib));

  ecore_list_first_goto (icon_list);
  while ((list_item = ecore_list_next (icon_list))) {
    local_file = ecore_hash_get (viewer->icon_hash, list_item);
    if (local_file) {
      entropy_core_file_cache_add_reference (local_file->file->md5);
      ecore_list_append (new_file_list, local_file->file);
    }
  }
  entropy_file_wait_list_add (viewer, new_file_list);
  ecore_list_destroy (icon_list);

  button = ewl_button_new ();
  ewl_button_label_set (EWL_BUTTON (button), "Yes");
  ewl_widget_show (button);
  ewl_container_child_append (EWL_CONTAINER (dialog_win), button);
  ewl_callback_append (button, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_delete_cb, new_file_list);

  button = ewl_button_new ();
  ewl_button_label_set (EWL_BUTTON (button), "No");
  ewl_widget_show (button);
  ewl_container_child_append (EWL_CONTAINER (dialog_win), button);
  ewl_callback_append (button, EWL_CALLBACK_CLICKED,
		       ewl_icon_local_viewer_delete_cb, new_file_list);

  ewl_widget_show (dialog_win);
}
Esempio n. 24
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. 25
0
int
main (int argc, char *argv[])
{
  Ecore_List     *str_data = NULL;
  Ewl_Widget     *window;
  Ewl_Widget     *hbox;
  Ewl_Widget     *list;
  Ewl_Model      *model;
  Ewl_View       *view;
  Ewl_Widget     *dvi;
  Ewl_Widget     *sp;
  const Edvi_Document  *document;
  int             page_count;
  int             i;

  if (argc == 1) {
    printf ("Usage: %s dvi_file\n", argv[0]);
    return EXIT_FAILURE;
  }

  printf ("[DVI] version       : %s\n", edvi_version_get ());
  if (!edvi_init (300, "cx", 4,
                  1.0, 1.0,
                  0, 255, 255, 255, 0, 0, 0))
    return EXIT_FAILURE;

  ewl_init (&argc, (char **)argv);
  str_data = ecore_list_new();
  ecore_list_free_cb_set (str_data, free);

  /* We open the dvi file */
  dvi = ewl_dvi_new ();
  if (!ewl_dvi_file_set (EWL_DVI (dvi), argv[1])) {
    printf ("Can not load the document %s\nExiting...", argv[1]);
    ecore_list_destroy (str_data);
    ewl_main_quit();
    return EXIT_FAILURE;
  }

  window = ewl_window_new ();
  ewl_window_title_set (EWL_WINDOW (window), "Ewl Dvi Test Application");
  ewl_callback_append (window, EWL_CALLBACK_DELETE_WINDOW,
                       _quit_cb, str_data);

  hbox = ewl_hbox_new ();
  ewl_box_homogeneous_set (EWL_BOX (hbox), FALSE);
  ewl_container_child_append (EWL_CONTAINER (window), hbox);
  ewl_widget_show (hbox);

  sp = ewl_scrollpane_new ();
  ewl_container_child_append (EWL_CONTAINER (hbox), sp);
  ewl_widget_show (sp);

  document = ewl_dvi_dvi_document_get (EWL_DVI (dvi));
  page_count = edvi_document_page_count_get (document);
  for (i = 0; i < page_count; i++) {
    char row_text[64];
    char *txt;

    snprintf (row_text, 64, "%d", i + 1);
    txt = strdup (row_text);
    ecore_list_append(str_data, txt);
  }

  model = ewl_model_ecore_list_instance();
  view = ewl_label_view_get();

  list = ewl_list_new ();
  ewl_mvc_model_set(EWL_MVC(list), model);
  ewl_mvc_view_set(EWL_MVC(list), view);
  ewl_mvc_data_set(EWL_MVC(list), str_data);
  ewl_callback_append (list,
                       EWL_CALLBACK_VALUE_CHANGED,
                       EWL_CALLBACK_FUNCTION (_change_page_cb),
                       dvi);
  ewl_container_child_append (EWL_CONTAINER (sp), list);
  ewl_widget_show (list);

  ewl_dvi_mag_set (EWL_DVI (dvi), 0.5);
  ewl_container_child_append (EWL_CONTAINER (hbox), dvi);
  ewl_widget_show (dvi);

  ewl_widget_show (window);

  ewl_main ();

  edvi_shutdown ();

  return EXIT_SUCCESS;
}
Esempio n. 26
0
void layout_etk_simple_add_header(entropy_gui_component_instance* instance, Entropy_Config_Structure* structure_obj)
{
  void *(*structure_plugin_init) (entropy_core * core,
				  entropy_gui_component_instance *,
				  void* parent_visual,
				  void *data);

  entropy_plugin *structure;
  entropy_generic_file* file;
  Etk_Tree_Row* row;
  Etk_Tree_Col* col;
  entropy_layout_gui* gui = instance->data;
  char* icon_string = NULL;
  Ecore_List* layouts;
  _layout_etk_row_structure_plugin* struct_ref = NULL;

  col = etk_tree_nth_col_get(ETK_TREE(gui->tree), 0);

  /*Parse the file from the URI*/
   file = entropy_core_parse_uri (structure_obj->uri);

   printf("Object for %s/%s is %p....\n", file->path, file->filename, file);
   

   /*This will be moved to a central function. TODO*/
   if (!strcmp(file->uri_base, "file"))
	   icon_string = PACKAGE_DATA_DIR "/icons/local-system.png";
  else if (!strcmp(file->uri_base, "smb"))
	  icon_string = PACKAGE_DATA_DIR "/icons/samba-system.png";
   else if (!strcmp(file->uri_base,"sftp"))
	  icon_string = PACKAGE_DATA_DIR "/icons/sftp-system.png"; 
   else if (!strcmp(file->uri_base,"vfolder"))
	  icon_string = PACKAGE_DATA_DIR "/icons/vfolder-system.png"; 
			   
	
  etk_tree_freeze(ETK_TREE(gui->tree));
  row = etk_tree_row_append(ETK_TREE(gui->tree), NULL, col,
			  icon_string, NULL, structure_obj->name, NULL);
  etk_tree_thaw(ETK_TREE(gui->tree));
  
  
  structure = entropy_plugins_type_get_first(ENTROPY_PLUGIN_GUI_COMPONENT,ENTROPY_PLUGIN_GUI_COMPONENT_STRUCTURE_VIEW);
   structure_plugin_init =
      dlsym (structure->dl_ref, "entropy_plugin_gui_instance_new");

   /*We shouldn't really assume it's a folder - but it bootstraps us for
    * now- FIXME*/
   strcpy(file->mime_type, "file/folder");
   file->filetype = FILE_FOLDER;

  if (!strlen (file->mime_type)) {
	    entropy_mime_file_identify (file);
  }
   
   instance = (*structure_plugin_init)(instance->core, instance, row,file);
   instance->plugin = structure;

   /*Add to tracker*/
  ecore_hash_set(_etk_layout_row_reference, row, structure_obj);

  printf ("LOADED: %s/%s\n", file->path, file->filename);
  
  /*Add to layout/plugin tracker - this is to destroy if the user removes a location*/
  if (! (layouts = ecore_hash_get(_etk_layout_structure_plugin_reference, structure_obj))) {
	  layouts = ecore_list_new();
	  ecore_hash_set(_etk_layout_structure_plugin_reference, structure_obj, layouts);
  }

  struct_ref = entropy_malloc(sizeof(_layout_etk_row_structure_plugin));
  struct_ref->row = row;
  struct_ref->structure_plugin = structure;

  ecore_list_append(layouts, struct_ref);

}
Esempio n. 27
0
Ecore_List* evfs_plugin_meta_types_get()
{
	Ecore_List* list = ecore_list_new();

	ecore_list_append(list, "image/png");
	ecore_list_append(list, "images/jpeg");
	ecore_list_append(list, "image/gif");
	ecore_list_append(list, "video/x-ms-wmv");
	ecore_list_append(list, "application/msword");
	ecore_list_append(list, "application/pdf");
	ecore_list_append(list, "application/vnd.ms-excel");
	ecore_list_append(list, "application/x-gtar");
	ecore_list_append(list, "text/html");
	ecore_list_append(list, "video/mpeg");
	ecore_list_append(list, "video/x-msvideo");
	ecore_list_append(list, "application/x-gtar");
	ecore_list_append(list, "application/x-bzip2");
	ecore_list_append(list, "video/quicktime");
	ecore_list_append(list, "video/x-ms-asf");
 	ecore_list_append(list, "object/undefined");

	



	return list;
}
Esempio n. 28
0
void entropy_notify_event_cleanup_add(entropy_notify_event* event, void* obj) {
	ecore_list_append(event->cleanup_list, obj);
}
Esempio n. 29
0
void entropy_notify_event_commit(entropy_notify_event* ev) {
	entropy_notification_engine* engine = entropy_core_get_core()->notify;

	ecore_list_append(engine->op_queue, ev);

}
Esempio n. 30
0
int
idle_add_icons (void *data)
{
  event_idle_processor *proc = (event_idle_processor *) data;
  entropy_gui_component_instance *comp =
    (entropy_gui_component_instance *) proc->requestor;
  entropy_icon_viewer *view = ((entropy_icon_viewer *) comp->data);

  Ecore_List *el = proc->user_data;
  entropy_generic_file *file;
  int i = 0;
  char *mime;
  entropy_plugin *thumb;
  Ecore_List *added_list = ecore_list_new ();
  Ecore_List *events;
  int term = 0;


  if (proc->terminate) {
    goto FREE_AND_LEAVE;
  }

  /*data = file list */


  while (i < ICON_ADD_COUNT && (file = ecore_list_first_remove (el))) {
    ewl_icon_local_viewer_add_icon (proc->requestor, file, DONT_DO_MIME);

    /*Remove the pre-idle-add ref*/
    entropy_core_file_cache_remove_reference (file->md5);
    
    ecore_list_append (added_list, file);

    i++;

  }
  if (!file)
    term = 1;

  while ((file = ecore_list_first_remove (added_list))) {
    mime =
      (char *) entropy_mime_file_identify (file);


    if (mime && strcmp (mime, ENTROPY_NULL_MIME)) {
	entropy_plugin_thumbnail_request(comp,file,(void*)gui_event_callback);
    }
    else {
      thumb = NULL;
    }

  }
  ecore_list_destroy (added_list);

  if (!term) {
    proc->count += ICON_ADD_COUNT;
    //printf("Continuing process thread..(%d)\n", proc->count);
    ewl_iconbox_scrollpane_recalculate (EWL_ICONBOX
					(((entropy_icon_viewer *) comp->
					  data)->iconbox));
    return 1;
  }
  else {
    ewl_iconbox_scrollpane_recalculate (EWL_ICONBOX
					(((entropy_icon_viewer *) comp->
					  data)->iconbox));
    view->last_processor = NULL;
    //printf("Terminated process thread..\n");
    goto FREE_AND_LEAVE;
    return 0;
  }


FREE_AND_LEAVE:
  ecore_list_destroy (proc->user_data);
  entropy_free (proc);
  return 0;



}