void
create_input_dialog ()
{
  static GtkWidget *inputd = NULL;

  if (!inputd)
    {
      inputd = gtk_input_dialog_new();

      g_signal_connect (inputd, "destroy",
                        G_CALLBACK (input_dialog_destroy), (gpointer) &inputd);
      g_signal_connect_swapped (GTK_INPUT_DIALOG (inputd)->close_button,
                                "clicked",
                                G_CALLBACK (gtk_widget_hide),
                                inputd);
      gtk_widget_hide (GTK_INPUT_DIALOG (inputd)->save_button);

      gtk_widget_show (inputd);
    }
  else
    {
      if (!gtk_widget_get_mapped (inputd))
        gtk_widget_show (inputd);
      else
        gdk_window_raise (inputd->window);
    }
}
Exemplo n.º 2
0
/*
 * Creates a new GtkWidget of class GtkInputDialog, performing any specialized
 * initialization needed for the widget to work correctly in this environment.
 * If a dialog box is used to initialize the widget, return NULL from this
 * function, and call data->callback with your new widget when it is done.
 * If the widget needs a special destroy handler, add a signal here.
 */
GtkWidget*
gb_input_dialog_new (GbWidgetNewData *data)
{
  GtkWidget *new_widget = gtk_input_dialog_new ();

  GtkInputDialog *inputdlg = GTK_INPUT_DIALOG (new_widget);

  /* We want it to be treated as a normal window. */
  gtk_window_set_type_hint (GTK_WINDOW (new_widget),
			    GDK_WINDOW_TYPE_HINT_NORMAL);

  gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
		      GTK_SIGNAL_FUNC (editor_close_window), NULL);

  gb_widget_create_from (inputdlg->save_button,
			 data->action == GB_CREATING ? "save_button" : NULL);
  gb_widget_set_child_name (inputdlg->save_button, GladeChildSaveButton);
  /* We need to set it sensitive so the user can select it. */
  gtk_widget_set_sensitive (inputdlg->save_button, TRUE);

  gb_widget_create_from (inputdlg->close_button,
			 data->action == GB_CREATING ? "close_button" : NULL);
  gb_widget_set_child_name (inputdlg->close_button, GladeChildCloseButton);

  gtk_object_set_data (GTK_OBJECT (new_widget), TypeHint,
		       GINT_TO_POINTER (GLADE_TYPE_HINT_DIALOG_INDEX));

  return new_widget;
}
Exemplo n.º 3
0
/****  INPUT DIALOG constructor ****/
int
clip_GTK_INPUTDIALOGNEW(ClipMachine * ClipMachineMemory)
{
   ClipVar  *cv = _clip_spar(ClipMachineMemory, 1);

   char     *title = _clip_parc(ClipMachineMemory, 2);

   GtkWidget *wid = NULL;

   C_widget *cwid;

   CHECKOPT(1, MAP_type_of_ClipVarType);
   CHECKOPT(2, CHARACTER_type_of_ClipVarType);

   wid = gtk_input_dialog_new();
   if (!wid)
      goto err;
   if (_clip_parinfo(ClipMachineMemory, 2) == CHARACTER_type_of_ClipVarType)
    {
       LOCALE_TO_UTF(title);
       gtk_window_set_title(GTK_WINDOW(wid), title);
       FREE_TEXT(title);
    }
  //cwid = (C_widget*)calloc( 1, sizeof(C_widget) );
   cwid = _register_widget(ClipMachineMemory, wid, cv);

   _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj);
   return 0;
 err:
   return 1;
}
Exemplo n.º 4
0
gint conf_tablet( GtkWidget *widget, GdkEvent *event, gpointer data )
{
	GtkAccelGroup* ag = gtk_accel_group_new();

	if (inputd != NULL) return FALSE;	// Stops multiple dialogs being opened

	inputd = gtk_input_dialog_new();
	gtk_window_set_position( GTK_WINDOW(inputd), GTK_WIN_POS_CENTER );

	gtk_signal_connect(GTK_OBJECT (GTK_INPUT_DIALOG (inputd)->close_button), "clicked",
		GTK_SIGNAL_FUNC(delete_inputd), (gpointer) inputd);
	gtk_widget_add_accelerator (GTK_INPUT_DIALOG (inputd)->close_button, "clicked",
		ag, GDK_Escape, 0, (GtkAccelFlags) 0);

	gtk_signal_connect(GTK_OBJECT (inputd), "destroy",
		GTK_SIGNAL_FUNC(delete_inputd), (gpointer) inputd);

	gtk_signal_connect(GTK_OBJECT (inputd), "enable-device",
		GTK_SIGNAL_FUNC(tablet_enable_device), (gpointer) inputd);
	gtk_signal_connect(GTK_OBJECT (inputd), "disable-device",
		GTK_SIGNAL_FUNC(tablet_disable_device), (gpointer) inputd);

	if ( GTK_INPUT_DIALOG (inputd)->keys_list != NULL )
		gtk_widget_hide (GTK_INPUT_DIALOG (inputd)->keys_list);
	if ( GTK_INPUT_DIALOG (inputd)->keys_listbox != NULL )
		gtk_widget_hide (GTK_INPUT_DIALOG (inputd)->keys_listbox);

	gtk_widget_hide (GTK_INPUT_DIALOG (inputd)->save_button);

	gtk_widget_show (inputd);
	gtk_window_add_accel_group(GTK_WINDOW (inputd), ag);

	return FALSE;
}
Exemplo n.º 5
0
static VALUE
rg_initialize(VALUE self)
{
    RBGTK_INITIALIZE(self, gtk_input_dialog_new());
    return Qnil;
}