widget to represent dial/speedometer kind of object

2013-12-10 Thread Mahesh Chaudhari
Hi list ,

is there any widget available to represent meter/dial/speedometer kind of 
object, needle of which rotates dynamically with magnitude of input values 


one widget i found is Gtkdial , but it has support from gtk+-2.18 onwards and i 
am having gtk+-2.10.0 



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


Re: making button insensitive to mouse clicks

2013-11-21 Thread Mahesh Chaudhari
Firstly, my button is not toggle button (its simple button)
Secondly, software emmited signals (using gtk_button_clicked()) should be 
caught. completely disabling button will not help  



On Thursday, 21 November 2013 10:52 PM, Eric Wajnberg 
 wrote:
  
Hi,

I guess that

gtk_toggle_button_set_active(Button,FALSE);

is doing the trick.

Cheers,



Mahesh Chaudhari wrote, On 22/11/2013 07:04,
 
Hi list, 
is it possible to make GtkButton insensitive to mouse click and mouse hover 
however it should  catch the signal sent through gtk_button_clicked() and 
gtk_button_entered()
___
gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org 
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list   

--  ~~Eric Wajnberg 
Associated Professor at the University of Montreal (Quebec, Canada) I.N.R.A. 
400 Route des Chappes, BP 167, 06903 Sophia Antipolis Cedex, France Tel: (33-0) 
4.92.38.64.47 Fax: (33-0) 4.92.38.65.57 e-mail: wajnb...@sophia.inra.fr Web 
page: http://www.sophia.inra.fr/perso/wajnberg/ Editor-in-Chief of BioControl, 
Published by Springer. ~~   
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


making button insensitive to mouse clicks

2013-11-21 Thread Mahesh Chaudhari


Hi list, 
is it possible to make GtkButton insensitive to mouse click and mouse hover 
however it should  catch the signal sent through gtk_button_clicked() and 
gtk_button_entered()
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: deactivate "enter" signal on GtkButton

2013-11-07 Thread Mahesh Chaudhari
Andrew, 
when so ever theme style may get applied but
I am doing this in enter signal handler i.e. whenever I keep mouse pointer over 
button ,
style of the normal state copied to prelight state 
 



On Thursday, 7 November 2013 10:46 AM, Andrew Potter  wrote:
  
On Thu, Nov 7, 2013 at 4:10 AM, Mahesh Chaudhari
 wrote:
> Also (unsuccessfully) tried :
> void enter_button1(GtkWidget *widget, gpointer data)
> {
>     GtkStyle *style;
>     style = gtk_widget_get_style(button1);
>     style->bg[GTK_STATE_PRELIGHT] = style->bg[GTK_STATE_NORMAL];
>     gtk_widget_set_style(button1, style);
> }

This may not have worked because the theme style may be being applied
after you call this function.

I would make a custom CSS theme and load it with priority
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION.

See https://developer.gnome.org/gtk3/stable/GtkCssProvider.htmland
https://developer.gnome.org/gtk3/stable/GtkStyleContext.html#gtk-style-context-add-provider-for-screen
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


deactivate "enter" signal on GtkButton

2013-11-07 Thread Mahesh Chaudhari
Hi , 
which one to use if I wants my button should not glow on hovering mouse pointer 
over the button 
 
1. g_signal_handler_block() 
2. g_signal_handler_disconnect()
3. g_signal_stop_emmission()
4. g_signal_override_class_closure()
5. g_signal_override_class_handler()
6. gtk_widget_set_events()    // tried with no success
 
Also (unsuccessfully) tried : 
 
void enter_button1(GtkWidget *widget, gpointer data)
{
    GtkStyle *style;
    style = gtk_widget_get_style(button1);
    style->bg[GTK_STATE_PRELIGHT] = style->bg[GTK_STATE_NORMAL];
    gtk_widget_set_style(button1, style);
} 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: not able to change color of widget

2013-11-06 Thread Mahesh Chaudhari
Many thanks Ruslan, 
got my things working now...
except with one problem that is  
all widgets (mostly buttons) fitted into top level window disappears when I 
switch window and come back 



On Friday, 1 November 2013 2:13 PM, Ruslan Kabatsayev  
wrote:
  
OK, now I see your problem. You set new color for the button, and
don't really allow GTK to redraw it. I.e. you change color variable,
but actual widget is not updated. Moreover, as your program is in busy
waiting, the user can't interact with it.

Let's think busy waiting is by design. Now you need to update your
button, in other words, you want to process all pending events. This
can be done by adding the following code at the end of your while()
loop:

while(gtk_events_pending())
    gtk_main_iteration_do(FALSE);

This will do gtk_main iteration for all pending events, then let you
continue your outer while() loop.


On Fri, Nov 1, 2013 at 3:56 PM, Mahesh Chaudhari
 wrote:
> thanks Ruslan,
> it worked, it meant problem lies with other logic (using INOTIFY to wait for
> file change)
> The entire code (clean compilable) is
>
> #include
> #include
> #include
> #define EVENT_SIZE  ( sizeof (struct inotify_event) )
> #define BUF_LEN     ( 1024 * ( EVENT_SIZE + 16 ) )
> GtkWidget *button1, *button2, *button3, *button4, *button5;
>  void click_button1(GtkWidget *widget, gpointer data)
> {
>   printf("in click_button1\n");
>   GdkColor color;
>   color.red = 27000;
>   color.green = 30325;
>   color.blue = 34181;
> //  gtk_widget_modify_fg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
>   gtk_widget_modify_bg(GTK_WIDGET(button1), GTK_STATE_NORMAL, &color);
> }
>  void click_button2(GtkWidget *widget, gpointer data)
> {
>   printf("in click_button2\n");
>   GdkColor color;
>   color.red = 27000;
>   color.green = 30325;
>   color.blue = 34181;
> //  gtk_widget_modify_fg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
>   gtk_widget_modify_bg(GTK_WIDGET(button2), GTK_STATE_NORMAL, &color);
> }
> void click_button_start(GtkWidget *widget, gpointer data)
> {
>         int notifyfd, watchfd, len=0;
>         notifyfd = inotify_init();
>         if (notifyfd<0)perror("inotify_init failed\n");
>         watchfd = inotify_add_watch(notifyfd,
> "/home/user/Desktop/mahesh/GTK+/trials/putty.log", IN_MODIFY);
>         if(watchfd<0)perror("inotify_add_watch failed\n");
>         while(1)
>         {
>         printf("waiting for file change\n");
>         struct inotify_event* event = malloc(BUF_LEN);
>         len = read(notifyfd, event, BUF_LEN);
>         if(len>0){
>                 gtk_button_clicked(GTK_BUTTON(button1));
>         }
>         free(event);
>         }
>  }
>
> int main (int argc,char **argv)
> {
>     GtkWidget *button_start;
>     GtkWidget *window;
>
>     GtkWidget *hbox,*vbox;
>     GdkColor color;
>     gdk_color_parse ("blue", &color);
>     gtk_init (&argc,&argv);
>
>     /*...create top level window...*/
>
>     window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>     gtk_window_set_title(GTK_WINDOW(window), "LED status");
>     gtk_window_set_default_size(GTK_WINDOW(window), 250, 80);
>     gtk_container_set_border_width(GTK_CONTAINER(window), 5);
>     g_signal_connect (G_OBJECT(window), "destroy",
>             G_CALLBACK (gtk_main_quit), NULL);
>
>     /*. create buttons ..*/
>     button_start = gtk_button_new_with_label("start");
>     g_signal_connect(G_OBJECT(button_start), "clicked",
>     G_CALLBACK(click_button_start), NULL);
>     button1 = gtk_button_new_with_label ("button1");
>     g_signal_connect(G_OBJECT(button1), "clicked",
>     G_CALLBACK(click_button1), NULL);
>     button2 = gtk_button_new_with_label ("button2");
>     g_signal_connect(G_OBJECT(button2), "clicked",
>     G_CALLBACK(click_button2), NULL);
>     button3 = gtk_button_new_with_label ("button3");
>     button4 = gtk_button_new_with_label ("button4");
>     button5 = gtk_button_new_with_label ("button5");
>
>     /*.. Alignements..*/
>
>     hbox = gtk_hbox_new(TRUE,1);
>     vbox = gtk_vbox_new(TRUE,1);
>     gtk_box_pack_start(GTK_BOX(hbox), button1, 1, 1, 0);
>     gtk_box_pack_start(GTK_BOX(hbox), button2, 1, 1, 0);
>     gtk_box_pack_start(GTK_BOX(hbox), button3, 1, 1, 0);
>     gtk_box_pack_start(GTK_BOX(hbox), button4, 1, 1, 0);
>     gtk_box_pack_start(GTK_BOX(hbox), button5, 1, 1, 0);
>     gtk_box_pack_start(GTK_BOX(vbox), button_start, 1, 1, 0);

Re: not able to change color of widget

2013-11-01 Thread Mahesh Chaudhari
thanks Ruslan, 
it worked, it meant problem lies with other logic (using INOTIFY to wait for 
file change)
The entire code (clean compilable) is 
 
#include
#include
#include
#define EVENT_SIZE  ( sizeof (struct inotify_event) )
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
GtkWidget *button1, *button2, *button3, *button4, *button5;
 void click_button1(GtkWidget *widget, gpointer data)
{
  printf("in click_button1\n");
  GdkColor color;
  color.red = 27000;
  color.green = 30325;
  color.blue = 34181;
//  gtk_widget_modify_fg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
  gtk_widget_modify_bg(GTK_WIDGET(button1), GTK_STATE_NORMAL, &color);
}
 void click_button2(GtkWidget *widget, gpointer data)
{
  printf("in click_button2\n");
  GdkColor color;
  color.red = 27000;
  color.green = 30325;
  color.blue = 34181;
//  gtk_widget_modify_fg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
  gtk_widget_modify_bg(GTK_WIDGET(button2), GTK_STATE_NORMAL, &color);
}
void click_button_start(GtkWidget *widget, gpointer data)
{
    int notifyfd, watchfd, len=0;
    notifyfd = inotify_init();
    if (notifyfd<0)perror("inotify_init failed\n");
    watchfd = inotify_add_watch(notifyfd, 
"/home/user/Desktop/mahesh/GTK+/trials/putty.log", IN_MODIFY);
    if(watchfd<0)perror("inotify_add_watch failed\n");
    while(1)
    {
    printf("waiting for file change\n");
    struct inotify_event* event = malloc(BUF_LEN);
    len = read(notifyfd, event, BUF_LEN);
    if(len>0){ 
    gtk_button_clicked(GTK_BUTTON(button1));
    }
    free(event);
    }
 }
 
int main (int argc,char **argv)
{
    GtkWidget *button_start;
    GtkWidget *window;
    GtkWidget *hbox,*vbox;
    GdkColor color;
    gdk_color_parse ("blue", &color);
    gtk_init (&argc,&argv);
 
    /*...create top level window...*/
 
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(window), "LED status");
    gtk_window_set_default_size(GTK_WINDOW(window), 250, 80);
    gtk_container_set_border_width(GTK_CONTAINER(window), 5);
    g_signal_connect (G_OBJECT(window), "destroy",
    G_CALLBACK (gtk_main_quit), NULL);
 
    /*. create buttons ..*/    
    button_start = gtk_button_new_with_label("start");
    g_signal_connect(G_OBJECT(button_start), "clicked",
    G_CALLBACK(click_button_start), NULL);
    button1 = gtk_button_new_with_label ("button1");
    g_signal_connect(G_OBJECT(button1), "clicked",
    G_CALLBACK(click_button1), NULL);
    button2 = gtk_button_new_with_label ("button2");
    g_signal_connect(G_OBJECT(button2), "clicked",
    G_CALLBACK(click_button2), NULL);
    button3 = gtk_button_new_with_label ("button3");
    button4 = gtk_button_new_with_label ("button4");
    button5 = gtk_button_new_with_label ("button5");
 
    /*.. Alignements..*/
 
    hbox = gtk_hbox_new(TRUE,1);
    vbox = gtk_vbox_new(TRUE,1);
    gtk_box_pack_start(GTK_BOX(hbox), button1, 1, 1, 0);
    gtk_box_pack_start(GTK_BOX(hbox), button2, 1, 1, 0);
    gtk_box_pack_start(GTK_BOX(hbox), button3, 1, 1, 0);
    gtk_box_pack_start(GTK_BOX(hbox), button4, 1, 1, 0);
    gtk_box_pack_start(GTK_BOX(hbox), button5, 1, 1, 0);
    gtk_box_pack_start(GTK_BOX(vbox), button_start, 1, 1, 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, 1, 1, 0);
    gtk_container_add (GTK_CONTAINER (window), vbox);
 
    /*show...*/
 
    gtk_widget_show_all (window);
  gtk_main();
    return 0;
}



On Friday, 1 November 2013 1:43 AM, Ruslan Kabatsayev  
wrote:
  
Well, it worked. Didn't it work for you?
Also, in the future please give _compilable_ code - it's no fun to fix
compilation errors just to try it out.


On Thu, Oct 31, 2013 at 3:11 PM, Mahesh Chaudhari
 wrote:
> Ruslan ,
>  that is working with mouse clicks (works for me also)
> what I wanted is without clicking with mouse, generate a click signal event
> (through a  program only) and and thus color should be changed
> try this one if possible (click only "start" button with mouse and color of
> button1 should be changed)
>
> GtkWidget *button1, *button2, *button3, *button4, *button5;
>  void click_button1(GtkWidget *widget, gpointer data)
> {
>   printf("in click_button1\n");
>   GdkColor color;
>   color.red = 27000;
>   color.green = 30325;
>   color.blue = 34181;
> //  gtk_widget_modify_fg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
>   gtk_widget_modify_bg(GTK_WIDGET(button1), GTK_STATE_NORMAL, &color);
> }
>
> void click_button_start(GtkWidget *widget, gpointer 

not able to change color of widget

2013-10-31 Thread Mahesh Chaudhari
what am I doing wrong in Following Code : 

GtkWidget *button1;
 void click_button1(GtkWidget *widget, gpointer data)
 {
   printf("I am in click_button\n");// able to print this 
   GdkColor color;
   color.red = 27000;
   color.green = 30325;
   color.blue = 34181;
   gtk_widget_modify_bg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
//gtk_widget_modify_fg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
 }
 
 
 some_callback_func()
 {  
  gtk_button_clicked(GTK_BUTTON(button1));
    . }

 
 
 
int main(int argc, char** argv)
{
  gtk_init(&argc,&argv);  
    button1 = gtk_button_new_with_label ("button1");
 g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(click_button1), 
NULL);  
 gtk_widget_show_all (window);
 gtk_main();
 return 0;
 }
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


gtk_widget_modify_bg - does not work

2013-10-15 Thread Mahesh Chaudhari
what am I doing wrong in Following Code 
 
GtkWidget *button1;
void click_button1(GtkWidget *widget, gpointer data)
{
  GdkColor color;
  color.red = 27000;
  color.green = 30325;
  color.blue = 34181;
  gtk_widget_modify_bg(GTK_WIDGET(widget), GTK_STATE_NORMAL, &color);
}
some_callback_func()
{  
 gtk_button_clicked(GTK_BUTTON(button1));
   . }
main()
{
   button1 = gtk_button_new_with_label ("button1");
    g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(click_button1), 
NULL);  
    gtk_widget_show_all (window);
    gtk_main();
    return 0;
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Clicked event on GtkButton

2013-10-11 Thread Mahesh Chaudhari
Does it make any difference, generating "clicked" event using mouse click OR 
gtk_button_clicked() call
My clicked event callback rightly changes background colour when clicked using 
mouse however change does not reflect when the event is generated using 
gtk_button_clicked() with following code :

Gtkwidget *button1;
void click_button1(GtkWidget *widget, gpointer data)
{
  GdkColor color;
  color.red = 27000;
  color.green = 30325;
  color.blue = 34181;
  gtk_widget_modify_bg(button1, GTK_STATE_NORMAL, &color);
  gtk_widget_show_now(GTK_BUTTON(button1));
}


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


Re: Output Widgets

2013-10-07 Thread Mahesh Chaudhari
Output widget in the sense , user is informed (e.g. by changing widget's color) 
about some system events not user provides input (e.g button press, mouse 
clicks)
in short I wanted to represent an LED which should change color according to 
some condition  
 


 From: Dov Grobgeld 
To: Mahesh Chaudhari  
Cc: "gtk-app-devel-list@gnome.org"  
Sent: Monday, 7 October 2013 3:41 AM
Subject: Re: Output Widgets
  


Please define what you mean with an "output" widget. All widgets are output 
widgets in a sense, but e.g. GtkLabel is an output label for text messages (and 
images).




On Mon, Oct 7, 2013 at 12:44 PM, Mahesh Chaudhari  
wrote:

Are there any output widgets available with GTK+-2.0
>___
>gtk-app-devel-list mailing list
>gtk-app-devel-list@gnome.org
>https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Output Widgets

2013-10-07 Thread Mahesh Chaudhari
Are there any output widgets available with GTK+-2.0 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


how to label a cairo drawings in gtk+-2.0

2013-10-03 Thread Mahesh Chaudhari
Hi List,
I have drawn five circles in GtkDrawingArea as below :
 
#include 
#include 
#include

    GtkWidget* window;
    GtkWidget* darea;
static gboolean on_expose_event(GtkWidget *widget, GdkEventExpose *event, 
gpointer data)
    {
    cairo_t *cr;
    cr = gdk_cairo_create(darea->window);
    cairo_arc(cr,50,60,20,0,2*M_PI);
    cairo_arc(cr,110,60,20,0,2*M_PI);
    cairo_arc(cr,170,60,20,0,2*M_PI);
    cairo_arc(cr,230,60,20,0,2*M_PI);
    cairo_arc(cr,300,60,20,0,2*M_PI);
    cairo_set_source_rgba (cr, 0.5, 0, 0, 0.5);
    cairo_fill(cr);
    }
int main(int argc, char **argv)
    {
    gtk_init(&argc, &argv);
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size(GTK_WINDOW(window), 400, 100);
    darea = gtk_drawing_area_new();
    gtk_container_add(GTK_CONTAINER(window), darea);
    g_signal_connect(darea, "expose-event",
  G_CALLBACK(on_expose_event), NULL);

    gtk_widget_show_all(window);
    gtk_main();
    return 0;
    }
 
I want to put label(text) above each circle, Also colour should be change after 
few seconds 
How can I do this ? I have to use CentOS-5.3 which has gtk+-2.10.0 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: changing colour of widget

2013-10-03 Thread Mahesh Chaudhari
Thanks Vest V for reply 
I can able to draw circles using GtkDrawingArea and cairo 
but is there any alternative to GIO as I have to use CentOS-5.3 (glib version 
2.10) and I think GIO is not supported in this version
  OR 
from where do I install GIO library  
 


 From: Vest V. 
To: "gtk-app-devel-list@gnome.org"  
Sent: Thursday, 26 September 2013 4:11 AM
Subject: Re: changing colour of widget
  

Hello Mahesh,

It depends on which approach you want to use: draw LEDs manually, or
display images. The first possible widget is GtkDrawingArea:
https://developer.gnome.org/gtk3/3.2/GtkDrawingArea.html,the second is
GtkImage: https://developer.gnome.org/gtk3/3.2/GtkImage.html

Regarding the event: probably you need GIO library (especially the
GFileMonitor: https://developer.gnome.org/gio/unstable/GFileMonitor.html)

Kind regards,
Vlad


On Thu, Sep 26, 2013 at 12:17 PM, Mahesh Chaudhari <
mahesh.chaudh...@ymail.com> wrote:

> Hi List,
> I am very new to GTK+ programming and got a task of developing user
> interface (GUI) to one of our embedded board
> I went through basics of GTK searching for any widget that could represent
> on board LEDs, which can glows (basically changes colour)
> Also, is it possible to generate an event whenever file is updated instead
> of user (mouse clicks, keyboard press)
>
>
> Any Help
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


changing colour of widget

2013-09-26 Thread Mahesh Chaudhari
Hi List,
I am very new to GTK+ programming and got a task of developing user interface 
(GUI) to one of our embedded board 
I went through basics of GTK searching for any widget that could represent on 
board LEDs, which can glows (basically changes colour)
Also, is it possible to generate an event whenever file is updated instead of 
user (mouse clicks, keyboard press)
 
 
Any Help
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list