Help spinbuttons

2015-03-16 Thread Roger Matthews
 

/* I want a window containing many spinbuttons for both
integers and floating-point numbers, these may then be either 1) left
unchanged, or 2) changed to a new value. Then, whether changed or unchanged,
use the integers and floats as input parameters into various calculations. As
it is the printf() statements only show the unchanged values. */

 

/*The example below is taken from page 90 of
Foundations of GTK+ Development by Andrew Krause*/

 

#include stdio.h

#include gtk/gtk.h

 

int main(int argc, char *argv[])

{

GtkWidget *window, *spin_int, *spin_float;

GtkAdjustment *integer, *float_pt;

 

gint number_int;

gdouble number_double;

 

gtk_init (argc, argv);

 

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

gtk_window_set_title (GTK_WINDOW (window), Spin Buttons);

gtk_container_set_border_width (GTK_CONTAINER(window), 10);

gtk_widget_set_size_request (window, 150, 100);

 

integer = GTK_ADJUSTMENT (gtk_adjustment_new (5.0, 0.0,
10.0, 1.0, 2.0, 2.0));

float_pt = GTK_ADJUSTMENT (gtk_adjustment_new (0.5, 0.0, 1.0,
0.1, 0.5, 0.5));

 

spin_int = gtk_spin_button_new (integer, 1.0, 0);

spin_float = gtk_spin_button_new (float_pt, 0.1, 1);

 

gtk_container_add (GTK_CONTAINER (window), spin_int);

gtk_container_add (GTK_CONTAINER (window), spin_float);

 

gtk_widget_show_all (window);

 

number_int=gtk_spin_button_get_value_as_int(spin_int);

number_double=gtk_spin_button_get_value(spin_float);

 

  g_signal_connect
(integer, change-value, G_CALLBACK (spin_int), number_int);

 

  g_print (Hello
World\n);

  g_print
(g_print Before gtk_main, integer %d\n, number_int);

  printf(printf
Before gtk_main, integer %d\n, number_int);

  printf(printf
Before gtk_main, double %f\n, number_double);

 

gtk_main ();

 

  printf(Hello
World\n);

  printf(After
gtk_main %d\n, number_int);

 

return 0;

}

//

/*Below are the commands to edit, compile and execute the
program, and the warnings, messages and output to the terminal. At this stage
the warnings are unimportant, I merely want to be able to read or save both the
unchanged and changed values displayed in the spinbutton(s).*/

/*

 

$ gedit page90.c

 

$ gcc `pkg-config --cflags gtk+-3.0` -o page90.exe page90.c
`pkg-config --libs gtk+-3.0`

 

$ ./page90.exe

 

(page90.exe:2614): Gtk-WARNING **: Attempting to add a
widget with type GtkSpinButton to a GtkWindow, but as a GtkBin subclass a
GtkWindow can only contain one widget at a time; it already contains a widget
of type GtkSpinButton

 

(page90.exe:2614): GLib-GObject-WARNING **:
/build/buildd/glib2.0-2.38.1/./gobject/gsignal.c:2475: signal 'change-value' is
invalid for instance '0xee5350' of type 'GtkAdjustment'

Hello World

g_print Before gtk_main, integer 5

printf Before gtk_main, integer 5

printf Before gtk_main, double 0.50*/

/***/

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


GWin32WinsockFuncs and other stuff

2015-03-16 Thread John Emmas
I just updated from glib-2-42 (git) and tried to build with MSVC but I'm 
suddenly getting tons of compiler errors (particularly relating to 
'ws2funcs').  It seems to get declared at the top of gio/gnetworking.c 
like so:-


   GWin32WinsockFuncs ws2funcs = {0};

but 'GWin32WinsockFuncs' itself doesn't seem to be declared anywhere.  
ws2funcs is also used in other source files too, without being declared 
('gio/ginetaddress.c' and 'gio/gsocket.c').


There's a further problem at line 29 of a newly introduced header file 
(gio/gwin32networking.h):-


typedef NET_IFINDEX (WINAPI *PFN_IfNameToIndex) (PCSTR);

I'm guessing the compiler doesn't know what 'WINAPI' is (the nearby 
typedefs are all declared with 'WSAAPI').  And other problems too. It's 
unusual to get so many source errors at once like this in a stable 
branch.  It kinda has the feel of some development code that got pushed 
to glib-2-42 by mistake maybe?


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


Re: borderless MacOS menus (was 'Gtk3 MacOS (OSX) context menu issues')

2015-03-16 Thread Jim Charlton

On 15-03-15 08:24 PM, Jim Charlton wrote:

On 15-03-15 01:49 PM, Roger Davis wrote:


Thanks for the suggestion, Jim, but no luck so far in getting any 
change to my menu borders via


.window-frame, .window-frame:backdrop {
  box-shadow: 6px 6px;
  margin: 6px;
}

which I added to a new $XDG_CONFIG_HOME/gtk-3.0/gtk.css file. This 
file is definitely being parsed at app startup time, because if I change


.window-frame, .window-frame:backdrop {

to instead read

* {

I get the most hideous GUI imaginable, i.e., big ugly shadow borders 
around almost everything *except* my menus, which are still 
completely borderless! It just seems like my system is flat-out never 
drawing any menu borders no matter what.


Roger


On Sun, 15 Mar 2015, Jim Charlton wrote:

My experience has been that I can set the XDG_CONFIG_HOME 
environment variable to the path to the gtk-3.0 directory (eg. 
/opt/local/share/themes/Default) and then put both the gtk.css and 
the settings.ini file in the 
/opt/local/share/themes/Default/gtk-3.0/ directory. When a gtk3 
application is run, both files will be processed.  You can put css 
into the gtk.css file and it seems to override the in-line 
(compiled?) theme data.  If you do figure out how to put shadowed 
margins on the menus, let us know if it brings back the item 
selection problem.



If you just want to put a border on the menubar you can try adding

.menubar {
  border-width: 6px;
  background-color: red;
  border-color: black;
  border-style: solid;
}

to the gtk.css file.  This will give a red background and a wide, 
black border to the menubar.  Or apply the same configuration to 
.menuitem to give background color and borders to all menu items in 
the menubar and in the dropdown menu boxes.


I am not quite sure how you could make it shadowed.

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

Ahhh...  you can get shadowed borders by adding something like

.menubar {
  border-width: 1px;
  box-shadow:  inset 0 0 10px #00;|
border-style: solid;
}

You can experiment with various box-shadow parameters.

jim...

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


Re: GWin32WinsockFuncs and other stuff

2015-03-16 Thread fanc999

Hello John,

Can you post the exact error message from the Visual Studio build (you 
might need to clean up your build tree though)-the code built fine on 
Visual Studio 2008+.  Let me know, and I will try to look at it--I don't 
have Visual Studio 2005 as you do, just to give a heads up, as that is 
what I understand you use.


Does the current git master build for you as well, or you have the same 
errors?


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


Re: GWin32WinsockFuncs and other stuff

2015-03-16 Thread John Emmas

On 16/03/2015 17:07, fanc...@yahoo.com.tw wrote:

Hello John,

Can you post the exact error message from the Visual Studio build (you 
might need to clean up your build tree though)-the code built fine on 
Visual Studio 2008+.  Let me know, and I will try to look at it--I 
don't have Visual Studio 2005 as you do, just to give a heads up, as 
that is what I understand you use.



Hi Fan and yes, I'm building with VC2005.

The first error when building gnetworking.c is this:-
gio\gwin32networking.h(29) : error C2143: syntax error : missing ')' 
before '__stdcall'


  which occurs here:-
  typedef NET_IFINDEX (WINAPI *PFN_IfNameToIndex) (PCSTR);

(and the same error occurs when building ginetaddress.c)

When building gnetworking.c, I also see:-
gio\gnetworking.c(29) : error C2061: syntax error : identifier 'ws2funcs'

  which occurs at line 29:-
  GWin32WinsockFuncs ws2funcs = {0};

When building ginetaddress.c, I also see:-
gio\ginetaddress.c(391) : error C2065: 'ws2funcs' : undeclared identifier

  which occurs at line 391:-
  if (ws2funcs.pInetPton != NULL)




Does the current git master build for you as well, or you have the 
same errors?


I get exactly the same errors when building master - which is maybe a 
good thing..?


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


GLib is branched

2015-03-16 Thread Ryan Lortie
karaj,

I just released GLib 2.43.92 and branched.  'glib-2-44' is what will
become 2.44.0 and 'master' is what will become 2.46.

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


Re: borderless MacOS menus (was 'Gtk3 MacOS (OSX) context menu issues')

2015-03-16 Thread Roger Davis


On Mon, 16 Mar 2016, Jim Charlton wrote:


.menubar {
 border-width: 6px;
 background-color: red;
 border-color: black;
 border-style: solid;
}


Thanks Jim, that tip led to this good-enough-for-now solution:

GtkMenu {
  border-width: 1px;
  border-color: #cc;
  border-style: solid;
  box-shadow: inset -1px -1px 2px #77;
}

GtkMenu is equivalent to .menu as far as I can tell, and both worked for 
me -- can anyone comment? The .menubar style class does not work as these 
are popup menus, not menubars. (Curiously, .popup does not work, which 
would seem to apply according to the GtkStyleContext man page.)


My earlier attempt with

* {

did not work because I wasn't specifying the correct property entries. 
(border-width and border-style are key, I was incorrectly using margin 
before.)


Box shadows seem totally unattainable on my MacOS system if I do not use 
the optional (!?!) 'inset' specifier. I actually do not want an inset 
shadow (I want outset?) but the above specification creates a shadow 
that's subtle enough that you can't easily tell the difference.


Many minor gtk3 style inconsistencies remain between my MacOS and CentOS 7 
boxes, but I think for now I've whacked all that exceed my personal 
hideousity threshold.


Thanks!

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