[EGIT] [website/www-content] master 01/01: Wiki page start changed with summary [] by Raster
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=74daf0482cb1a1a70dfd4fc9a1ac6a6e9105b719 commit 74daf0482cb1a1a70dfd4fc9a1ac6a6e9105b719 Author: Raster Date: Sat May 16 22:29:11 2015 -0700 Wiki page start changed with summary [] by Raster --- pages/docs/c/start.txt | 5 + 1 file changed, 5 insertions(+) diff --git a/pages/docs/c/start.txt b/pages/docs/c/start.txt index 2b382f4..485c7d0 100644 --- a/pages/docs/c/start.txt +++ b/pages/docs/c/start.txt @@ -447,6 +447,11 @@ So only compile the active code in when enabled in the compilation process. Now you have read our less-than-perfect primer on C for those wanting to get into developing on EFL or using it from the C APIs we have, you may also want to look at the following list of pages and pick up some more information or fill in the gaps we do not cover here //(feel free to link to more articles that are good for teaching C from new developers through to advanced)//. * [[http://www.cprogramming.com/tutorial/c-tutorial.html|C tutorial]] + * [[http://www.le.ac.uk/users/rjm1/cotter|Introduction to C]] + * [[http://www.tutorialspoint.com/cprogramming|C tutorial]] + * [[http://www.cac.cornell.edu/VW/Cintro|C Intro]] + * [[http://www.ntu.edu.sg/home/ehchua/programming/cpp/c0_Introduction.html|C programming tutorial]] + * [[http://en.wikipedia.org/wiki/C_(programming_language)|Wikipedia C language page]] --
[EGIT] [website/www-content] master 01/01: Wiki page start changed with summary [] by Raster
WWW-www.enlightenment.org pushed a commit to branch master. http://git.enlightenment.org/website/www-content.git/commit/?id=1a1b048958033cc9a3ee98fe4720d99f9a25c72d commit 1a1b048958033cc9a3ee98fe4720d99f9a25c72d Author: Raster Date: Sat May 16 22:21:54 2015 -0700 Wiki page start changed with summary [] by Raster --- pages/docs/c/start.txt | 85 ++ 1 file changed, 85 insertions(+) diff --git a/pages/docs/c/start.txt b/pages/docs/c/start.txt index e1b25b3..2b382f4 100644 --- a/pages/docs/c/start.txt +++ b/pages/docs/c/start.txt @@ -343,6 +343,91 @@ The ''do while'' loop is just like ''while'' But the test statement is executed Pre-processor and Macros +You already had your first encounter with the C pre-processor with the ''#include'' line in the first "Hello world" example above. The pre-processor is "executed" during compilation before the code is actually parsed by the C compiler proper. The job of the pre-processor in general is to "generate" more code. This mechanism is used to save a lot of repetitive typing, copy & pasting, conditional compilation (compile section of code A instead of code B based on compile-time information), a [...] + +== System include headers == + +#include + + +These headers define functions, types and even other pre-processor macros for use in your code. These headers are generally provided by system libraries (such as libc or EFL etc.) and you generally would place such include lines at the top of your C source files to indicate you are "including" the content of that file. Remember that this file is also passed through the pre-processor and thus can recurse, including more files than can include more files and so on. All the content of these [...] + +== Local headers == + +#include "myheader.h" + + +Once your projects get a bit larger, you will divide your application or library up into many .c and .h files. The headers (.h files) will define things from other parts of your source code base. you likely will use a Makefile or some similar mechanism to compile your project file by file and then link it together. You will compile the .c files, and include .h files along the way. The ''"'' quotes as opposed to the ''<>'' is that this here searches in the same directory as the source fil [...] + +== Defined values == + +#define NUM_ITEMS 100 + +int x = NUM_ITEMS; + + +It is useful to avoid "magic numbers" in your code to define them in a central place (at the top of your .c files or in a shared common .h file) and give them a name. If you need to change them later, you change them in one place only. This also helps document the purpose of this magic value as it gives it a descriptive name, improving maintainability. Note that you can also "undefine" a value with an ''#undef NUM_ITEMS'' for example. This will remove the definition from that point on in [...] + + +#define MY_TITLE "Hello world" + +printf("This is: %n", MY_TITLE); + + +You can define anything. It literally is a "string replacement" system, so it will replace the defined toke with what you define it as. This works with numbers, strings, functions and whole sections of text. You can even define a definition with other definitions inside of it: + + +#define NUM_ITEMS 100 +#define MY_STRING "Hello", NUM_ITEMS + +printf("This string: %s has %i items\n", MY_STRING); + + +== More complex macros == + +#define SIMPLE_FUNC(x, y) complex_func(100, 200, x, "hello", 4.8, y) + +int x = rand(); +SIMPLE_FUNC("Boo", 10 * x); + + +You can define macros that take parameters. They will produce the code that you specify exactly as given, replacing instances of the tokens given as parameters as they are passed into the macro. This is extremely useful in being able to simplify and make code more concise. The tokens passed in don't have to even have to be simple single values. They can be entire expressions going on and on, even entire snippets of code. Such macros are very powerful, and a common convention in C is to m [...] + +== Conditional compilation == + +int +myfunc(void) + { +#ifdef _WIN32 +// windows specific code here +#else +// generic code here +#endif + } + + +Another very common use of the pre-processor is to compile only some pieces of code in specific circumstances. A common use-case is for portability (but you can also use this along with #includes, macros etc. to use the pre-processor as a code-generation tool to save a lot of re-typing of almost the same bits of code). On one platform you may have to have some pieces of code work in a specific way that differs from other platforms. This commonly happens with Windows vs Linux vs BSD etc. [...] + +You can use this also to compile your code with features enabled or not. You can define pre-processor values on the command line with ''-D'' with most compilers, such as ''-DMY_FEATURE=1'' for example which is the same as putting in the code ''#define M
[EGIT] [apps/epour] master 01/02: Use window mode for torrent tooltips
kuuko pushed a commit to branch master. http://git.enlightenment.org/apps/epour.git/commit/?id=8a45182cc450c25a13d7e9239b89a38721369287 commit 8a45182cc450c25a13d7e9239b89a38721369287 Author: Kai Huuhko Date: Wed Apr 22 09:40:03 2015 +0300 Use window mode for torrent tooltips --- epour/gui/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/epour/gui/__init__.py b/epour/gui/__init__.py index 37be299..c01309d 100644 --- a/epour/gui/__init__.py +++ b/epour/gui/__init__.py @@ -279,6 +279,7 @@ class MainInterface(object): itc = TorrentClass(self.session, "double_label") item = self.tlist.item_append(itc, h) item.tooltip_content_cb_set(self._torrent_item_tooltip_cb, h) +item.tooltip_window_mode_set(True) self.torrentitems[ihash] = item def remove_torrent_item(self, info_hash): --
[EGIT] [apps/epour] master 02/02: Add compatibility for lt-rb 1.0 and py3k
kuuko pushed a commit to branch master. http://git.enlightenment.org/apps/epour.git/commit/?id=cb3c4b7f6618bc6f9230945c78eceaad54a7c588 commit cb3c4b7f6618bc6f9230945c78eceaad54a7c588 Author: Kai Huuhko Date: Sun May 17 02:34:25 2015 +0300 Add compatibility for lt-rb 1.0 and py3k Beware, may remove your torrents from the app. lt-rb >= 1.0 is now a requirement --- README | 12 epour/Epour.py | 14 ++ epour/__init__.py| 2 +- epour/gui/TorrentProps.py| 5 +++- epour/gui/TorrentSelector.py | 5 ++-- epour/gui/Widgets.py | 3 ++ epour/gui/__init__.py| 14 +- epour/session.py | 65 ++-- setup.py | 5 +--- 9 files changed, 54 insertions(+), 71 deletions(-) diff --git a/README b/README index 45e5a68..007012d 100644 --- a/README +++ b/README @@ -2,20 +2,20 @@ REQUIREMENTS -* libtorrent-rasterbar 0.16.0 or later, currently tested and developed with - version 0.16.16 +* libtorrent-rasterbar 1.0 or later, currently tested and developed with + version 1.0.5 http://www.libtorrent.org/ * Enlightenment Foundation Libraries 1.8 or later -http://enlightenment.org/p.php?p=download&l=en +https://www.enlightenment.org/download -* Python Bindings for EFL 1.8 or later +* Python-EFL 1.8 or later -http://enlightenment.org/p.php?p=download&l=en +https://www.enlightenment.org/download -* Python 2.x or later +* Python 2.6 or later, 3.2 or later http://www.python.org/ diff --git a/epour/Epour.py b/epour/Epour.py index c87f310..17cb8a4 100644 --- a/epour/Epour.py +++ b/epour/Epour.py @@ -57,10 +57,10 @@ else: sys.exit() import os -try: -from ConfigParser import SafeConfigParser -except ImportError: +if sys.hexversion >= 0x03F0: from configparser import ConfigParser as SafeConfigParser +else: +from ConfigParser import SafeConfigParser import logging @@ -160,8 +160,12 @@ class Epour(object): def save_conf(self): conf_path = os.path.join(save_config_path("epour"), "epour.conf") -with open(conf_path, 'wb') as configfile: -self.conf.write(configfile) +if sys.hexversion >= 0x03F0: +with open(conf_path, 'w') as configfile: +self.conf.write(configfile) +else: +with open(conf_path, 'wb') as configfile: +self.conf.write(configfile) def quit(self): session = self.session diff --git a/epour/__init__.py b/epour/__init__.py index 906d362..5c2c6c5 100644 --- a/epour/__init__.py +++ b/epour/__init__.py @@ -1 +1 @@ -__version__ = "0.6.0" +__version__ = "0.6.9" diff --git a/epour/gui/TorrentProps.py b/epour/gui/TorrentProps.py index 116a231..ea10883 100644 --- a/epour/gui/TorrentProps.py +++ b/epour/gui/TorrentProps.py @@ -19,6 +19,9 @@ # MA 02110-1301, USA. # +if "long" not in dir(__builtins__): +long = int + import cgi import sys import os @@ -656,7 +659,7 @@ class TorrentStatus(Table): pass elif isinstance(v, lt.storage_mode_t): v = str(v).replace("_", " ").capitalize() -elif isinstance(v, (int, long, basestring)): +elif isinstance(v, (int, long, bytes, str)): if k in self.byte_values: v = intrepr(v) if k in self.byte_transfer_values: diff --git a/epour/gui/TorrentSelector.py b/epour/gui/TorrentSelector.py index 18b7cee..01142d7 100644 --- a/epour/gui/TorrentSelector.py +++ b/epour/gui/TorrentSelector.py @@ -241,14 +241,13 @@ always used.''' single_line=True, scrollable=True ) uri_entry.part_text_set("guide", _("Enter torrent file path / magnet URI / info hash")) + if t_uri: uri_entry.entry = utf8_to_markup(t_uri) + hbox.pack_end(uri_entry) uri_entry.show() -if t_uri: -uri_entry.entry = t_uri - fsb = Button(box, text=_("Select file")) fsb.callback_clicked_add(lambda x: TorrentFs(self, uri_entry)) hbox.pack_end(fsb) diff --git a/epour/gui/Widgets.py b/epour/gui/Widgets.py index 6e6a178..7aa0f06 100644 --- a/epour/gui/Widgets.py +++ b/epour/gui/Widgets.py @@ -16,6 +16,9 @@ EXPAND_HORIZ = EVAS_HINT_EXPAND, 0.0 FILL_BOTH = EVAS_HINT_FILL, EVAS_HINT_FILL FILL_HORIZ = EVAS_HINT_FILL, 0.5 +if "xrange" not in dir(__builtins__): +xrange = range + def chunker(seq, size): return (seq[pos:pos + size] for pos in xrange(0, len(seq), size)) diff --git a/epour/gui/__init__.py b/epour/gui/__init__.py index c01309d..e16c77c 100644 --- a/epour/gui/__init__.py +++ b/epour/gui/__init__.py @@ -23,7 +23,10 @@ import cgi import logging from datetime import timedelta, datetime import gettext -gettext.install("epour", unicode=True) +try: +gettext.install("epour", unicode=True) +except Exception: +gettext.insta
[EGIT] [tools/edi] master 01/01: headers: remove includes if they are not needed
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=6e461200c68758ddf56a0f3649cb68a289f29e56 commit 6e461200c68758ddf56a0f3649cb68a289f29e56 Author: Andy Williams Date: Sat May 16 10:05:54 2015 +0100 headers: remove includes if they are not needed Put them in the code that needs them unless they are part of the API --- src/lib/Edi.h | 3 --- src/lib/edi.c | 2 ++ src/lib/edi_builder.c | 3 +++ src/lib/edi_create.c | 15 +++ src/lib/edi_create.h | 11 --- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/lib/Edi.h b/src/lib/Edi.h index 321ee46..5a256b3 100644 --- a/src/lib/Edi.h +++ b/src/lib/Edi.h @@ -2,9 +2,6 @@ # define EDI_H_ #include -#include -#include -#include #ifdef EAPI # undef EAPI diff --git a/src/lib/edi.c b/src/lib/edi.c index 768a07f..21fc775 100644 --- a/src/lib/edi.c +++ b/src/lib/edi.c @@ -6,6 +6,8 @@ #include #include +#include + #include "Edi.h" #include "edi_private.h" diff --git a/src/lib/edi_builder.c b/src/lib/edi_builder.c index 569f6e1..db6dae1 100644 --- a/src/lib/edi_builder.c +++ b/src/lib/edi_builder.c @@ -2,6 +2,9 @@ # include "config.h" #endif +#include +#include + #include "Edi.h" #include "edi_private.h" diff --git a/src/lib/edi_create.c b/src/lib/edi_create.c index 422f5b3..ae33d34 100644 --- a/src/lib/edi_create.c +++ b/src/lib/edi_create.c @@ -2,10 +2,25 @@ # include "config.h" #endif +#include +#include +#include + #include "Edi.h" #include "edi_private.h" +typedef struct _Edi_Create +{ + char *path, *temp, *name; + char *url, *user, *email; + + Edi_Create_Cb callback; + Ecore_Event_Handler *handler; + + int filters; +} Edi_Create; + static Edi_Create *_edi_create_data; static const char * diff --git a/src/lib/edi_create.h b/src/lib/edi_create.h index 60ca6de..a7398d8 100644 --- a/src/lib/edi_create.h +++ b/src/lib/edi_create.h @@ -12,17 +12,6 @@ extern "C" { typedef void (*Edi_Create_Cb)(const char *path, Eina_Bool success); -typedef struct _Edi_Create -{ - char *path, *temp, *name; - char *url, *user, *email; - - Edi_Create_Cb callback; - Ecore_Event_Handler *handler; - - int filters; -} Edi_Create; - /** * @brief Main builder management * @defgroup Creation --
[EGIT] [tools/edi] master 02/02: config: save project config in the project dir
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=bf17d7c8af73dece708d501c900499428709cd74 commit bf17d7c8af73dece708d501c900499428709cd74 Author: Andy Williams Date: Sat May 16 09:56:39 2015 +0100 config: save project config in the project dir globally storing info about projects loaded, file associations and the general user preference. GUI and usage settings stored in /.edi folder --- .gitignore | 1 + src/bin/edi_config.c | 212 + src/bin/edi_config.h | 26 +++-- src/bin/edi_consolepanel.c | 8 +- src/bin/edi_logpanel.c | 4 +- src/bin/edi_main.c | 51 +- src/bin/editor/edi_editor.c| 12 +-- src/bin/screens/edi_settings.c | 28 +++--- src/bin/screens/edi_welcome.c | 2 +- 9 files changed, 222 insertions(+), 122 deletions(-) diff --git a/.gitignore b/.gitignore index 8a3af95..39c72e7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.gcno *.gcda .dirstamp +.edi /src/bin/edi /src/bin/edi_build diff --git a/src/bin/edi_config.c b/src/bin/edi_config.c index 3049e8a..4b02c60 100644 --- a/src/bin/edi_config.c +++ b/src/bin/edi_config.c @@ -33,20 +33,29 @@ # define EDI_CONFIG_HASH(edd, type, member, eddtype) \ EET_DATA_DESCRIPTOR_ADD_HASH(edd, type, #member, member, eddtype) -# define EDI_CONFIG_FILE_EPOCH 0x0002 -# define EDI_CONFIG_FILE_GENERATION 0x000b +# define EDI_CONFIG_FILE_EPOCH 0x0003 +# define EDI_CONFIG_FILE_GENERATION 0x000c # define EDI_CONFIG_FILE_VERSION \ ((EDI_CONFIG_FILE_EPOCH << 16) | EDI_CONFIG_FILE_GENERATION) +# define EDI_PROJECT_CONFIG_FILE_EPOCH 0x0001 +# define EDI_PROJECT_CONFIG_FILE_GENERATION 0x0001 +# define EDI_PROJECT_CONFIG_FILE_VERSION \ + ((EDI_PROJECT_CONFIG_FILE_EPOCH << 16) | EDI_PROJECT_CONFIG_FILE_GENERATION) + typedef Eet_Data_Descriptor Edi_Config_DD; +typedef Eet_Data_Descriptor Edi_Project_Config_DD; /* local variables */ static Edi_Config_DD *_edi_cfg_edd = NULL; static Edi_Config_DD *_edi_cfg_proj_edd = NULL; static Edi_Config_DD *_edi_cfg_mime_edd = NULL; +static Edi_Project_Config_DD *_edi_proj_cfg_edd = NULL; + /* external variables */ -Edi_Config *_edi_cfg = NULL; +Edi_Config *_edi_config = NULL; +Edi_Project_Config *_edi_project_config = NULL; int EDI_EVENT_CONFIG_CHANGED; const char * @@ -60,6 +69,17 @@ _edi_config_dir_get(void) return dir; } +const char * +_edi_project_config_dir_get(void) +{ + static char dir[PATH_MAX]; + + if (!dir[0] && edi_project_get()) + snprintf(dir, sizeof(dir), "%s/.edi", edi_project_get()); + + return dir; +} + /* local functions */ static Edi_Config_DD * _edi_config_descriptor_new(const char *name, int size) @@ -79,33 +99,40 @@ _edi_config_cb_free(void) Edi_Config_Project *proj; Edi_Config_Mime_Association *mime; - EINA_LIST_FREE(_edi_cfg->projects, proj) + EINA_LIST_FREE(_edi_config->projects, proj) { if (proj->name) eina_stringshare_del(proj->name); if (proj->path) eina_stringshare_del(proj->path); free(proj); } - EINA_LIST_FREE(_edi_cfg->mime_assocs, mime) + EINA_LIST_FREE(_edi_config->mime_assocs, mime) { if (mime->id) eina_stringshare_del(mime->id); if (mime->mime) eina_stringshare_del(mime->mime); free(mime); } - free(_edi_cfg); - _edi_cfg = NULL; + free(_edi_config); + _edi_config = NULL; +} + +static void +_edi_project_config_cb_free(void) +{ + free(_edi_project_config); + _edi_project_config = NULL; } static void * -_edi_config_domain_load(const char *domain, Edi_Config_DD *edd) +_edi_config_domain_load(const char *dir, const char *domain, Eet_Data_Descriptor *edd) { Eet_File *ef; char buff[PATH_MAX]; if (!domain) return NULL; snprintf(buff, sizeof(buff), -"%s/%s.cfg", _edi_config_dir_get(), domain); +"%s/%s.cfg", dir, domain); ef = eet_open(buff, EET_FILE_MODE_READ); if (ef) { @@ -119,23 +146,21 @@ _edi_config_domain_load(const char *domain, Edi_Config_DD *edd) } static Eina_Bool -_edi_config_domain_save(const char *domain, Edi_Config_DD *edd, const void *data) +_edi_config_domain_save(const char *dir, const char *domain, Eet_Data_Descriptor *edd, const void *data) { Eet_File *ef; char buff[PATH_MAX]; - const char *configdir; if (!domain) return 0; - configdir = _edi_config_dir_get(); - snprintf(buff, sizeof(buff), "%s/", configdir); + snprintf(buff, sizeof(buff), "%s/", dir); if (!ecore_file_exists(buff)) ecore_file_mkpath(buff); - snprintf(buff, sizeof(buff), "%s/%s.tmp", configdir, domain); + snprintf(buff, sizeof(buff), "%s/%s.tmp", dir, domain); ef = eet_open(buff, EET_FILE_MODE_WRITE); if (ef) { char buff2[PATH_MAX]; -snprintf(buff2, sizeof(buff2), "%s/%s.cfg", configdir, domain); +s
[EGIT] [tools/edi] master 01/02: Settings: add a background to the window
ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=0da1c9a5e3979740ad14ad82e2f7e12c0da95178 commit 0da1c9a5e3979740ad14ad82e2f7e12c0da95178 Author: Andy Williams Date: Fri May 15 15:06:20 2015 +0100 Settings: add a background to the window --- src/bin/screens/edi_settings.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bin/screens/edi_settings.c b/src/bin/screens/edi_settings.c index 8ead3f6..5cf3c36 100644 --- a/src/bin/screens/edi_settings.c +++ b/src/bin/screens/edi_settings.c @@ -224,7 +224,7 @@ _edi_settings_behaviour_create(Evas_Object *parent) Evas_Object * edi_settings_show(Evas_Object *mainwin) { - Evas_Object *win, *table, *naviframe, *tb; + Evas_Object *win, *bg, *table, *naviframe, *tb; Elm_Object_Item *tb_it; win = elm_win_add(mainwin, "settings", ELM_WIN_DIALOG_BASIC); @@ -234,7 +234,13 @@ edi_settings_show(Evas_Object *mainwin) elm_win_focus_highlight_enabled_set(win, EINA_TRUE); evas_object_smart_callback_add(win, "delete,request", _edi_settings_exit, win); - table = elm_table_add(win); + bg = elm_bg_add(win); + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + + table = elm_table_add(bg); evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_win_resize_object_add(win, table); --