/** * @brief Creates a new string * @param value the default value of the string. It can be NULL * @return Returns the new string */ Etk_String *etk_string_new(const char *value) { Etk_String *string; string = ETK_STRING(etk_object_new(ETK_STRING_TYPE, NULL)); return etk_string_set(string, value); }
/** * @brief Sets the value of the string from the format and the arguments * @param string a string. If @a string is NULL, a new string is created * @param format the format to set to the string. It uses the same arguments than printf() * @param args the arguments corresponding to the format * @return Returns the string */ Etk_String *etk_string_set_vprintf(Etk_String *string, const char *format, va_list args) { va_list args2; char *text; va_copy(args2, args); text = _etk_string_vprintf(format, args2); string = etk_string_set(string, text); free(text); va_end(args2); return string; }
/* Sets the property whose id is "property_id" to the value "value" */ static void _etk_string_property_set(Etk_Object *object, int property_id, Etk_Property_Value *value) { Etk_String *string; if (!(string = ETK_STRING(object)) || !value) return; switch (property_id) { case ETK_STRING_STRING_PROPERTY: etk_string_set(string, etk_property_value_string_get(value)); break; default: break; } }
/* Image Frame Callbacks */ Etk_Bool _image_TweenList_row_selected_cb(Etk_Object *object, Etk_Tree_Row *row, void *data) { Etk_Tree_Col *col; char *selected = NULL; printf("Row selected signal on ImageTweenList EMITTED\n"); col = etk_tree_nth_col_get(ETK_TREE(UI_ImageTweenList), 0); etk_tree_row_fields_get(row, col, NULL, NULL, &selected, NULL); if (!selected) return ETK_TRUE; Cur.tween = etk_string_set(Cur.tween, selected); etk_widget_disabled_set(UI_DeleteTweenButton, FALSE); // etk_widget_disabled_set(UI_MoveDownTweenButton, FALSE); // etk_widget_disabled_set(UI_MoveUpTweenButton, FALSE); return ETK_TRUE; }
Etk_Bool _state_EntryImage_clicked_cb(Etk_Object *object, void *data) { const char *name; printf("Mouse Click Signal on StateEntryImage Emitted\n"); name = etk_entry_text_get(ETK_ENTRY(UI_StateEntry)); if (!name || !etk_string_length_get(Cur.state)) return ETK_TRUE; if (!strcmp(name, Cur.state->string)) { etk_widget_hide(ETK_WIDGET(UI_StateEntryImage)); return ETK_TRUE; } /* Change state name */ if (strcmp("default 0.00", Cur.state->string)) { if (edje_edit_state_name_set(edje_o, Cur.part->string, Cur.state->string, name)) { /* update tree */ Etk_Tree_Row *row; row = etk_tree_selected_row_get(ETK_TREE(UI_PartsTree)); etk_tree_row_fields_set(row,TRUE, COL_NAME, EdjeFile, "DESC.PNG", name, NULL); /* update Cur */ Cur.state = etk_string_set(Cur.state, name); /* Hide the entry image */ etk_widget_hide(ETK_WIDGET(UI_StateEntryImage)); } else dialog_alert_show("<b>Wrong name format</b><br>Name must be in the form:<br>\"default 0.00\""); } else dialog_alert_show("You can't rename default 0.0"); return ETK_TRUE; }
/* Sets the folder displayed in the iconbox */ static void _etk_test_iconbox_folder_set(Etk_Iconbox *iconbox, const char *folder) { Eina_List *files; Eina_List *l; char *filename; char file_path[PATH_MAX]; Etk_Iconbox_Icon *iicon; if (!iconbox) return; if (!folder && !(folder = getenv("HOME"))) return; if (!(files = ecore_file_ls(folder))) return; etk_iconbox_clear(iconbox); etk_iconbox_append(iconbox, etk_theme_icon_path_get(), "actions/go-up_48", ".."); /* First, add the folders */ EINA_LIST_FOREACH(files, l, filename) { if (filename[0] == '.') continue; snprintf(file_path, PATH_MAX, "%s/%s", folder, filename); if (!ecore_file_is_dir(file_path)) continue; iicon = etk_iconbox_append(iconbox, etk_theme_icon_path_get(), "places/folder_48", filename); if (!ecore_file_can_read(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "unreadable"); else if (!ecore_file_can_write(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "readonly"); } /* Then the files */ EINA_LIST_FOREACH(files, l, filename) { const char *ext; char *icon = NULL; int i; if (filename[0] == '.') continue; snprintf(file_path, PATH_MAX, "%s/%s", folder, filename); if (ecore_file_is_dir(file_path)) continue; if ((ext = strrchr(filename, '.')) && (ext = ext + 1)) { for (i = 0; i < _etk_test_iconbox_num_types; i++) { if (strcasecmp(ext, _etk_test_iconbox_types[i].extension) == 0) { icon = _etk_test_iconbox_types[i].icon; break; } } } iicon = etk_iconbox_append(iconbox, etk_theme_icon_path_get(), icon ? icon : "mimetypes/text-x-generic_48", filename); if (!ecore_file_can_read(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "unreadable"); else if (!ecore_file_can_write(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "readonly"); else if (ecore_file_can_exec(file_path)) etk_iconbox_icon_emblem_set_from_stock(iicon, "system"); } EINA_LIST_FREE(files, filename) free(filename); if (!_etk_test_iconbox_current_folder) _etk_test_iconbox_current_folder = etk_string_new(NULL); etk_string_set(_etk_test_iconbox_current_folder, folder); etk_window_title_set(ETK_WINDOW(win), folder); }