Beispiel #1
0
/**
 * @param e: The entry to clear the selection of
 * @return Returns TRUE if a selection was cleared, FALSE otherwise.
 * @brief Clear the current selection in the entry
 */
unsigned int
ewl_entry_selection_clear(Ewl_Entry *e)
{
        Ewl_Text_Trigger *sel;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(e, FALSE);
        DCHECK_TYPE_RET(e, EWL_ENTRY_TYPE, FALSE);

        sel = EWL_TEXT_TRIGGER(ewl_text_selection_get(EWL_TEXT(e)));
        if (sel)
        {
                unsigned int len, pos;

                len = ewl_text_trigger_length_get(sel);
                pos = ewl_text_trigger_start_pos_get(sel);
                ewl_text_cursor_position_set(EWL_TEXT(e), pos);
                ewl_text_text_delete(EWL_TEXT(e), len);

                /* remove the selection */
                ewl_text_trigger_length_set(sel, 0);

                DRETURN_INT(TRUE, DLEVEL_STABLE);
        }

        DRETURN_INT(FALSE, DLEVEL_STABLE);
}
Ewl_Widget *
ewl_io_manager_plugin_uri_read(const char *uri)
{
        Ewl_Widget *ret = NULL;
        FILE *file;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(uri, NULL);

        if (!key1)
                setup_hash();


        file = fopen(uri, "r");
        if (file)
        {
                struct stat buf;
                char *str;

                ret = ewl_text_new();
                ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace");

                stat(uri, &buf);
                str = malloc(sizeof(char) * (buf.st_size + 1));
                fread(str, buf.st_size, 1, file);
                str[buf.st_size] = '\0';
                fclose(file);

                text_set(EWL_TEXT(ret), str);
                FREE(str);
        }

        DRETURN_PTR(ret, DLEVEL_STABLE);
}
Beispiel #3
0
static void
_enum_display (Ewl_Widget *w, void *ev_data, void *user_data)
{
  Ecrin_Hash_Data *data;
  Ecrin_Enum      *e;
  Ecrin_Enum_Item *item;
  char             str[4096];

  data = (Ecrin_Hash_Data *)user_data;
  e = (Ecrin_Enum *)data->data;

  ewl_text_text_set (EWL_TEXT (text), data->efl_name);
  ewl_text_text_append (EWL_TEXT (text), "\n");
  ewl_text_text_append (EWL_TEXT (text), "\n");

  snprintf (str, 4096, "enum %s\n", e->name);
  ewl_text_text_append (EWL_TEXT (text), str);
  ewl_text_text_append (EWL_TEXT (text), "{\n");
  ecore_list_first_goto (e->items);
  while ((item = ecore_list_next (e->items)))
    {
      snprintf (str, 4096, "  %s", item->name);
      ewl_text_text_append (EWL_TEXT (text), str);
      if (item->value)
	snprintf (str, 4096, " = %s", item->value);
      ewl_text_text_append (EWL_TEXT (text), str);
      if (ecore_list_index (e->items) != ecore_list_count (e->items))
        ewl_text_text_append (EWL_TEXT (text), ",");
      ewl_text_text_append (EWL_TEXT (text), "\n");
    }
  ewl_text_text_append (EWL_TEXT (text), "};\n");
}
Beispiel #4
0
void
eke_gui_ewl_feed_change(Eke *eke, Eke_Feed *feed)
{
    Eke_Gui_Ewl_Feed *disp;
    Eke_Feed_Item *item;
    Ewl_Widget *o;

    disp = ecore_hash_get(eke->feeds, feed);
    if (!disp->tab) {
        Ewl_Widget *o;

        disp->tab = ewl_text_new(feed->title);
        ewl_widget_show(disp->tab);

        o = ewl_vbox_new();
        ewl_notebook_page_append(EWL_NOTEBOOK(eke->gui.ewl.notebook),
                                                        disp->tab, o);
        ewl_widget_show(o);

        disp->page = ewl_scrollpane_new();
        ewl_container_child_append(EWL_CONTAINER(o), disp->page);
        ewl_object_insets_set(EWL_OBJECT(disp->page), 5, 5, 5, 5);
        ewl_widget_show(disp->page);
    }
    ewl_container_reset(EWL_CONTAINER(disp->page));

    ecore_list_first_goto(feed->items);
    while ((item = ecore_list_next(feed->items)) != NULL) {
        o = ewl_text_new(NULL);
        ewl_text_wrap_set(EWL_TEXT(o), 1);
        ewl_text_style_set(EWL_TEXT(o), "soft_shadow");
        ewl_text_text_set(EWL_TEXT(o), item->title);
        ewl_container_child_append(EWL_CONTAINER(disp->page), o);
        ewl_widget_show(o);

        if (item->link) {
            o = ewl_text_new(item->link);
            ewl_text_wrap_set(EWL_TEXT(o), 1);
            ewl_container_child_append(EWL_CONTAINER(disp->page), o);
            ewl_widget_show(o);
        }

        if (item->desc) {
            o = ewl_text_new(item->desc);
            ewl_text_wrap_set(EWL_TEXT(o), 1);
            ewl_container_child_append(EWL_CONTAINER(disp->page), o);
            ewl_widget_show(o);
        }

        o = ewl_text_new(" ");
        ewl_container_child_append(EWL_CONTAINER(disp->page), o);
        ewl_widget_show(o);
    }
}
Beispiel #5
0
/**
 * keystroke accelerator for project window
 */
static EWL_CALLBACK_DEFN(project_key_down)
{
	Ecore_List *selected;
	Ewl_Event_Key_Down *ev = ev_data;
	Ewl_Widget *text, *row;
	char *name;

	if( !strcmp(ev->keyname, "Delete") ) {
		selected = ewl_tree_selected_get(EWL_TREE(file_tree));

		if( ecore_list_count(selected) > 0 ) {
			ecore_list_first_goto(selected);

			while( (row = ecore_list_next(selected)) ) {
				text = ewl_tree_row_column_get(EWL_ROW(row), 0);
				name = ewl_text_text_get(EWL_TEXT(text));
				ecore_hash_remove(active_project->files, name);
				FREE(name);
				active_project->dirty = true;
			}

			project_update();
		}
	}
}
int
ewl_io_manager_plugin_uri_write(Ewl_Widget *data, const char *uri)
{
        FILE *file;
        int ret = FALSE;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(data, FALSE);
        DCHECK_PARAM_PTR_RET(uri, FALSE);
        DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);

        file = fopen(uri, "w");
        if (file)
        {
                char *txt;

                txt = ewl_text_text_get(EWL_TEXT(data));
                fwrite(txt, sizeof(char), strlen(txt), file);

                FREE(txt);
                fclose(file);

                ret = TRUE;
        }

        DRETURN_INT(ret, DLEVEL_STABLE);
}
Beispiel #7
0
void cb_goto_key_down(Ewl_Widget *w, void *ev, void *data)
{
    Ewl_Widget *curwidget;
    char temp[50];
    Ewl_Event_Key_Down *e;
    e = (Ewl_Event_Key_Down*)ev;
    int k = translate_key(e);
    int page,totalpages;
    switch(k)
    {
    case K_RETURN:
        ewl_widget_hide(menu);
        totalpages=epdf_document_page_count_get(ewl_pdf_pdf_document_get(EWL_PDF(pdfwidget)));
        page=(int)strtol(ewl_text_text_get(EWL_TEXT(goto_entry)),NULL,10);
        sprintf(temp,"menuitem1");
        curwidget=ewl_widget_name_find(temp);
        ewl_menu_collapse(EWL_MENU(curwidget));
        if(page>0&&page<=totalpages)
            ewl_pdf_page_set(EWL_PDF(pdfwidget),page-1);
        break;
    case K_ESCAPE:
        sprintf(temp,"menuitem1");
        curwidget=ewl_widget_name_find(temp);
        ewl_menu_collapse(EWL_MENU(curwidget));
        ewl_widget_focus_send(menu);
        break;

    default:
        return;
    }
    
}
Ewl_Widget *
ewl_io_manager_plugin_string_read(const char *string)
{
        Ewl_Widget *ret = NULL;
        char *txt;

        DENTER_FUNCTION(DLEVEL_STABLE);

        if (!key1)
                setup_hash();

        ret = ewl_text_new();
        ewl_text_font_set(EWL_TEXT(ret), "ewl/monospace");
        txt = strdup(string);
        text_set(EWL_TEXT(ret), txt);
        free(txt);

        DRETURN_PTR(ret, DLEVEL_STABLE);
}
Beispiel #9
0
void mime_add_cb(Ewl_Widget *item, void *ev_data, void *user_data) {
	char *entries[3];
	char *type_text = ewl_text_text_get(EWL_TEXT(entry_type));
	char *action_text = ewl_text_text_get(EWL_TEXT(entry_action));
	
	
	entries[0] = type_text;
	entries[1] = action_text;
	entries[2] = NULL;

	ewl_tree_text_row_add(EWL_TREE(mime_tree), NULL,entries);
	entropy_core_mime_action_add(type_text, action_text);

	/*free(type_text);
	free(action_text);*/

	ewl_widget_destroy(EWL_WIDGET(user_data));
	
}
int
ewl_io_manager_plugin_string_write(Ewl_Widget *data, const char **string)
{
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(data, FALSE);
        DCHECK_TYPE_RET(data, EWL_TEXT_TYPE, FALSE);

        *string = ewl_text_text_get(EWL_TEXT(data));

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
Beispiel #11
0
static void
_function_display (Ewl_Widget *w, void *ev_data, void *user_data)
{
  Ecrin_Hash_Data      *data;
  Ecrin_Function       *function;
  Ecrin_Function_Param *param;
  char                  str[4096];
  char                  space[4096];
  
  data = (Ecrin_Hash_Data *)user_data;
  function = (Ecrin_Function *)data->data;

  ewl_text_text_set (EWL_TEXT (text), data->efl_name);
  ewl_text_text_append (EWL_TEXT (text), "\n");
  ewl_text_text_append (EWL_TEXT (text), "\n");

  snprintf (str, 4096, "%s %s (", function->return_type, function->name);
  ewl_text_text_append (EWL_TEXT (text), str);
  memset (space, ' ', 4096);
  space[strlen (str)] = '\0';
  ecore_list_first_goto (function->params);
  while ((param = ecore_list_next (function->params)))
    {
      if (ecore_list_index (function->params) != 1)
        ewl_text_text_append (EWL_TEXT (text), space);
      snprintf (str, 4096, "%s", param->type);
      ewl_text_text_append (EWL_TEXT (text), str);
      if (param->name)
        {
          snprintf (str, 4096, " %s", param->name);
          ewl_text_text_append (EWL_TEXT (text), str);
        }
      if (ecore_list_index (function->params) != ecore_list_count (function->params))
        {
          snprintf (str, 4096, ",\n");
          ewl_text_text_append (EWL_TEXT (text), str);
        }
      else
        {
          snprintf (str, 4096, ")\n");
          ewl_text_text_append (EWL_TEXT (text), str);
        }
    }
}
Beispiel #12
0
/**
 * @return Returns a new password widget on success, NULL on failure.
 * @brief Allocate and initialize a new password widget
 *
 * A password widget is an entry with a set obscure character. The default is a
 * star (*)
 */
Ewl_Widget *
ewl_password_new(void)
{
        Ewl_Widget *e;

        DENTER_FUNCTION(DLEVEL_STABLE);

        e = ewl_entry_new();
        ewl_widget_appearance_set(e, "password/"EWL_ENTRY_TYPE);
        ewl_text_obscure_set(EWL_TEXT(e), "*");

        DRETURN_PTR(e, DLEVEL_STABLE);
}
Beispiel #13
0
/**
 * callback for project options dialog
 */
static EWL_CALLBACK_DEFN(options_cb)
{
	int *response_id = ev_data;

	if( *response_id == EWL_RESPONSE_SAVE ) {
		IF_FREE(active_project->path);
		active_project->path =
			ewl_text_text_get(EWL_TEXT(active_project_options.path_entry));

		IF_FREE(active_project->name);
		active_project->name =
			ewl_text_text_get(EWL_TEXT(active_project_options.name_entry));

		IF_FREE(active_project->filename);
		active_project->filename =
			ewl_text_text_get(EWL_TEXT(active_project_options.filename_entry));

		active_project->dirty = true;
	}

	ewl_widget_destroy(options_win);
	options_win = NULL;
}
Beispiel #14
0
void ethpanel_set_eth(eth_panel* pnl, char* interface)
{
    char name[100];
    char *str;

    EXALT_ASSERT_RETURN_VOID(pnl!=NULL);
    EXALT_ASSERT_RETURN_VOID(interface!=NULL);
    sprintf(name,_("Network card: %s"),interface);

    EXALT_FREE(pnl->interface);
    pnl->interface = strdup(interface);

    ewl_border_label_set(EWL_BORDER(pnl->frame),name);
    str = exalt_dbus_eth_get_ip(exalt_conn,interface);
    ewl_text_text_set(EWL_TEXT(pnl->entry_ip),str);
    EXALT_FREE(str);

    str = exalt_dbus_eth_get_netmask(exalt_conn, interface);
    ewl_text_text_set(EWL_TEXT(pnl->entry_mask),str);
    EXALT_FREE(str);

    str = exalt_dbus_eth_get_gateway(exalt_conn, interface);
    ewl_text_text_set(EWL_TEXT(pnl->entry_gateway),str);
    EXALT_FREE(str);

    if(exalt_dbus_eth_is_dhcp(exalt_conn, interface))
        ewl_radiobutton_checked_set(EWL_RADIOBUTTON(pnl->check_dhcp), TRUE);
    else
        ewl_radiobutton_checked_set(EWL_RADIOBUTTON(pnl->check_static), TRUE);

    str = exalt_dbus_eth_get_cmd(exalt_conn, interface);

    ewl_text_text_set(EWL_TEXT(pnl->entry_cmd),str);
    EXALT_FREE(str);

    ethpanel_disabled_set(pnl);
}
Beispiel #15
0
static EWL_CALLBACK_DEFN(project_file_settings_cb)
{
	int *response = ev_data;
	char *name = user_data;
	char *new_name, *new_path;

	if( *response == EWL_RESPONSE_SAVE ) {
		Ewler_Form *form;

		new_name = ewl_text_text_get(EWL_TEXT(file_settings.name_entry));
		new_path = ewl_text_text_get(EWL_TEXT(file_settings.path_entry));

		if( (form = form_get(name)) )
			form_name_set(form, new_name);

		ecore_hash_remove(active_project->files, name);
		ecore_hash_set(active_project->files, new_name, new_path);

		project_update();
	}

	ewl_widget_destroy(settings_win);
	settings_win = NULL;
}
/*------------------------------*/
void
hover_icon_mouse_move_cb (Ewl_Widget * w, void *ev_data, void *user_data)
{
  entropy_gui_component_instance *instance = user_data;
  entropy_icon_viewer *viewer = instance->data;
  gui_file *local_file = ecore_hash_get (viewer->icon_hash, w);
  char buffer[1024];

  if (local_file->file && local_file->file->retrieved_stat) {
    snprintf (buffer, 1024, "File type: %s\nSize: %d kb",
	      local_file->file->mime_type,
	      (int) local_file->file->properties.st_size / 1024);
    ewl_text_text_set (EWL_TEXT (viewer->hover_properties), buffer);
  }


}
Beispiel #17
0
static void
help_reader_text_cb_enter(void *data, Eli_Help_Reader_Node *styles, size_t len)
{
    Help_Reader_Window * win = data;
    Ewl_Text * t = EWL_TEXT(win->text);
    size_t last = len - 1;

    if (styles[last].type == ELI_HELP_READER_NODE_PARAGRAPH)
    {
        ewl_text_font_size_set(t, 12);
        ewl_text_text_append(t, "\t");
    }
    if (styles[last].type == ELI_HELP_READER_NODE_HEADER)
    {
        ewl_text_font_size_set(t, 12);
        ewl_text_text_append(t, "\n");
    }
}
Beispiel #18
0
static void
help_reader_text_cb_leave(void *data, Eli_Help_Reader_Node *styles, size_t len)
{
    Help_Reader_Window *win = data;
    Ewl_Text *t = EWL_TEXT(win->text);
    size_t last = len - 1;

    switch (styles[last].type)
    {
    case ELI_HELP_READER_NODE_HEADER:
        ewl_text_text_append(t, "\n");
        ewl_text_font_size_set(t, 6);
        ewl_text_text_append(t, "\n");
        break;
    case ELI_HELP_READER_NODE_BLOCK:
    case ELI_HELP_READER_NODE_PARAGRAPH:
        ewl_text_text_append(t, "\n");
        break;
    default:
        break;
    }
}
Beispiel #19
0
void cb_menu_key_down(Ewl_Widget *w, void *ev, void *data)
{
    Ewl_Widget *curwidget;
    char temp[50];
    Ewl_Event_Key_Down *e;
    e = (Ewl_Event_Key_Down*)ev;
    int k = translate_key(e);
    
    switch(k)
    {
    case 1:
        sprintf(temp,"menuitem1");
        curwidget=ewl_widget_name_find(temp);
        ewl_menu_cb_expand(curwidget,NULL,NULL);
        ewl_widget_focus_send(EWL_WIDGET(EWL_MENU(curwidget)->popup));
        int curpage=ewl_pdf_page_get(EWL_PDF(pdfwidget))+1;
        //sprintf(temp,"%d",curpage);
        ewl_text_text_set(EWL_TEXT(goto_entry),"");
        ewl_widget_focus_send(goto_entry);
        break;
    case 2:
        /*ewl_widget_hide(menu);
        opt_dlg_init();    
        ewl_window_transient_for(EWL_WINDOW(opt_dlg_widget_get()),EWL_WINDOW(win));
        ewl_widget_show(opt_dlg_widget_get());
        ewl_widget_focus_send(opt_dlg_widget_get());*/
        ewl_widget_hide(menu);
        OptionsDialog();
        
        break;
    case K_ESCAPE:
        ewl_widget_hide(menu);
        break;
    default:
        return;
    }
    
}
Beispiel #20
0
static void
_list_display_cb (Ewl_Widget *w, void *ev_data, void *user_data)
{
  Ewl_Row *row;
  char    *aiguille;

  aiguille = ewl_text_text_get (EWL_TEXT (w));

  /* We clear the list */
  ecore_list_first_goto(list_rows);
  while ((row = ecore_list_next(list_rows)))
    {
      ewl_tree_row_destroy (EWL_TREE (list), row);
    }

  ecrin_ewl_list_fill_package (aiguille);

/*   ecore_list_first_goto(list_rows); */
/*   while ((row = ecore_list_next(list_rows))) */
/*     { */
/*       Ewl_Widget *child; */
/*       char       *motte; */

/*       ewl_container_child_iterate_begin (EWL_CONTAINER (row)); */
/*       child = ewl_container_child_next (EWL_CONTAINER (row)); */
/*       child = ewl_container_child_next (EWL_CONTAINER (child)); */
/*       motte = ewl_text_text_get (EWL_TEXT (child)); */

/*       printf ("motte : %s\n", motte); */

/*       if (strstr (motte, aiguille)) */
/*         ewl_widget_show (EWL_WIDGET (row)); */
/*       else */
/*         ewl_widget_hide (EWL_WIDGET (row)); */
/*     } */
}
Beispiel #21
0
static void
_define_display (Ewl_Widget *w, void *ev_data, void *user_data)
{
  Ecrin_Hash_Data *data;
  Ecrin_Define    *define;
  char             str[4096];
  char            *p;
  char            *iter;
  
  data = (Ecrin_Hash_Data *)user_data;
  define = (Ecrin_Define *)data->data;

  ewl_text_text_set (EWL_TEXT (text), data->efl_name);
  ewl_text_text_append (EWL_TEXT (text), "\n");
  ewl_text_text_append (EWL_TEXT (text), "\n");

  snprintf (str, 4096, "#define %s", define->name);
  ewl_text_text_append (EWL_TEXT (text), str);
  iter = define->value;
  if (define->value)
    {
      while ((p = strchr (iter, '\\')) != NULL)
        {
          char *string;
          int   l;
          
          l = p - iter;
          string = strndup (iter, l);
          snprintf (str, 4096, " %s\n", string);
          ewl_text_text_append (EWL_TEXT (text), str);
          free (string);
          iter = p + 1;
        } 
    }
  snprintf (str, 4096, " %s\n", iter);
  ewl_text_text_append (EWL_TEXT (text), str);
  remove_description (define->value);
}
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

}
Beispiel #23
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);
}
Beispiel #24
0
static EWL_CALLBACK_DEFN(entry_value_changed)
{
	Ewler_Widget_Elem *elem = user_data;
	char *text;

	text = ewl_text_text_get(EWL_TEXT(elem->entry));

	if( !text )
		return;

	switch( elem->spec->type ) {
		case EWLER_SPEC_ELEM_INT:
			elem->info.ivalue = strtol(text, NULL, 0);
			IF_FREE(text);

			if( !elem->changed ) {
				Ewl_Widget *parent;
				char *label = ewl_text_text_get(EWL_TEXT(elem->text));

				parent = elem->text->parent;
				ewl_widget_destroy(elem->text);

				elem->text = ewl_text_new("");
				ewl_text_color_set(EWL_TEXT(elem->text), 255, 0, 0, 255);
				ewl_text_text_append(EWL_TEXT(elem->text), label);
				ewl_container_child_append(EWL_CONTAINER(parent), elem->text);
				ewl_widget_show(elem->text);
				FREE(label);
			}

			elem->changed = true;
			if( elem->spec->set_func )
				elem->spec->set_func(elem->w->w, elem->info.ivalue);
			break;
		case EWLER_SPEC_ELEM_STRING:
			if( elem->spec == name_spec ) {
				if( ewl_widget_name_find(text) ) {
					ewler_error("A widget already exists with the name %s", text);
					FREE(text);
					ewl_text_text_set(EWL_TEXT(elem->entry), elem->info.svalue);
					return;
				}

				form_rename_widget(elem->info.svalue, text);
			}

			elem->info.svalue = text;

			if( !elem->changed ) {
				int len;

				len = ewl_text_length_get(EWL_TEXT(elem->text));
				ewl_text_cursor_position_set(EWL_TEXT(elem->text), 0);
				ewl_text_color_apply(EWL_TEXT(elem->text), 255, 0, 0, 255, len);
			}

			elem->changed = true;
			if( elem->spec->set_func )
				elem->spec->set_func(elem->w->w, elem->info.svalue);
			break;
		default: break;
	}
}
Beispiel #25
0
static int
create_test(Ewl_Container *box)
{
        Ewl_Widget *o, *o2, *hbox;

        hbox = ewl_hbox_new();
        ewl_container_child_append(box, hbox);
        ewl_widget_show(hbox);

        o = ewl_icon_new();
        ewl_box_orientation_set(EWL_BOX(o), EWL_ORIENTATION_HORIZONTAL);
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Draw");
        ewl_container_child_append(EWL_CONTAINER(hbox), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Fill None");
        ewl_container_child_append(EWL_CONTAINER(hbox), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Draw");
        ewl_container_child_append(EWL_CONTAINER(hbox), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "Draw (Editable)");
        ewl_icon_editable_set(EWL_ICON(o), TRUE);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o2 = ewl_text_new();
        ewl_text_text_set(EWL_TEXT(o2), "This icon has\nextended data\n set "
                                        "on it.\n\n That data is just \n"
                                        "text, but could\nbe any widget.");
        ewl_widget_show(o2);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_extended_data_set(EWL_ICON(o), o2);
        ewl_icon_label_set(EWL_ICON(o), "World");
        ewl_icon_type_set(EWL_ICON(o), EWL_ICON_TYPE_LONG);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
        ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_image_set(EWL_ICON(o), ewl_test_image_get("Draw.png"), NULL);
        ewl_icon_label_set(EWL_ICON(o), "This is a long title that is compressed.");
        ewl_icon_label_compressed_set(EWL_ICON(o), TRUE);
        ewl_icon_editable_set(EWL_ICON(o), TRUE);
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_hseparator_new();
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        o = ewl_icon_new();
        ewl_icon_alt_text_set(EWL_ICON(o), "Icon Alt Text");
        ewl_container_child_append(EWL_CONTAINER(box), o);
        ewl_widget_show(o);

        return 1;
}
Beispiel #26
0
static void
help_reader_window_page_set(Help_Reader_Window *win, const char * page, int history)
{
    Ewl_Widget * t;
    char buffer[4096];
    char * lang;
    char * ptr;

    /* clean the text */
    t = win->text;
    ewl_text_clear(EWL_TEXT(t));
    ewl_container_reset(EWL_CONTAINER(t));
    ewl_text_wrap_set(EWL_TEXT(t), EWL_TEXT_WRAP_WORD);

    /* add the page to the history */
    if (history)
        help_reader_window_history_add(win, page);

    /*
     * Determine the locale we will use
     */
    lang = setlocale(LC_MESSAGES, NULL);
    /* remove the encoding, we only support utf-8 */
    ptr = strchr(lang, '.');
    if (ptr)
        *ptr = 0;
    ptr = strchr(lang, '-');
    if (ptr)
        *ptr = 0;

    /*
     * create the path
     */
    snprintf(buffer, sizeof(buffer), "%s/%s-%s.ehf", help_reader_dir, lang,
             page);
    if (ecore_file_exists(buffer))
        goto PARSE;

    /* try only with the language */
    ptr = strchr(lang, '_');
    if (ptr)
        *ptr = 0;

    snprintf(buffer, sizeof(buffer), "%s/%s-%s.ehf", help_reader_dir, lang,
             page);
    if (ecore_file_exists(buffer))
        goto PARSE;

    /* still doesn't work?, try it with the English page */
    snprintf(buffer, sizeof(buffer), "%s/en-%s.ehf", help_reader_dir, page);
    if (ecore_file_exists(buffer))
        goto PARSE;

    //help_reader_text_page_not_found(t);
    return;

PARSE:
    eli_help_reader_parse(buffer, help_reader_text_cb_enter,
                          help_reader_text_cb_append,
                          help_reader_text_cb_leave,
                          win);
}
Beispiel #27
0
/**
 * @param e: The Ewl_Entry to initialize
 * @return Returns TRUE on success or FALSE on failure
 * @brief Initializes an Ewl_Entry widget to default values
 */
int
ewl_entry_init(Ewl_Entry *e)
{
        const char *text_types[] = { "UTF8_STRING", "text/plain", NULL };
        Ewl_Widget *w;

        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET(e, FALSE);

        w = EWL_WIDGET(e);

        if (!ewl_text_init(EWL_TEXT(e)))
                DRETURN_INT(FALSE, DLEVEL_STABLE);

        ewl_widget_inherit(w, EWL_ENTRY_TYPE);
        ewl_widget_appearance_set(w, EWL_ENTRY_TYPE);
        ewl_widget_focusable_set(EWL_WIDGET(e), TRUE);

        ewl_object_fill_policy_set(EWL_OBJECT(e), EWL_FLAG_FILL_HSHRINK |
                                                  EWL_FLAG_FILL_HFILL);

        ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_FOCUS_IN);
        ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_FOCUS_OUT);
        ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_DND_POSITION);
        ewl_container_callback_intercept(EWL_CONTAINER(w), EWL_CALLBACK_DND_DATA_RECEIVED);

        /* setup the cursor */
        e->cursor = ewl_entry_cursor_new(e);
        ewl_container_child_append(EWL_CONTAINER(e), e->cursor);
        ewl_widget_internal_set(e->cursor, TRUE);
        ewl_object_fill_policy_set(EWL_OBJECT(e->cursor), EWL_FLAG_FILL_VFILL);

        /* Set the pointer */
        ewl_attach_mouse_cursor_set(EWL_WIDGET(e), EWL_MOUSE_CURSOR_XTERM);

        /* this has to be called after the cursor is created as it will try
         * to show the cursor */
        ewl_entry_multiline_set(e, FALSE);
        ewl_entry_editable_set(e, TRUE);
        ewl_text_selectable_set(EWL_TEXT(e), TRUE);
        ewl_dnd_accepted_types_set(EWL_WIDGET(e), text_types);

        /* setup callbacks */
        ewl_callback_append(w, EWL_CALLBACK_FOCUS_IN,
                                ewl_entry_cb_focus_in, NULL);
        ewl_callback_append(w, EWL_CALLBACK_FOCUS_OUT,
                                ewl_entry_cb_focus_out, NULL);
        ewl_callback_prepend(w, EWL_CALLBACK_CONFIGURE,
                                ewl_entry_cb_configure, NULL);
        ewl_callback_append(w, EWL_CALLBACK_MOUSE_DOWN,
                                ewl_entry_cb_mouse_down, NULL);
        ewl_callback_append(w, EWL_CALLBACK_MOUSE_UP,
                                ewl_entry_cb_mouse_up, NULL);
        ewl_callback_append(w, EWL_CALLBACK_WIDGET_DISABLE,
                                ewl_entry_cb_disable, NULL);
        ewl_callback_append(w, EWL_CALLBACK_WIDGET_ENABLE,
                                ewl_entry_cb_enable, NULL);
        ewl_callback_append(w, EWL_CALLBACK_DND_POSITION,
                                ewl_entry_cb_dnd_position, NULL);
        ewl_callback_append(w, EWL_CALLBACK_DND_DATA_RECEIVED,
                                ewl_entry_cb_dnd_data, NULL);

        DRETURN_INT(TRUE, DLEVEL_STABLE);
}
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;
}
void ewl_frontend_dialog_config_open(Eli_App * eap)
{
    Ewl_Widget * o;
    Ewl_Widget * border_box;
    Ewl_Widget * hbox;
    Ewl_Widget * vbox;
    Ewl_Widget * main_box;
    Ewl_Widget * radio_b[2];

    /* one open config dialog should be enough */
    if (conf_win) return;
    /* Setup and show the configuration window */
    conf_win = ewl_dialog_new();
    ewl_dialog_action_position_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);
    ewl_window_title_set(EWL_WINDOW(conf_win), _("Configuration"));
    ewl_window_name_set(EWL_WINDOW(conf_win), "Elitaire");
    ewl_window_class_set(EWL_WINDOW(conf_win), "Elitaire");
    ewl_window_leader_foreign_set(EWL_WINDOW(conf_win),
		    		EWL_EMBED_WINDOW(eap->main_win));
    ewl_callback_append(conf_win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb,
                        NULL);
    ewl_dialog_has_separator_set(EWL_DIALOG(conf_win), 1);
    ewl_object_fill_policy_set(EWL_OBJECT(conf_win), EWL_FLAG_FILL_NONE);
    ewl_widget_show(conf_win);
    
    /* the main_box contain the border_boxes */
    ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_TOP);
    main_box = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(conf_win), main_box);
    ewl_object_fill_policy_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_CENTER);
    ewl_widget_show(main_box);

    /* Setup and show the stock icons */
    ewl_dialog_active_area_set(EWL_DIALOG(conf_win), EWL_POSITION_BOTTOM);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_CANCEL);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_APPLY);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    o = ewl_button_new();
    ewl_stock_type_set(EWL_STOCK(o), EWL_STOCK_OK);
    ewl_container_child_append(EWL_CONTAINER(conf_win), o);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, conf_win_clicked_cb,
                        conf_win);
    ewl_widget_show(o);

    /* *** Graphic Box *** */
    /* Setup and show the border box */
    border_box = ewl_border_new();
    ewl_border_label_set(EWL_BORDER(border_box), _("Graphic"));
    ewl_container_child_append(EWL_CONTAINER(main_box), border_box);
    //ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_HFILL);
    ewl_widget_show(border_box);

    /* Setup and show the checkbuttons */
    o = ewl_checkbutton_new();
    ewl_button_label_set(EWL_BUTTON(o), _("animated movements"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    config.animations = ecore_config_boolean_get("/graphic/animations");
    ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.animations);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL);

    o = ewl_checkbutton_new();
    ewl_button_label_set(EWL_BUTTON(o), _("shadows"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    config.shadows = ecore_config_boolean_get("/graphic/shadows");
    ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(o), config.shadows);
    ewl_callback_append(o, EWL_CALLBACK_CLICKED, _check_selected, NULL);

    /* Setup and show the velocity label and seeker */
    hbox = ewl_grid_new();
    ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
    ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_FILL);
    ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
    ewl_widget_show(hbox);

    o = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(o), _("velocity:"));
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);

    o = ewl_label_new();
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_widget_show(o);
    config.vel_label = o;

    o = ewl_hseeker_new();
    config.velocity = ecore_config_int_get("velocity");
    ewl_range_minimum_value_set(EWL_RANGE(o), 200.0);
    ewl_range_maximum_value_set(EWL_RANGE(o), 800.0);
    ewl_range_step_set(EWL_RANGE(o), 60.0);
    ewl_range_value_set(EWL_RANGE(o), (double) config.velocity);
    ewl_widget_name_set(o, "velocity");
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL);
                          _hseeker_cb(o, NULL, NULL);
    ewl_widget_show(o);

    /* Setup and show the frame_rate label and seeker */
    hbox = ewl_grid_new();
    ewl_container_child_append(EWL_CONTAINER(border_box), hbox);
    ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);
    ewl_grid_column_preferred_w_use(EWL_GRID(hbox), 1);
    ewl_widget_show(hbox);

    o = ewl_label_new();
    ewl_label_text_set(EWL_LABEL(o), _("frame rate:"));
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_object_alignment_set(EWL_OBJECT(o), EWL_FLAG_ALIGN_LEFT);
    ewl_widget_show(o);
    
    o = ewl_label_new();
    ewl_container_child_append(EWL_CONTAINER(hbox), o);
    ewl_object_fill_policy_set(EWL_OBJECT(o), EWL_FLAG_FILL_NONE);
    ewl_widget_show(o);
    config.frt_label = o;

    o = ewl_hseeker_new();
    config.frame_rate = ecore_config_int_get("frame_rate");
    ewl_range_minimum_value_set(EWL_RANGE(o), 10.0);
    ewl_range_maximum_value_set(EWL_RANGE(o), 100.0);
    ewl_range_step_set(EWL_RANGE(o), 10.0);
    ewl_range_value_set(EWL_RANGE(o), (double) config.frame_rate);
    ewl_widget_name_set(o, "frame_rate");
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_callback_append(o, EWL_CALLBACK_VALUE_CHANGED, _hseeker_cb, NULL);
    _hseeker_cb(o, NULL, NULL);
    ewl_widget_show(o);

    /* *** Lazy Box *** */
    vbox = ewl_vbox_new();
    ewl_container_child_append(EWL_CONTAINER(main_box), vbox);
    ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_NORMAL);
    ewl_widget_show(vbox);

    border_box = ewl_border_new();
    ewl_container_child_append(EWL_CONTAINER(vbox), border_box);
    ewl_border_label_set(EWL_BORDER(border_box), _("Laziness"));
    ewl_widget_show(border_box);
    /* the radio buttons */
    config.lazy = ecore_config_int_get("lazy");
    radio_b[0] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("normal mode"));
    ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT);
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]);
    ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[0]);

    radio_b[1] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("lazy mode"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT);
    ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]),
                              EWL_RADIOBUTTON(radio_b[0]));
    ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[1]);
    if (config.lazy)
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1);
    else
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1);

    /* *** Render Box *** */
    /* Setup and show the border box */
    border_box = ewl_border_new();
    ewl_border_label_set(EWL_BORDER(border_box), _("Render Engine"));
    ewl_container_child_append(EWL_CONTAINER(vbox), border_box);
    ewl_object_fill_policy_set(EWL_OBJECT(border_box), EWL_FLAG_FILL_FILL);
    ewl_object_alignment_set(EWL_OBJECT(border_box), EWL_FLAG_ALIGN_CENTER);
    ewl_object_alignment_set(EWL_OBJECT(main_box), EWL_FLAG_ALIGN_TOP);
    ewl_widget_show(border_box);

    o = ewl_text_new();
    ewl_text_text_set(EWL_TEXT(o), _("Changes only affect after new start"));
    ewl_container_child_append(EWL_CONTAINER(border_box), o);
    ewl_widget_show(o);

    /* the radio buttons */
    config.gl = ecore_config_boolean_get("/graphic/gl");
    radio_b[0] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[0]), _("Software"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[0]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[0]), EWL_FLAG_ALIGN_LEFT);
    ewl_callback_append(radio_b[0], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[0]);

    radio_b[1] = ewl_radiobutton_new();
    ewl_button_label_set(EWL_BUTTON(radio_b[1]), _("OpenGL (testing)"));
    ewl_container_child_append(EWL_CONTAINER(border_box), radio_b[1]);
    ewl_object_alignment_set(EWL_OBJECT(radio_b[1]), EWL_FLAG_ALIGN_LEFT);
    ewl_radiobutton_chain_set(EWL_RADIOBUTTON(radio_b[1]),
                              EWL_RADIOBUTTON(radio_b[0]));
    ewl_callback_append(radio_b[1], EWL_CALLBACK_CLICKED, _check_selected,
                        NULL);
    ewl_widget_show(radio_b[1]);
    if (config.gl)
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[1]), 1);
    else
        ewl_togglebutton_checked_set(EWL_TOGGLEBUTTON(radio_b[0]), 1);

}
Beispiel #30
0
void mime_add_dialog_show(char* type, char* exe) {
	Ewl_Widget* layout_box = ewl_vbox_new();
	Ewl_Widget* window = ewl_window_new();
	Ewl_Widget* hbox;
	
	Ewl_Widget* label;
	Ewl_Widget* button;
	
	ewl_widget_show(layout_box);
	ewl_object_minimum_size_set(EWL_OBJECT(window), 400, 150);
	ewl_container_child_append(EWL_CONTAINER(window), layout_box);


	/*---*/
	hbox = ewl_hbox_new();
	ewl_widget_show(hbox);
	ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);

	label = ewl_label_new();
	ewl_label_text_set(EWL_LABEL(label), "MIME Type");
	ewl_widget_show(label);
	ewl_container_child_append(EWL_CONTAINER(hbox), label);

	entry_type = ewl_entry_new();
	if (type) ewl_text_text_set(EWL_TEXT(entry_type), type);
	ewl_container_child_append(EWL_CONTAINER(hbox), entry_type);
	ewl_widget_show(entry_type);
	/*---*/

	/*---*/
	hbox = ewl_hbox_new();
	ewl_widget_show(hbox);
	ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);

	label = ewl_label_new();
	ewl_label_text_set(EWL_LABEL(label), "Action");
	ewl_widget_show(label);
	ewl_container_child_append(EWL_CONTAINER(hbox), label);

	entry_action = ewl_entry_new();
	if (exe) ewl_text_text_set(EWL_TEXT(entry_action), exe);	
	ewl_container_child_append(EWL_CONTAINER(hbox), entry_action);
	ewl_widget_show(entry_action);
	/*---*/

	
	hbox = ewl_hbox_new();
	ewl_widget_show(hbox);
	ewl_container_child_append(EWL_CONTAINER(layout_box), hbox);

	button = ewl_button_new();
	ewl_button_label_set(EWL_BUTTON(button), "Add");
	ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, mime_add_cb, window);
	ewl_container_child_append(EWL_CONTAINER(hbox), button);
	ewl_widget_show(button);

	button = ewl_button_new();
	ewl_button_label_set(EWL_BUTTON(button), "Cancel");
	ewl_object_maximum_h_set(EWL_OBJECT(button), 15);
	ewl_callback_append(button, EWL_CALLBACK_CLICKED, window_dismiss_cb, window);
	ewl_container_child_append(EWL_CONTAINER(hbox), button);
	ewl_widget_show(button);

	ewl_widget_show(window);
}