understanding GtkRGBA

2012-10-11 Thread Rudra Banerjee
Dear friends,
though this might be Fedora(or gnome shell theme Adwaita) specific
problem, I cannot get color from:

GdkColor colorRed2 = {0x, 65535, 29555, 24158};
gtk_widget_modify_bg(button, GTK_STATE_NORMAL, colorRed2);

So, I am trying to use:

gtk_widget_override_background_color (Hbutton, GTK_STATE_NORMAL,
GdkRGBA(0,0,0,1.));

ofcourse, this is not the way to use RGBA.
What is the correct way of using it?

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: understanding GtkRGBA

2012-10-11 Thread David Nečas
On Thu, Oct 11, 2012 at 11:14:00AM +0100, Rudra Banerjee wrote:
 So, I am trying to use:
 
 gtk_widget_override_background_color (Hbutton, GTK_STATE_NORMAL,
 GdkRGBA(0,0,0,1.));
 
 ofcourse, this is not the way to use RGBA.
 What is the correct way of using it?

GdkRGBA is a plain C struct and is used as any other plain C struct,
please see your C reference guide for the syntax and use of structs.

In C89 you need to create it on stack (or on heap) if you want to take
its address.

In C99 you can also use (GwyRGBA){0.0, 0.0, 0.0, 1.0}.

Yeti

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: understanding GtkRGBA

2012-10-11 Thread David Nečas
On Thu, Oct 11, 2012 at 12:56:36PM +0200, David Nečas wrote:
 In C99 you can also use (GwyRGBA){0.0, 0.0, 0.0, 1.0}.

I mean (GdkRGBA){0.0, 0.0, 0.0, 1.0}, was thinking about something
else...

Yeti

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

link treeview with file

2012-10-11 Thread Rudra Banerjee
Dear friends,
I have a query.
As the treeview is loaded from a file, in my program, new entries can
also be entered. It writes to the Treeview, as well as in a file using:

strAuth = gtk_entry_get_text(GTK_ENTRY(e-entryAuth));

/*Entering the data in Treeview */
  gtk_list_store_append(store, siter);
  gtk_list_store_set(store, siter,
  COL_BIB_KEY, strkey,
  COL_BIB_TYPE, strcombo,
  COL_BIB_NAME, strAuth,
  COL_BIB_YEAR, strYear,
  COL_BIB_PUB, strTitle,
  -1);
/*Entering the data in file */
if( strlen(strEditor)!=0)
g_fprintf( fop, \tEditor=\%s\,\n, strAuth);
...etc...


Now, my question is, can this two entry be linked such that if I delete
an entry from treeview, it will also delete the entry from file(fop).


Report this post

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: link treeview with file

2012-10-11 Thread David Nečas
On Thu, Oct 11, 2012 at 06:58:04PM +0100, Rudra Banerjee wrote:
 As the treeview is loaded from a file, in my program, new entries can
 also be entered. It writes to the Treeview, as well as in a file using:
 
 strAuth = gtk_entry_get_text(GTK_ENTRY(e-entryAuth));
 
 /*Entering the data in Treeview */
   gtk_list_store_append(store, siter);
   gtk_list_store_set(store, siter,
   COL_BIB_KEY, strkey,
   COL_BIB_TYPE, strcombo,
   COL_BIB_NAME, strAuth,
   COL_BIB_YEAR, strYear,
   COL_BIB_PUB, strTitle,
   -1);
 /*Entering the data in file */
 if( strlen(strEditor)!=0)
 g_fprintf( fop, \tEditor=\%s\,\n, strAuth);
 ...etc...
 
 
 Now, my question is, can this two entry be linked such that if I delete
 an entry from treeview, it will also delete the entry from file(fop).

In principle, certainly: by loading the entire file, parsing it, finding
the corresponding line, deleting it and saving the file again.  Or, if
the file ‘cannot’ change on-disk meanwhile, just by re-generating the
file from the treeview and saving it.

For a saner use you need an API for handling of these files, similar to
GKeyFile for .ini files.  Apparently you are trying to process BibTeX
files.  Although there is no shortage of tools working with BibTeX files
and even a few attempts to create a reusable BibTeX file handling
library have been made (btOOl, ...), I cannot really recommend any
parser.  Maybe others know some.

Regards,

Yeti

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list