Skip to content

Commit

Permalink
Add 'Don't Show Again' button to Gtkada dialogs
Browse files Browse the repository at this point in the history
For eng/ide/gnatstudio#254
  • Loading branch information
AnthonyLeonardoGracio committed Feb 28, 2024
1 parent 5dbc4f1 commit 9cdaeaf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
41 changes: 22 additions & 19 deletions src/gtkada-dialogs.adb
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ with Gtkada.Pixmaps; use Gtkada.Pixmaps;

package body Gtkada.Dialogs is

subtype String_6 is String (1 .. 6);
subtype String_16 is String (1 .. 16);
type String_Const_Ptr is access constant String;

Dialog_Button_String : constant array (Button_Range) of String_6 :=
("Yes ",
"No ",
"All ",
"OK ",
"Cancel",
"Abort ",
"Retry ",
"Ignore",
"Help ");
Dialog_Button_String : constant array (Button_Range) of String_16 :=
("Yes ",
"No ",
"All ",
"OK ",
"Cancel ",
"Abort ",
"Retry ",
"Ignore ",
"Help ",
"Don't Show Again");

Yes : aliased constant String := "gtk-yes";
No : aliased constant String := "gtk-no";
Expand All @@ -73,7 +74,8 @@ package body Gtkada.Dialogs is
null,
null,
null,
Help'Access);
Help'Access,
null);

--------------------
-- Message_Dialog --
Expand Down Expand Up @@ -174,13 +176,14 @@ package body Gtkada.Dialogs is

case Result is
when Button_Yes
| Button_No
| Button_All
| Button_OK
| Button_Cancel
| Button_Abort
| Button_Retry
| Button_Ignore =>
| Button_No
| Button_All
| Button_OK
| Button_Cancel
| Button_Abort
| Button_Retry
| Button_Ignore
| Button_Dont_Show_Again =>

Destroy (Dialog);
return Result;
Expand Down
23 changes: 12 additions & 11 deletions src/gtkada-dialogs.ads
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ package Gtkada.Dialogs is
type Message_Dialog_Buttons is mod 2 ** 32;
-- Define the set of values a button in a message dialog box can have.

type Button_Range is range 0 .. 8;
type Button_Range is range 0 .. 9;
-- The range of valid buttons.

Button_None : constant Message_Dialog_Buttons := 0;
Button_Yes : constant Message_Dialog_Buttons := 2 ** 0;
Button_No : constant Message_Dialog_Buttons := 2 ** 1;
Button_All : constant Message_Dialog_Buttons := 2 ** 2;
Button_OK : constant Message_Dialog_Buttons := 2 ** 3;
Button_Cancel : constant Message_Dialog_Buttons := 2 ** 4;
Button_Abort : constant Message_Dialog_Buttons := 2 ** 5;
Button_Retry : constant Message_Dialog_Buttons := 2 ** 6;
Button_Ignore : constant Message_Dialog_Buttons := 2 ** 7;
Button_Help : constant Message_Dialog_Buttons := 2 ** 8;
Button_None : constant Message_Dialog_Buttons := 0;
Button_Yes : constant Message_Dialog_Buttons := 2 ** 0;
Button_No : constant Message_Dialog_Buttons := 2 ** 1;
Button_All : constant Message_Dialog_Buttons := 2 ** 2;
Button_OK : constant Message_Dialog_Buttons := 2 ** 3;
Button_Cancel : constant Message_Dialog_Buttons := 2 ** 4;
Button_Abort : constant Message_Dialog_Buttons := 2 ** 5;
Button_Retry : constant Message_Dialog_Buttons := 2 ** 6;
Button_Ignore : constant Message_Dialog_Buttons := 2 ** 7;
Button_Help : constant Message_Dialog_Buttons := 2 ** 8;
Button_Dont_Show_Again : constant Message_Dialog_Buttons := 2 ** 9;

type Message_Dialog_Type is
(Warning,
Expand Down

0 comments on commit 9cdaeaf

Please sign in to comment.