Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=f24bd1c68796b9bb7bfb44a2446e05835b079597
commit f24bd1c68796b9bb7bfb44a2446e05835b079597 Author: James Buren <[email protected]> Date: Thu Sep 6 23:08:32 2012 -0500 add function for measuring screen size of a label diff --git a/src/local.h b/src/local.h index 52ff938..7ebfb43 100644 --- a/src/local.h +++ b/src/local.h @@ -19,8 +19,6 @@ #define GIBIBYTE (1LL << 30LL) #define TEBIBYTE (1LL << 40LL) -typedef bool (*ui_dialog_progress_callback) (char *text,size_t n,int *percent,void *data); - struct global { bool netinstall; @@ -32,6 +30,16 @@ struct install bool checked; }; +struct account +{ + char *name; + char *password; + char *group; + char *groups; + char *home; + char *shell; +}; + struct module { bool (*run) (void); @@ -44,6 +52,7 @@ extern bool size_to_string(char *s,size_t n,long long size,bool pad); extern int get_text_screen_width(const char *s); extern bool get_text_screen_size(const char *text,int *width,int *height); extern bool get_button_screen_size(const char *text,int *width,int *height); +extern bool get_label_screen_size(const char *text,int *width,int *height); static inline long min(long a,long b) { return (a < b) ? a : b; } static inline long max(long a,long b) { return (a > b) ? a : b; } extern int ui_main(int argc,char **argv); diff --git a/src/utility.c b/src/utility.c index d1213f5..f43cba7 100644 --- a/src/utility.c +++ b/src/utility.c @@ -196,3 +196,27 @@ extern bool get_button_screen_size(const char *text,int *width,int *height) return true; } + +extern bool get_label_screen_size(const char *text,int *width,int *height) +{ + int w = 0; + int h = 0; + + if(text == 0 || width == 0 || height == 0) + { + errno = EINVAL; + fprintf(logfile,"%s: %s\n",__func__,strerror(errno)); + return false; + } + + if((w = get_text_screen_width(text)) == -1) + return false; + + h = 1; + + *width = w; + + *height = h; + + return true; +} \ No newline at end of file _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
