Пример #1
0
void entropy_notify_event_expire_requestor_layout(void* requestor) 
{
	/*HACK - assume the requestor is an entropy_gui_component_instance* -
	 * safe for now - but we commit ourselves here*/

	entropy_notification_engine* engine = entropy_core_get_core()->notify;
	entropy_gui_component_instance* instance = requestor;
	entropy_gui_component_instance* layout = instance->layout_parent;
	entropy_notify_event* ev;


	ecore_list_first_goto(engine->op_queue);
	ev = ecore_list_current(engine->op_queue);
	while ( ev) {
		if (  ((entropy_gui_component_instance*)ev->requestor_data)->layout_parent == layout) {
			if (!ev->processed) {
				ecore_list_remove(engine->op_queue);
				entropy_notify_event_destroy(ev);

				printf("Removed event, unprocessed: %p\n", ev);
				
				ev = ecore_list_current(engine->op_queue);
			} else {
				printf("Left event, processed: %p\n", ev);
				
				ev = ecore_list_next(engine->op_queue);
			}
		} else {
			printf("Left event, different layout: %p\n", ev);
			
			ev = ecore_list_next(engine->op_queue);
		}
	}
}
Пример #2
0
static EXML_Node *find_node(EXML_Node *node, char *key, char *value)
{
    Ecore_List *props;
    EXML_Node  *prop;

    props = node->children;
    ecore_list_first_goto(props);
    prop = ecore_list_current(props);
    while(prop != NULL)
    {
        if(ecore_hash_get(prop->attributes, key))
        {
            if(!strcmp(ecore_hash_get(prop->attributes, key), value))
                return prop;
        }
        if(prop->children)
        {
            EXML_Node *ret;
            if((ret = find_node(prop, key, value)))
                return ret;
        }

        prop = ecore_list_next(props);
    }
    return NULL;
}
Пример #3
0
void
evfs_posix_monitor_remove(evfs_client * client, char *path)
{
   Ecore_List *mon_list = ecore_hash_get(posix_monitor_hash, path);
   Ecore_File_Monitor *em = NULL;

   if (!mon_list)
     {
        /*There is no one monitoring this - so this client can't be... */
        return;
     }
   else
     {
        evfs_file_monitor *mon = NULL;
        evfs_file_monitor *check_last = NULL;

        ecore_list_first_goto(mon_list);
        while ((mon = ecore_list_current(mon_list)))
          {
             if (mon->client == client)
               {
                  em = mon->em;
                  ecore_list_remove(mon_list);
                  goto final;
               }

             ecore_list_next(mon_list);
          }
        goto out;

      final:
Пример #4
0
/**
 * Move the current xml to its next sibling, return NULL and move to parent
 * at the end of the list
 * @param   xml The xml document
 * @return  The current xml tag name or NULL
 * @ingroup EXML_Traversal_Group
 */
char *exml_next_nomove(EXML *xml)
{
	Ecore_List *p_list;
	EXML_Node *parent, *cur;

	CHECK_PARAM_POINTER_RETURN("xml", xml, NULL);

	if (xml->current) {
		cur = xml->current;
		parent = cur->parent;

		if (parent) {
			p_list = parent->children;

			ecore_list_goto( p_list, xml->current );
			ecore_list_next( p_list );
			if ((xml->current = ecore_list_current(p_list)) == NULL) {
				xml->current = cur;
				return NULL;
			}
		} else
			xml->current = NULL;
	}

	return xml->current ? xml->current->tag : NULL;
}
Пример #5
0
/**
 * Remove the current node from the document
 * @param   xml The xml document to modify
 * @return  @c TRUE if successful, @c FALSE if an error occurs.
 * @ingroup EXML_Modfiy_Element_Group
 */
int exml_tag_remove(EXML *xml)
{
	EXML_Node *n_cur;

	CHECK_PARAM_POINTER_RETURN("xml", xml, FALSE);

	n_cur = xml->current;
	if (!n_cur)
		return FALSE;

	n_cur = n_cur->parent;

	if (n_cur) {
		EXML_Node *c_parent = n_cur;
		Ecore_List *c_list = c_parent->children;

		ecore_list_goto( c_list, xml->current );
		ecore_list_remove_destroy( c_list );
		if ((n_cur = ecore_list_current( c_list )) == NULL)
			if ((n_cur = ecore_list_last_goto( c_list )) == NULL)
				n_cur = c_parent;
	} else {
		/* we're removing the top level node */
		xml->top = NULL;
		_exml_node_destroy( xml->current );
	}

	xml->current = n_cur;
	return TRUE;
}
Пример #6
0
void
ewl_iconbox_background_set_file_cb (Ewl_Widget * w, void *ev, void *user_data)
{
  Ewl_Dialog_Event *e;
  entropy_gui_component_instance *instance = user_data;
  entropy_icon_viewer *viewer = instance->data;
  char* file = NULL;

  e = ev;
  if (e->response == EWL_STOCK_OPEN) {
    Ecore_List* l;
    l = ewl_filedialog_selected_files_get(EWL_FILEDIALOG(viewer->file_dialog));
    ecore_list_first_goto(l);
    file = ecore_list_current(l);
	  
    printf ("Curent directory is '%s'\n", viewer->current_dir);
    entropy_config_str_set ("iconbox_viewer", viewer->current_dir, file);
    ewl_widget_destroy (viewer->file_dialog);

  }
  else if (e->response == EWL_STOCK_CANCEL) {
    ewl_widget_destroy (viewer->file_dialog);
  }


}
Пример #7
0
static E_Widget *
_e_widget_spinner_handle(Enhance *en, EXML_Node *node)
{
    E_Widget   *spinner;
    char       *id;
    Ecore_List *props;
    EXML_Node  *prop;
    double      value;
    double      min       = 0;
    double      max       = 0;
    double      step_inc  = 1;
    double      page_inc  = 1;
    double      page_size = 1;

    id = ecore_hash_get(node->attributes, "id");
    if(!id) return NULL;

    props = node->children;
    ecore_list_first_goto(props);
    prop = ecore_list_current(props);
    while(prop != NULL)
    {
        if(!strcmp(prop->tag, "property"))
        {
            char *name;

            name = ecore_hash_get(prop->attributes, "name");
            if(!name) {
                prop = ecore_list_next(props);
                continue;
            }

            if(!strcmp(name, "adjustment"))
            {
                if(prop->value)
                {
                    char *adj;

                    adj = strdup(prop->value);
                    sscanf(adj, "%lf %lf %lf %lf %lf %lf", &value, &min, &max,
                           &step_inc, &page_inc, &page_size);
                    E_FREE(adj);
                }
            }
        }
        prop = ecore_list_next(props);
    }

    ecore_list_first_goto(props);

    spinner = _e_widget_new(en, node, etk_spinner_new(min, max,
                            value,
                            step_inc,
                            page_inc), id);

    return spinner;
}
Пример #8
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;

}
Пример #9
0
void entropy_etk_delete_dialog_new(entropy_gui_component_instance* instance, Ecore_List* files) 
{
	char buf[PATH_MAX];
	Etk_Widget* window = etk_window_new();
	Etk_Widget* vbox= etk_vbox_new(ETK_TRUE,5);
	Etk_Widget* hbox = etk_hbox_new(ETK_TRUE,5);
	Etk_Widget* button;
	Etk_Widget* label;

	if (ecore_list_count(files) == 1) {
		ecore_list_first_goto(files);
		entropy_generic_file* file = ((entropy_generic_file*)ecore_list_current(files));
		snprintf(buf, PATH_MAX, "Are you sure you want to delete '%s/%s'? ", file->path, 
			file->filename);
	} else {
		snprintf(buf, PATH_MAX, "Are you sure you want to delete these %d files'? ", ecore_list_count(files));
	}

	etk_window_title_set(ETK_WINDOW(window), buf);
		
	etk_container_add(ETK_CONTAINER(window), vbox);

	label = etk_label_new(buf);
	etk_box_append(ETK_BOX(vbox), label, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 5);
	etk_box_append(ETK_BOX(vbox), hbox, ETK_BOX_START, ETK_BOX_EXPAND_FILL, 5);

	button = etk_button_new_with_label("Yes");
	etk_container_add(ETK_CONTAINER(hbox), button);
	etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_entropy_delete_dialog_cb), 
			(int*)ENTROPY_USER_INTERACTION_RESPONSE_YES );
	etk_object_data_set(ETK_OBJECT(button), "window", window);
	etk_widget_show(button);

	button = etk_button_new();
	etk_button_label_set(ETK_BUTTON(button), "No");
	etk_container_add(ETK_CONTAINER(hbox), button);
		
	etk_signal_connect("pressed", ETK_OBJECT(button), ETK_CALLBACK(etk_entropy_delete_dialog_cb), 
			(int*)ENTROPY_USER_INTERACTION_RESPONSE_NO );
	etk_object_data_set(ETK_OBJECT(button), "window", window);
	etk_widget_show(button);

	etk_object_data_set(ETK_OBJECT(window), "files", files);
	etk_object_data_set(ETK_OBJECT(window), "instance", instance);

	etk_widget_show_all(window);
}
Пример #10
0
void
widget_clear_ui_hooks( Ewler_Widget *w )
{
	Ecore_Hash *elems;
	Ecore_List *elems_stack;
	Ecore_List *names, *names_stack;
	char *name;

	names = ecore_hash_keys(w->elems);

	elems = w->elems;

	elems_stack = ecore_list_new();
	names_stack = ecore_list_new();

	while( (name = ecore_list_next(names)) ) {
		Ewler_Widget_Elem *elem;

		elem = ecore_hash_get(elems, name);

		elem->entry = NULL;
		elem->text = NULL;
		if( elem->items )
			ecore_hash_destroy(elem->items);
		elem->items = NULL;

		if( elem->spec->type == EWLER_SPEC_ELEM_STRUCT ) {
			ecore_list_prepend(elems_stack, elems);
			ecore_list_prepend(names_stack, names);

			elems = elem->info.children;
			names = ecore_hash_keys(elems);
		}

		while( !ecore_list_current(names) && elems != w->elems ) {
			ecore_list_destroy(names);
			elems = ecore_list_first_remove(elems_stack);
			names = ecore_list_first_remove(names_stack);
		}
	}

	ecore_list_destroy(names);
	ecore_list_destroy(elems_stack);
	ecore_list_destroy(names_stack);
}
Пример #11
0
static E_Widget *
_e_widget_radio_button_handle(Enhance *en, EXML_Node *node)
{
    E_Widget   *button;
    Etk_Widget *w = NULL;
    char       *label = NULL;
    char       *group = NULL;
    char       *id;
    Ecore_List *props;
    EXML_Node  *prop;

    id = ecore_hash_get(node->attributes, "id");
    if(!id) return NULL;

    props = node->children;
    ecore_list_first_goto(props);
    prop = ecore_list_current(props);
    while(prop != NULL)
    {
        if(!strcmp(prop->tag, "property"))
        {
            char *name;

            name = ecore_hash_get(prop->attributes, "name");
            if(!name) {
                prop = ecore_list_next(props);
                continue;
            }

            if(!strcmp(name, "label"))
            {
                if(prop->value)
                    label = strdup(prop->value);
            }
            else if(!strcmp(name, "group"))
            {
                if(prop->value)
                    group = strdup(prop->value);
            }
        }
        prop = ecore_list_next(props);
    }

    ecore_list_first_goto(props);

    if(group)
        w = eina_hash_find(en->radio_groups, group);

    if(label)
    {
        if(w)
            button = _e_widget_new(en, node,
                                   etk_radio_button_new_with_label_from_widget(label,
                                           ETK_RADIO_BUTTON(w)),
                                   id);
        else
            button = _e_widget_new(en, node,
                                   etk_radio_button_new_with_label(label, NULL),
                                   id);
    }
    else
    {
        if(w)
            button = _e_widget_new(en, node,
                                   etk_radio_button_new_from_widget(ETK_RADIO_BUTTON(w)),
                                   id);
        else
            button = _e_widget_new(en, node, etk_radio_button_new(NULL), id);
    }

    if(!group)
        eina_hash_add(en->radio_groups, id, button->wid);

    E_FREE(label);
    E_FREE(group);

    return button;
}
Пример #12
0
        while ((mon = ecore_list_current(mon_list)))
          {
             if (mon->client == client)
               {
                  em = mon->em;
                  ecore_list_remove(mon_list);
                  goto final;
               }

             ecore_list_next(mon_list);
          }
        goto out;

      final:
        ecore_list_first_goto(mon_list);
        check_last = ecore_list_current(mon_list);
        if (!check_last)
          {
             printf("Removing last watcher on '%s'..\n", mon->monitor_path);
             if (em)
               {
                  ecore_file_monitor_del(em);
               }
             else
               {
                  fprintf(stderr,
                          "EVFS: Error - attempt to remove monitor on NULL Ecore_File_Monitor object\n");
               }
             ecore_list_destroy(mon_list);
             ecore_hash_remove(posix_monitor_hash, path);
          }