Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d7d1b37
Choose a base ref
...
head repository: m-labs/flickernoise
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f063cf6
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Nov 21, 2011

  1. Update gitignore

    Sebastien Bourdeauducq committed Nov 21, 2011
    Copy the full SHA
    a5a5f70 View commit details
  2. File dialog: filter several extensions

    Sebastien Bourdeauducq committed Nov 21, 2011
    Copy the full SHA
    2c05724 View commit details
  3. System settings: allow JPG files as wallpapers

    Sebastien Bourdeauducq committed Nov 21, 2011
    Copy the full SHA
    f063cf6 View commit details
Showing with 21 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +16 −3 src/gui/filedialog.c
  3. +3 −0 src/gui/filedialog.h
  4. +1 −0 src/gui/sysettings.c
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/bin
src/obj/*.o
src/obj/*/*.o
TAGS
19 changes: 16 additions & 3 deletions src/gui/filedialog.c
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <stdio.h>

@@ -72,12 +73,16 @@ static void display_folder(struct filedialog *dlg, const char *folder)
}
}
} else {
/* hide files without the extension we are looking for
/* hide files without the extensions we are looking for
* and those which do not match the quickfind entry (if any).
*/
c = strrchr(entry->d_name, '.');
if(((dlg->extfilter[0] == 0) || ((c != NULL) && (strcmp(dlg->extfilter, c+1) == 0)))
&& ((quickfind[0] == 0) || (strcasestr(entry->d_name, quickfind) != NULL))) {
if(
(((dlg->extfilter[0] == 0) || ((c != NULL) && (strcasecmp(dlg->extfilter, c+1) == 0)))
|| ((dlg->extfilter2[0] != 0) && (c != NULL) && (strcasecmp(dlg->extfilter2, c+1) == 0))
|| ((dlg->extfilter3[0] != 0) && (c != NULL) && (strcasecmp(dlg->extfilter3, c+1) == 0)))
&& ((quickfind[0] == 0) || (strcasestr(entry->d_name, quickfind) != NULL))
) {
if(n_files < 384) {
files[n_files] = strdup(entry->d_name);
n_files++;
@@ -259,6 +264,8 @@ struct filedialog *create_filedialog(const char *name, int is_save, const char *
dlg->appid = mtk_init_app(name);
dlg->is_save = is_save;
dlg->extfilter = extfilter;
dlg->extfilter2 = "";
dlg->extfilter3 = "";
dlg->ok_callback = ok_callback;
dlg->ok_callback_arg = ok_callback_arg;
dlg->cancel_callback = cancel_callback;
@@ -331,6 +338,12 @@ struct filedialog *create_filedialog(const char *name, int is_save, const char *
return dlg;
}

void filedialog_extfilterex(struct filedialog *dlg, const char *extfilter2, const char *extfilter3)
{
dlg->extfilter2 = extfilter2;
dlg->extfilter3 = extfilter3;
}

void open_filedialog(struct filedialog *dlg)
{
refresh(dlg);
3 changes: 3 additions & 0 deletions src/gui/filedialog.h
Original file line number Diff line number Diff line change
@@ -22,13 +22,16 @@ struct filedialog {
int appid;
int is_save;
const char *extfilter;
const char *extfilter2;
const char *extfilter3;
void (*ok_callback)(void *);
void *ok_callback_arg;
void (*cancel_callback)(void *);
void *cancel_callback_arg;
};

struct filedialog *create_filedialog(const char *name, int is_save, const char *extfilter, void (*ok_callback)(void *), void *ok_callback_arg, void (*cancel_callback)(void *), void *cancel_callback_arg);
void filedialog_extfilterex(struct filedialog *dlg, const char *extfilter2, const char *extfilter3);
void open_filedialog(struct filedialog *dlg);
void close_filedialog(struct filedialog *dlg);
void get_filedialog_selection(struct filedialog *dlg, char *buffer, int buflen);
1 change: 1 addition & 0 deletions src/gui/sysettings.c
Original file line number Diff line number Diff line change
@@ -328,6 +328,7 @@ void init_sysettings()
mtk_bind(appid, "w", "close", cancel_callback, NULL);

browse_wallpaper_dlg = create_filedialog("Select wallpaper", 0, "png", wallpaper_ok_callback, NULL, NULL, NULL);
filedialog_extfilterex(browse_wallpaper_dlg, "jpg", "jpeg");
browse_autostart_dlg = create_filedialog("Select autostart performance", 0, "per", autostart_ok_callback, NULL, NULL, NULL);
}