slackbuilds_ponce/audio/audtty/patches/04-code_refactoring.patch
Matteo Bernardini b91b25e175 audio/audtty: Updated for version 0.1.12.
Added also some patches from git.
Rewritten the gcc/DESTDIR patch

Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
2012-09-16 19:44:40 -04:00

91 lines
2.4 KiB
Diff

From ead43f353675d4c8952facf57920ce79533955a6 Mon Sep 17 00:00:00 2001
From: Chris Taylor <chris@code-monkeys.org>
Date: Fri, 05 Mar 2010 06:24:05 +0000
Subject: Code refactoring.
-Split browser creation code off into its own object. update_browser.
-If exiting from opening creation use update_browser() to repaint browser.
Signed-off-by: Chris Taylor <chris@code-monkeys.org>
---
diff --git a/browse.c b/browse.c
index c736e64..232d374 100644
--- a/browse.c
+++ b/browse.c
@@ -50,7 +50,7 @@ void add_file(gboolean dir);
void remove_win( void );
void display_error(gchar *message, gchar *name, gboolean type);
void open_directory( void );
-
+void update_browser(void);
void file_browser(gint height)
{
@@ -63,28 +63,15 @@ void file_browser(gint height)
cont.length = 1;
cont.first=0;
cont.pos_height=0;
- clear();
+ clear();
refresh();
-
+
browser.location = newwin(1, 0, 0, 0);
browser.title = newwin(1, 0, 1, 0);
browser.list = newwin(cont.height, 0, 3, 0);
-
- wcolor_set(browser.location, 1, NULL);
- wcolor_set(browser.title, 1, NULL);
- wcolor_set(browser.list, 1, NULL);
-
- mvwtitledhline(browser.title, 0, "File Browser");
- wnoutrefresh(browser.title);
- wnoutrefresh(browser.list);
-
- doupdate();
-
-
- get_contents();
- browser_paint(&cont);
-
+ update_browser();
+
while((c=getch()))
{
switch(c)
@@ -399,7 +386,10 @@ void open_directory( void )
get_contents();
return;
case ENTER:
- if(strlen(buffer)==0) return;
+ if(strlen(buffer)==0) {
+ update_browser();
+ return;
+ }
else {
cont.location=g_strdup(buffer);
g_chdir(buffer);
@@ -429,4 +419,18 @@ void open_directory( void )
doupdate();
}
return;
+}
+
+void update_browser(void)
+{
+ wcolor_set(browser.location, 1, NULL);
+ wcolor_set(browser.title, 1, NULL);
+ wcolor_set(browser.list, 1, NULL);
+ mvwtitledhline(browser.title, 0, "File Browser");
+ wnoutrefresh(browser.title);
+ wnoutrefresh(browser.list);
+ doupdate();
+ get_contents();
+ browser_paint(&cont);
+ return;
}
\ No newline at end of file
--
cgit v0.8.3.4-115-g1759