Пример #1
0
/* Called when the iconbox is pressed by the mouse */
static Etk_Bool _etk_test_iconbox_mouse_down_cb(Etk_Object *object, Etk_Event_Mouse_Up *event, void *data)
{
   Etk_Iconbox *iconbox;
   Etk_Iconbox_Icon *icon;
   Etk_String *new_folder;
   char *parent;

   if (!(iconbox = ETK_ICONBOX(object)))
      return ETK_TRUE;
   if (event->button != 1 || !(event->flags & ETK_MOUSE_DOUBLE_CLICK) || (event->flags & ETK_MOUSE_TRIPLE_CLICK))
      return ETK_TRUE;
   if (!(icon = etk_iconbox_icon_get_at_xy(iconbox, event->canvas.x, event->canvas.y, ETK_FALSE, ETK_TRUE, ETK_TRUE)))
      return ETK_TRUE;

   if (!strcmp(etk_iconbox_icon_label_get(icon), ".."))
   {
      parent = ecore_file_dir_get(etk_string_get(_etk_test_iconbox_current_folder));
      _etk_test_iconbox_folder_set(iconbox, parent);
      free(parent);
   }
   else
   {
      if (etk_string_length_get(_etk_test_iconbox_current_folder) == 1)
         new_folder = etk_string_new_printf("/%s", etk_iconbox_icon_label_get(icon));
      else
         new_folder = etk_string_new_printf("%s/%s", etk_string_get(_etk_test_iconbox_current_folder),
                                            etk_iconbox_icon_label_get(icon));
      _etk_test_iconbox_folder_set(iconbox, etk_string_get(new_folder));
      etk_object_destroy(ETK_OBJECT(new_folder));
   }
   
   return ETK_TRUE;
}
Пример #2
0
void etk_entropy_delete_dialog_cb(Etk_Object* w, void* user_data)
{
	Etk_Widget* window = NULL;
	int result = (int)user_data;
	entropy_generic_file* file;
	Ecore_List* files;
	entropy_gui_component_instance* instance;
	
	window = etk_object_data_get(ETK_OBJECT(w), "window");
	files= etk_object_data_get(ETK_OBJECT(window), "files");
	instance = etk_object_data_get(ETK_OBJECT(window), "instance");

	switch (result) {
		case ENTROPY_USER_INTERACTION_RESPONSE_YES: {
			ecore_list_first_goto(files);
			while ((file = ecore_list_first_remove(files))) {
				entropy_plugin_filesystem_file_remove(file, instance);
			}
		}
		break;

		case ENTROPY_USER_INTERACTION_RESPONSE_NO: {
		}
		break;
		
		default: break;
	}

	ecore_list_destroy(files);
	etk_object_destroy(ETK_OBJECT(window));
}
Пример #3
0
Etk_Bool mainWindow_close(Etk_Object *object, void *data)
{/*{{{*/
	exalt_eth_ethernets_free();
	main_window* win = (main_window*)data;
	etk_object_destroy(ETK_OBJECT(win->win));
	exit(1);
}/*}}}*/
void etk_directory_add_dialog_cancel_cb(Etk_Object* w, void* user_data) 
{
	etk_directory_add_dialog* dialog = user_data;

	etk_object_destroy(ETK_OBJECT(dialog->window));
	free(dialog);
}
Пример #5
0
void 
_ex_file_download_complete_cb(void *data, const char *file, int status)
{
   _ex_main_itree_add(file, file);
   etk_object_destroy(ETK_OBJECT(dialog));
   E_FREE(data);
   D(("Download of file %s is done\n", file));
}
static Etk_Bool
_etk_file_cache_debug_dialog_delete_cb (Etk_Object * object, void *data)
{
	_etk_file_cache_dialog_running = 0;
	etk_object_destroy(object);

	return ETK_TRUE;
}
Пример #7
0
static Etk_Bool
_etk_window_deleted_cb (Etk_Object * object, void *data)
{
  entropy_gui_component_instance* instance = data;
	
  entropy_core_component_event_deregister (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_PROGRESS));

  entropy_core_component_event_deregister (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_USER_INTERACTION_YES_NO_ABORT));

  entropy_core_component_event_deregister (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_EXTENDED_STAT));

  entropy_core_component_event_deregister (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT));
  entropy_core_component_event_deregister (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_FILE_STAT_AVAILABLE));

  entropy_core_component_event_deregister (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_METADATA_GROUPS));

  entropy_core_component_event_deregister (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_PASTE_REQUEST));

  entropy_core_component_event_deregister (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_AUTH_REQUEST));

  entropy_core_component_event_deregister (instance,
					 entropy_core_gui_event_get
					 (ENTROPY_GUI_EVENT_META_ALL_REQUEST));

  /*Deregister this layout*/
  entropy_core_layout_deregister(instance->core, instance);


  /*TODO: Destroy plugin children, and layout*/

  /*Decrement window reference counter*/
  _etk_layout_window_count--;
  
  etk_object_destroy(ETK_OBJECT(instance->gui_object));
  
  if (_etk_layout_window_count == 0) {
	  layout_etk_simple_quit(instance->core);
  }

  return ETK_TRUE;
}
Пример #8
0
void etk_entropy_user_interaction_dialog_cb(Etk_Object* w, void* user_data)
{
	long id = (long)etk_object_data_get(ETK_OBJECT(w),"operation");
	Etk_Widget* window = NULL;
	
        entropy_plugin_operation_respond( id, (int)user_data );

	window = etk_object_data_get(ETK_OBJECT(w), "window");
	etk_object_destroy(ETK_OBJECT(window));
}
Пример #9
0
Etk_Bool mainWindow_free(main_window** win)
{/*{{{*/
	if(win && *win)
	{
		etk_object_destroy(ETK_OBJECT((*win)->win));
		win = NULL;
		return 1;
	}
	else
		return 0;
}/*}}}*/
void etk_directory_add_dialog_create_cb(Etk_Object* w, void* user_data) 
{
	etk_directory_add_dialog* dialog = user_data;
	const char* child;

	child = etk_entry_text_get(ETK_ENTRY(dialog->entry));
	if (child && child[0] != 0) {
		entropy_plugin_filesystem_directory_create(dialog->parent, child);
	}

	etk_object_destroy(ETK_OBJECT(dialog->window));
	free(dialog);	
}
Пример #11
0
static void
_ex_file_download_dialog_response(Etk_Object *obj, int response_id, void *data)
{
   switch(response_id)
     {
      case ETK_RESPONSE_CANCEL:
	 ecore_file_download_abort_all();
	 ecore_file_unlink(data);
	 E_FREE(data);
	 etk_object_destroy(ETK_OBJECT(obj));
	 break;
      default:
	 break;
     }
}
Пример #12
0
/**
 * @brief Sets the toolbar's orientation (horizontal or vertical)
 * @param toolbar a toolbar
 * @param orientation the orientation to set
 */
void etk_toolbar_orientation_set(Etk_Toolbar *toolbar, Etk_Toolbar_Orientation orientation)
{
   Eina_List *children, *l;
   Etk_Widget *prev_box;

   if (!toolbar || toolbar->orientation == orientation)
      return;

   toolbar->reorientating = ETK_TRUE;
   prev_box = toolbar->box;
   toolbar->orientation = orientation;
   if (toolbar->orientation == ETK_TOOLBAR_VERT)
      toolbar->box = etk_vbox_new(ETK_FALSE, 0);
   else
      toolbar->box = etk_hbox_new(ETK_FALSE, 0);
   etk_widget_internal_set(toolbar->box, ETK_TRUE);
   etk_widget_show(toolbar->box);

   etk_signal_connect_by_code(ETK_CONTAINER_CHILD_ADDED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_added_cb), toolbar);
   etk_signal_connect_by_code(ETK_CONTAINER_CHILD_REMOVED_SIGNAL, ETK_OBJECT(toolbar->box), ETK_CALLBACK(_etk_toolbar_child_removed_cb), NULL);


   children = etk_container_children_get(ETK_CONTAINER(prev_box));
   for (l = children; l; l = l->next)
      etk_toolbar_append(toolbar, ETK_WIDGET(l->data), ETK_BOX_START);
   eina_list_free(children);
   etk_object_destroy(ETK_OBJECT(prev_box));

   if (toolbar->orientation == ETK_TOOLBAR_VERT)
      etk_widget_theme_group_set(ETK_WIDGET(toolbar), "vtoolbar");
   else
      etk_widget_theme_group_set(ETK_WIDGET(toolbar), "htoolbar");
   etk_widget_parent_set(toolbar->box, ETK_WIDGET(toolbar));

   toolbar->reorientating = ETK_FALSE;
   etk_object_notify(ETK_OBJECT(toolbar), "orientation");
}
Пример #13
0
void evolve_gui_general_table_populate(Evolve_Widget *widget)
{
   Etk_Widget *label;
   Etk_Widget *entry;
   Etk_Type *type;
   Eina_List *l, *list = NULL;
   char *str;
   int i = 2;
   
   if (!widget || !widget->type || !(type = evolve_widget_type_to_etk(widget->type)))
     return;

   etk_type_property_list(type, &list);
   
   etk_table_resize(ETK_TABLE(_evolve_gui_gen_table), 0, 0);
   etk_table_resize(ETK_TABLE(_evolve_gui_gen_table), 2, eina_list_count(list) + 2);
   
   label = etk_label_new("Class:");
   entry = etk_entry_new();
   etk_entry_text_set(ETK_ENTRY(entry), type->name);
   etk_widget_disabled_set(entry, ETK_TRUE);   
   etk_table_attach_default(ETK_TABLE(_evolve_gui_gen_table), label,
			    0, 0, 0, 0);
   etk_table_attach_default(ETK_TABLE(_evolve_gui_gen_table), entry,
			    1, 1, 0, 0);
   
   label = etk_label_new("Name:");
   entry = etk_entry_new();
   etk_entry_text_set(ETK_ENTRY(entry), widget->name);
   etk_table_attach_default(ETK_TABLE(_evolve_gui_gen_table), label,
			    0, 0, 1, 1);
   etk_table_attach_default(ETK_TABLE(_evolve_gui_gen_table), entry,
			    1, 1, 1, 1);   

   for (l = list; l; l = l->next)
     {
	Evolve_Property *prop;
	Evolve_Property *eprop;
	Evolve_Property *p;
	Etk_String *value;
	Etk_Widget *vwidget;
	
	if (!(prop = l->data))
	  continue;
	
	str = evolve_util_string_humanize(prop->name);	
	label = etk_label_new(str);
	free(str);
	
	eprop = evolve_widget_property_get(widget, prop->name);
	if (eprop && eprop->default_value)	  
	  p = eprop;	  
	else
	  p = prop;
	
	switch(prop->type)
	  {
	   case EVOLVE_PROPERTY_INT:
	     value = etk_string_new_printf("%d", evolve_property_value_int_get(p->default_value));
	     vwidget = etk_spinner_new(0, 9999, evolve_property_value_int_get(p->default_value), 1, 10);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "prop", p, NULL);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "widget", widget, NULL);
	     etk_signal_connect("value-changed", ETK_OBJECT(vwidget),
				ETK_CALLBACK(evolve_gui_property_spinner_value_changed_cb),
				NULL);
	     break;
	   case EVOLVE_PROPERTY_BOOL:
	     value = etk_string_new_printf("%d", evolve_property_value_bool_get(p->default_value));
	     vwidget = etk_combobox_new_default();
	       {
		  Etk_Combobox_Item *item;
		  
		  item = etk_combobox_item_append(ETK_COMBOBOX(vwidget), "True");
		  if (evolve_property_value_bool_get(p->default_value))
		    etk_combobox_active_item_set(ETK_COMBOBOX(vwidget), item);
		  item = etk_combobox_item_append(ETK_COMBOBOX(vwidget), "False");
		  if (!evolve_property_value_bool_get(p->default_value))
		    etk_combobox_active_item_set(ETK_COMBOBOX(vwidget), item);		  
	       }
	     break;
	   case EVOLVE_PROPERTY_CHAR:
	     value = etk_string_new_printf("%c", evolve_property_value_char_get(p->default_value));
	     vwidget = etk_entry_new();
	     etk_entry_text_set(ETK_ENTRY(vwidget), etk_string_get(value));
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "prop", p, NULL);
	     etk_signal_connect("text-changed", ETK_OBJECT(vwidget),
				ETK_CALLBACK(evolve_gui_property_entry_text_changed_cb),
				widget);
	     break;		  
	   case EVOLVE_PROPERTY_FLOAT:
	     value = etk_string_new_printf("%f", evolve_property_value_float_get(p->default_value));
	     vwidget = etk_spinner_new(0.0, 9999.0, evolve_property_value_float_get(p->default_value), 0.1, 1.0);
	     etk_spinner_digits_set(ETK_SPINNER(vwidget), 1);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "prop", p, NULL);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "widget", widget, NULL);
	     etk_signal_connect("value-changed", ETK_OBJECT(vwidget),
				ETK_CALLBACK(evolve_gui_property_spinner_value_changed_cb),
				NULL);
	     break;
	   case EVOLVE_PROPERTY_DOUBLE:
	     value = etk_string_new_printf("%g", evolve_property_value_double_get(p->default_value));
	     vwidget = etk_spinner_new(0.0, 9999.0, evolve_property_value_double_get(p->default_value), 0.1, 1.0);
	     etk_spinner_digits_set(ETK_SPINNER(vwidget), 1);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "prop", p, NULL);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "widget", widget, NULL);
	     etk_signal_connect("value-changed", ETK_OBJECT(vwidget),
				ETK_CALLBACK(evolve_gui_property_spinner_value_changed_cb),
				NULL);
	     break;
	   case EVOLVE_PROPERTY_SHORT:
	     value = etk_string_new_printf("%d", evolve_property_value_short_get(p->default_value));
	     vwidget = etk_spinner_new(0, 9999, evolve_property_value_short_get(p->default_value), 1, 10);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "prop", p, NULL);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "widget", widget, NULL);
	     etk_signal_connect("value-changed", ETK_OBJECT(vwidget),
				ETK_CALLBACK(evolve_gui_property_spinner_value_changed_cb),
				NULL);	     
	     break;
	   case EVOLVE_PROPERTY_LONG:
	     value = etk_string_new_printf("%li", evolve_property_value_long_get(p->default_value));
	     vwidget = etk_spinner_new(0, 9999, evolve_property_value_long_get(p->default_value), 1, 10);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "prop", p, NULL);
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "widget", widget, NULL);
	     etk_signal_connect("value-changed", ETK_OBJECT(vwidget),
				ETK_CALLBACK(evolve_gui_property_spinner_value_changed_cb),
				NULL);
	     break;
	   case EVOLVE_PROPERTY_POINTER:
	     value = etk_string_new_printf("cant cast PROPERTY_POINTER");
	     vwidget = etk_entry_new();
	     etk_entry_text_set(ETK_ENTRY(vwidget), etk_string_get(value));
	     etk_widget_disabled_set(vwidget, ETK_TRUE);
	     break;		  
	   case EVOLVE_PROPERTY_STRING:
	     value = etk_string_new_printf("%s", evolve_property_value_string_get(p->default_value));
	     vwidget = etk_entry_new();
	     etk_entry_text_set(ETK_ENTRY(vwidget), etk_string_get(value));
	     etk_entry_text_set(ETK_ENTRY(vwidget), etk_string_get(value));
	     etk_object_data_set_full(ETK_OBJECT(vwidget), "prop", p, NULL);
	     etk_signal_connect("text-changed", ETK_OBJECT(vwidget),
				ETK_CALLBACK(evolve_gui_property_entry_text_changed_cb),
				widget);	     
	     break;
	   default:
	     value = etk_string_new_printf("cant determine value");
	     vwidget = etk_entry_new();
	     etk_entry_text_set(ETK_ENTRY(vwidget), etk_string_get(value));
	     break;
	  }	
	
	if (p == prop)
	  {
	     int type;
	     
	     type = prop->type;	     
	     evolve_widget_property_set(widget, prop->name, etk_string_get(value), type);
	     eprop = evolve_widget_property_get(widget, prop->name);	     
	  }
	
	etk_object_destroy(ETK_OBJECT(value));
	
	etk_table_attach_default(ETK_TABLE(_evolve_gui_gen_table), label,
				  0, 0, i, i);
	etk_table_attach_default(ETK_TABLE(_evolve_gui_gen_table), vwidget,
				  1, 1, i, i);
	++i;
     }

   etk_widget_show_all(_evolve_gui_gen_table);      
}
Пример #14
0
static void 
_close_cb(Etk_Object *obj, void *data) 
{
   etk_object_destroy(ETK_OBJECT(obj));
}
Пример #15
0
/* Called when a widget is added to the toolbar's box */
static Etk_Bool _etk_toolbar_child_added_cb(Etk_Object *object, Etk_Widget *child, void *data)
{
   Etk_Toolbar *toolbar;

   if (!(toolbar = ETK_TOOLBAR(data)) || !child)
      return ETK_TRUE;

   /* Sets the style and the stock size if the new child is a tool-item */
   if (ETK_IS_TOOL_ITEM(child))
   {
      Etk_Button_Style button_style;

      switch (toolbar->style)
      {
         case ETK_TOOLBAR_ICON:
            button_style = ETK_BUTTON_ICON;
            break;
         case ETK_TOOLBAR_TEXT:
            button_style = ETK_BUTTON_TEXT;
            break;
         case ETK_TOOLBAR_BOTH_VERT:
            button_style = ETK_BUTTON_BOTH_VERT;
            break;
         case ETK_TOOLBAR_BOTH_HORIZ:
            button_style = ETK_BUTTON_BOTH_HORIZ;
            break;
         default:
            button_style = ETK_BUTTON_BOTH_VERT;
            break;
      }
      etk_button_style_set(ETK_BUTTON(child), button_style);
      etk_button_stock_size_set(ETK_BUTTON(child), toolbar->stock_size);
   }
   /* Reorientate the separators */
   else if (toolbar->reorientating
      && (((toolbar->orientation == ETK_TOOLBAR_HORIZ) && ETK_IS_VSEPARATOR(child))
         || ((toolbar->orientation == ETK_TOOLBAR_VERT) && ETK_IS_HSEPARATOR(child))))
   {
      Etk_Bool visible;
      Etk_Box_Fill_Policy policy;
      Etk_Box_Group group;
      int pos, padding;

      visible = etk_widget_is_visible(child);
      etk_box_child_position_get(ETK_BOX(toolbar->box), child, &group, &pos);
      etk_box_child_packing_get(ETK_BOX(toolbar->box), child, &policy, &padding);

      etk_object_destroy(ETK_OBJECT(child));
      if (toolbar->orientation == ETK_TOOLBAR_HORIZ)
         child = etk_vseparator_new();
      else
         child = etk_hseparator_new();

      etk_box_insert_at(ETK_BOX(toolbar->box), child, group, pos, policy, padding);
      if (visible)
         etk_widget_show(child);
   }

   if (etk_theme_group_exists(etk_widget_theme_file_get(ETK_WIDGET(toolbar)),
      etk_widget_theme_group_get(child), etk_widget_theme_group_get(ETK_WIDGET(toolbar))))
   {
      etk_widget_theme_parent_set(child, ETK_WIDGET(toolbar));
   }
   //etk_signal_emit(ETK_CONTAINER_CHILD_ADDED_SIGNAL, ETK_OBJECT(toolbar), child);

   return ETK_TRUE;
}