Active Topics

 



Notices


Reply
Thread Tools
Posts: 383 | Thanked: 344 times | Joined on Jun 2013 @ Greece, Athens
#101
Originally Posted by electroaudio View Post
Just thinking

Would it not be possible to make this mod read the values from a themefile, instead of having it hardcoded in the program?
-there were some examples on how to read a themefile in the source for other parts of hildon desktop, and it didnt look as anything complicated.
We can try(as I said before I don't really know a programming language so I don't know how difficult it is!)! Can you give a link of the examples you are talking?
 
electroaudio's Avatar
Posts: 381 | Thanked: 336 times | Joined on Jan 2011 @ Stockholm, Sweden
#102
We probably need some help from a c++ programmer for this then

I was looking at src/home/hd-title-bar.c
at line 270 and 271 there is something that looks like a call to resolve font and fontcolour going on. probably related to the HD_gtk includes around line 38.

____

If that doesnt work, then i could extract some simple code written in plain C from mine and sethkhas old deskypplet project, that can read and extract data from a textfile in a Name=Value format.
__________________
Deskypplet , a desktop for N900 *RIP*
 

The Following User Says Thank You to electroaudio For This Useful Post:
electroaudio's Avatar
Posts: 381 | Thanked: 336 times | Joined on Jan 2011 @ Stockholm, Sweden
#103
Here is the significant part to read a configfile from deskypplet.c

Code:
confyfile="/home/user/.deskypplet/deskypplet.conf";
	get_sizes (confyfile);
You could simplify it by using get_sizes("/usr/share/theme/launcher.cfg") directly instead, or maybe just copy the code inside get_sizes{} directly into the hildon-desktop code.
Also, the assigning of the values to a variable has to be remade, since deskypplet uses a structure to store the values.
Code:
if(strstr(readbuf,"title height"))
				sscanf(readbuf,"title height=%d\n",&(app->title_height));
Code:
void get_sizes (gchar *conffile)
{
	/*printf ("get_sizes conffile %s\n",conffile);*/
	GIOChannel *f=NULL;
	GIOStatus st;
	GdkColormap *colormap;
	gchar *readbuf=NULL;
	gchar *fontbuffer=NULL;
	gchar *red=NULL;
	gchar *green=NULL;
	gchar *blue=NULL;
    
	/*gdk_color_parse (DEFAULT_COLOR, &(app->color));
	gdk_color_parse (DEFAULT_FONT_COLOR, &(app->fontcolor));
	app->fontname=g_new0(gchar,strlen(DEFAULT_FONT)+1);
	strcpy(app->fontname,DEFAULT_FONT);
	app->bg_alpha=(gfloat)DEFAULT_BG_ALPHA/100;*/
  	
	f=g_io_channel_new_file(conffile,"r",NULL);

	if(f!=NULL)
		{
		 while((st=g_io_channel_read_line(f,&readbuf,NULL,NULL,NULL) )!=G_IO_STATUS_EOF)
			{
			 if(strstr(readbuf,"bgcolor="))
				{
				 red=strchr(readbuf,'=')+1;
				 green=strchr(red,',');
				 *green=0;
				 green+=1;
				 blue=strchr(green,',');
				 *blue=0;
				 blue+=1;
				 fontbuffer=strchr(blue,'\n');
				 *fontbuffer=0;
				 (app->color).red=(guint16)atoi(red);
				 (app->color).green=(guint16)atoi(green);
				 (app->color).blue=(guint16)atoi(blue);
				 colormap=gdk_colormap_get_system();
				 gdk_colormap_alloc_color(colormap,&(app->color),TRUE,TRUE);
				}
			 if(strstr(readbuf,"bgalpha"))
				{
				 gint alpha;
				 sscanf(readbuf,"bgalpha=%d\n",&alpha);
				 app->bg_alpha=(gfloat)alpha/100;
				}

			if(strstr(readbuf,"autorefresh active"))
				sscanf(readbuf,"autorefresh active=%d\n",&(autorefresh));

			if(strstr(readbuf,"icons size"))
				{
				 sscanf(readbuf,"icons size=%d\n",&(app->icon_x_size));
				 app->icon_y_size=app->icon_x_size;	
				}
			if(strstr(readbuf,"filename textbox height"))
				sscanf(readbuf,"filename textbox height=%d\n",&(app->icon_label_y_size));					

			if(strstr(readbuf,"filename textbox width"))
				sscanf(readbuf,"filename textbox width=%d\n",&(app->icon_label_x_size));					
			
			if(strstr(readbuf,"bookmark icons size"))
				{
				 sscanf(readbuf,"bookmark icons size=%d\n",&(app->bookm_x_size));
				 app->bookm_y_size=app->bookm_x_size;
				}
			if(strstr(readbuf,"bookmark textbox height"))
				sscanf(readbuf,"bookmark textbox height=%d\n",&(app->bookm_label_y_size));					

			if(strstr(readbuf,"bookmark textbox width"))
				sscanf(readbuf,"bookmark textbox width=%d\n",&(app->bookm_label_x_size));					
			
			if(strstr(readbuf,"font for filenames="))
			{
				fontbuffer=strchr(readbuf,'\n');
				*fontbuffer=0;
				fontbuffer=strchr(readbuf,'=')+1;
				app->files_name_size=g_new0(gchar,strlen(fontbuffer)+1);
				strcpy(app->files_name_size,fontbuffer);
			}
			if(strstr(readbuf,"font for bookmarks="))
			{
				fontbuffer=strchr(readbuf,'\n');
				*fontbuffer=0;
				fontbuffer=strchr(readbuf,'=')+1;
				app->bookmarks_name_size=g_new0(gchar,strlen(fontbuffer)+1);
				strcpy(app->bookmarks_name_size,fontbuffer);
			}
			
			if(strstr(readbuf,"title buttons size"))
				sscanf(readbuf,"title buttons size=%d\n",&(app->title_button_size));

			if(strstr(readbuf,"title height"))
				sscanf(readbuf,"title height=%d\n",&(app->title_height));
			
			if(strstr(readbuf,"font for title="))
			{
				fontbuffer=strchr(readbuf,'\n');
				*fontbuffer=0;
				fontbuffer=strchr(readbuf,'=')+1;
				app->title_font_size=g_new0(gchar,strlen(fontbuffer)+1);
				strcpy(app->title_font_size,fontbuffer);
			}
						
			if(strstr(readbuf,"fontcolor"))
			{
				red=strchr(readbuf,'=')+1;
				green=strchr(red,',');
				*green=0;
				green+=1;
				blue=strchr(green,',');
				*blue=0;
				blue+=1;
				fontbuffer=strchr(blue,'\n');
				*fontbuffer=0;
				(app->fontcolor).red=(guint16)atoi(red);
				(app->fontcolor).green=(guint16)atoi(green);
				(app->fontcolor).blue=(guint16)atoi(blue);
				colormap=gdk_colormap_get_system();
				gdk_colormap_alloc_color(colormap,&(app->fontcolor),TRUE,TRUE);
			}

			g_free(readbuf);
		}
		g_io_channel_close(f);
	}

	if (autorefresh==1)
		{autorefresh_status="Autorefresh Activated";}
	else
		{autorefresh_status="Autorefresh Deactivated";}

	return;
And here are the declarations from deskypplet.h
Code:
/*read preferences from config file and load into object*/
void get_sizes (gchar *conffile);
__________________
Deskypplet , a desktop for N900 *RIP*

Last edited by electroaudio; 2013-08-17 at 12:07.
 
Posts: 10 | Thanked: 5 times | Joined on Oct 2013
#104
I am using that type of theme recently it is more effective and gives you a comfort ....!
 

The Following User Says Thank You to shayanjameel08 For This Useful Post:
Posts: 383 | Thanked: 344 times | Joined on Jun 2013 @ Greece, Athens
#105
Originally Posted by shayanjameel08 View Post
I am using that type of theme recently it is more effective and gives you a comfort ....!
You are welcome
Well I was off for some time, but I am logging in from time to time (just checking what is going on)
Well there are some things that can be improved but I am not sure if I can to do them now!
 
panjgoori's Avatar
Posts: 1,239 | Thanked: 1,278 times | Joined on Aug 2011 @ Balochistan
#106
how to revert back to previous version ? default n900 one.
 
Reply


 
Forum Jump


All times are GMT. The time now is 17:21.