static void
fetch_oauth_info_cb(GObject* source,
    GAsyncResult* res, gpointer udata)
{
    GtTwitchLoginDlg* self = GT_TWITCH_LOGIN_DLG(udata);
    GError* err = NULL;

    GtOAuthInfo* oauth_info = gt_twitch_fetch_oauth_info_finish(main_app->twitch, res, &err);

    if (err)
    {
        GtkWindow* win = gtk_window_get_transient_for(GTK_WINDOW(self));

        g_assert(GT_IS_WIN(win));

        gt_win_show_error_message(GT_WIN(win), _("Unable to fetch user info"),
            "Unable to fetch user info because: %s", err->message);

        g_error_free(err);
    }
    else
    {
        MESSAGEF("Successfully got username '%s' and id '%s'", oauth_info->user_name, oauth_info->user_id);

        gt_app_set_oauth_info(main_app, oauth_info);

        gt_win_show_info_message(GT_WIN(gtk_window_get_transient_for(GTK_WINDOW(self))),
            _("Successfully logged in to Twitch!"));
    }

    gtk_widget_destroy(GTK_WIDGET(self));
}
Ejemplo n.º 2
0
static void
file_export_dialog_response (GtkWidget *dialog,
                             gint       response_id,
                             gpointer   data)
{
  if (response_id == FILE_SAVE_RESPONSE_OTHER_DIALOG)
    {
      GimpFileDialog *file_dialog = GIMP_FILE_DIALOG (dialog);
      GtkWindow      *parent;
      GtkWidget      *other;
      gchar          *folder;
      gchar          *uri;
      gchar          *name;

      parent = gtk_window_get_transient_for (GTK_WINDOW (dialog));
      folder = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog));
      uri    = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
      name   = file_utils_uri_display_basename (uri);
      g_free (uri);

      other = file_save_dialog_show (file_dialog->image->gimp,
                                     file_dialog->image,
                                     GTK_WIDGET (parent),
                                     _("Save Image"),
                                     FALSE, FALSE, NULL);

      gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (other), folder);
      gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (other), name);

      g_free (folder);
      g_free (name);
    }
}
Ejemplo n.º 3
0
static void
gpa_file_sign_dialog_get_property (GObject     *object,
				   guint        prop_id,
				   GValue      *value,
				   GParamSpec  *pspec)
{
  GpaFileSignDialog *dialog = GPA_FILE_SIGN_DIALOG (object);

  switch (prop_id)
    {
    case PROP_WINDOW:
      g_value_set_object (value,
			  gtk_window_get_transient_for (GTK_WINDOW (dialog)));
      break;
    case PROP_FORCE_ARMOR:
      g_value_set_boolean (value,
			   gpa_file_sign_dialog_get_force_armor (dialog));
      break;
    case PROP_ARMOR:
      g_value_set_boolean (value, gpa_file_sign_dialog_get_armor (dialog));
      break;
    case PROP_FORCE_SIG_MODE:
      g_value_set_boolean (value,
			   gpa_file_sign_dialog_get_force_sig_mode (dialog));
      break;
    case PROP_SIG_MODE:
      g_value_set_int (value, gpa_file_sign_dialog_get_sig_mode (dialog));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
Ejemplo n.º 4
0
JNIEXPORT jlong JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1get_1transient_1for
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	GtkWindow* result;
	jlong _result;
	GtkWindow* self;

	// convert parameter self
	self = (GtkWindow*) _self;

	// call function
	result = gtk_window_get_transient_for(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jlong) result;

	// cleanup return value
	if (result != NULL) {
		bindings_java_memory_cleanup((GObject*)result, FALSE);
	}

	// and finally
	return _result;
}
Ejemplo n.º 5
0
static void 
hildon_banner_get_property                      (GObject *object,
                                                 guint prop_id,
                                                 GValue *value,
                                                 GParamSpec *pspec)
{
    HildonBannerPrivate *priv = HILDON_BANNER_GET_PRIVATE (object);
    g_assert (priv);

    switch (prop_id)
    {
        case PROP_TIMEOUT:
             g_value_set_uint (value, priv->timeout);
             break;
 
        case PROP_IS_TIMED:
            g_value_set_boolean (value, priv->is_timed);
            break;

        case PROP_PARENT_WINDOW:
            g_value_set_object (value, gtk_window_get_transient_for (GTK_WINDOW (object)));
            break;

        default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
            break;
    }
}
Ejemplo n.º 6
0
static void
seahorse_pkcs11_generate_response (GtkDialog *dialog,
                                   gint response_id)
{
	SeahorsePkcs11Generate *self = SEAHORSE_PKCS11_GENERATE (dialog);
	GTlsInteraction *interaction;
	GtkWindow *parent;

	if (response_id == GTK_RESPONSE_OK) {
		g_return_if_fail (self->token);

		prepare_generate (self);
		parent = gtk_window_get_transient_for (GTK_WINDOW (self));
		interaction = seahorse_interaction_new (parent);

		gck_session_open_async (seahorse_pkcs11_token_get_slot (self->token),
		                        GCK_SESSION_READ_WRITE | GCK_SESSION_LOGIN_USER,
		                        interaction, self->cancellable,
		                        on_generate_open_session, g_object_ref (self));

		seahorse_progress_show (self->cancellable, _("Generating key"), FALSE);
		g_object_unref (interaction);
	}

	gtk_widget_hide (GTK_WIDGET (dialog));
}
Ejemplo n.º 7
0
void
gtr_widget_set_visible( GtkWidget * w, gboolean b )
{
    /* toggle the transient children, too */
    if( GTK_IS_WINDOW( w ) )
    {
        GList * l;
        GList * windows = gtk_window_list_toplevels( );
        GtkWindow * window = GTK_WINDOW( w );

        for( l=windows; l!=NULL; l=l->next )
            if( GTK_IS_WINDOW( l->data ) )
                if( gtk_window_get_transient_for( GTK_WINDOW( l->data ) ) == window )
                    gtr_widget_set_visible( GTK_WIDGET( l->data ), b );

        g_list_free( windows );
    }

#if GTK_CHECK_VERSION( 2,18,0 )
    gtk_widget_set_visible( w, b );
#else
    if( b )
        gtk_widget_show( w );
    else
        gtk_widget_hide( w );
#endif
}
Ejemplo n.º 8
0
/* Create the dialog and connects its buttons */
static void
ensure_dialog (GtkColorButton *button)
{
  GtkWidget *parent, *dialog;

  if (button->priv->cs_dialog != NULL)
    return;

  parent = gtk_widget_get_toplevel (GTK_WIDGET (button));

  button->priv->cs_dialog = dialog = gtk_color_chooser_dialog_new (button->priv->title, NULL);

  if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
  {
    if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (dialog)))
      gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));

    gtk_window_set_modal (GTK_WINDOW (dialog),
                            gtk_window_get_modal (GTK_WINDOW (parent)));
  }

  g_signal_connect (dialog, "response",
                    G_CALLBACK (dialog_response), button);
  g_signal_connect (dialog, "destroy",
                    G_CALLBACK (dialog_destroy), button);
}
Ejemplo n.º 9
0
static void
on_row_activated (GtkTreeView *view,
                  GtkTreePath *path,
                  GtkTreeViewColumn *col,
                  gpointer user_data)
{
	SeahorseGenerateSelect *self = SEAHORSE_GENERATE_SELECT (user_data);
	GtkAction *action;
	GtkWindow *parent;

	action = get_selected_action (self);
	if (action != NULL) {
		parent = gtk_window_get_transient_for (GTK_WINDOW (self));
		if (parent != NULL)
			g_object_ref (parent);

		g_object_ref (action);
		gtk_widget_destroy (GTK_WIDGET (self));

		seahorse_action_activate_with_window (action, NULL, parent);

		g_clear_object (&parent);
		g_object_unref (action);
	}
}
Ejemplo n.º 10
0
static void 
on_response (GtkDialog *dialog,
             gint response,
             gpointer user_data)
{
	SeahorseGenerateSelect *self = SEAHORSE_GENERATE_SELECT (user_data);
	GtkAction *action = NULL;
	GtkWindow *parent = NULL;

	if (response == GTK_RESPONSE_OK) 
		action = get_selected_action (self);
	if (action != NULL) {
		g_object_ref (action);
		parent = gtk_window_get_transient_for (GTK_WINDOW (self));
		if (parent != NULL)
			g_object_ref (parent);
	}

	gtk_widget_destroy (GTK_WIDGET (self));

	if (action != NULL) {
		seahorse_action_activate_with_window (action, NULL, parent);
		g_object_unref (action);
		g_clear_object (&parent);
	}
}
Ejemplo n.º 11
0
static void
on_hide (GtkWindow *window)
{
    GtkWindow *parent = gtk_window_get_transient_for (window);

    if (parent && GTK_WIDGET_DRAWABLE (parent))
        gtk_window_present (parent);

    g_signal_handlers_disconnect_by_func (window, (gpointer) on_hide, NULL);
}
/* Create the dialog and connects its buttons */
static void
ensure_dialog (GtkSourceStyleSchemeChooserButton *button)
{
	GtkSourceStyleSchemeChooserButtonPrivate *priv = GET_PRIV (button);
	GtkWidget *parent, *dialog, *scrolled_window;
	GtkWidget *content_area;

	if (priv->dialog != NULL)
	{
		return;
	}

	parent = gtk_widget_get_toplevel (GTK_WIDGET (button));

	/* TODO: have a ChooserDialog? */
	priv->dialog = dialog = gtk_dialog_new_with_buttons (_("Select a Style"),
	                                                     GTK_WINDOW (parent),
	                                                     GTK_DIALOG_DESTROY_WITH_PARENT |
	                                                     GTK_DIALOG_USE_HEADER_BAR,
	                                                     _("_Cancel"), GTK_RESPONSE_CANCEL,
	                                                     _("_Select"), GTK_RESPONSE_OK,
	                                                     NULL);
	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);

	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
	gtk_widget_set_size_request (scrolled_window, 325, 450);
	gtk_widget_show (scrolled_window);
	gtk_widget_set_hexpand (scrolled_window, TRUE);
	gtk_widget_set_vexpand (scrolled_window, TRUE);
	content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
	gtk_container_add (GTK_CONTAINER (content_area), scrolled_window);

	priv->chooser = GTK_SOURCE_STYLE_SCHEME_CHOOSER_WIDGET (gtk_source_style_scheme_chooser_widget_new ());
	gtk_widget_show (GTK_WIDGET (priv->chooser));
	gtk_source_style_scheme_chooser_set_style_scheme (GTK_SOURCE_STYLE_SCHEME_CHOOSER (priv->chooser),
	                                                  priv->scheme);

	gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (priv->chooser));

	if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
	{
		if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (dialog)))
		{
			gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
		}

		gtk_window_set_modal (GTK_WINDOW (dialog),
		                      gtk_window_get_modal (GTK_WINDOW (parent)));
	}

	g_signal_connect (dialog, "response",
	                  G_CALLBACK (dialog_response), button);
	g_signal_connect (dialog, "destroy",
	                  G_CALLBACK (dialog_destroy), button);
}
Ejemplo n.º 13
0
static void
mate_color_button_clicked (GtkButton *button)
{
  MateColorButton *color_button = MATE_COLOR_BUTTON (button);
  MateColorSelectionDialog *color_dialog;

  /* if dialog already exists, make sure it's shown and raised */
  if (!color_button->priv->cs_dialog) 
    {
      /* Create the dialog and connects its buttons */
      GtkWidget *parent;
      
      parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button));
      
      color_button->priv->cs_dialog = mate_color_selection_dialog_new (color_button->priv->title);
      
      color_dialog = MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);

      if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
        {
          if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (color_dialog)))
 	    gtk_window_set_transient_for (GTK_WINDOW (color_dialog), GTK_WINDOW (parent));
	       
	  gtk_window_set_modal (GTK_WINDOW (color_dialog),
				gtk_window_get_modal (GTK_WINDOW (parent)));
	}
      
      g_signal_connect (color_dialog->ok_button, "clicked",
                        G_CALLBACK (dialog_ok_clicked), color_button);
      g_signal_connect (color_dialog->cancel_button, "clicked",
			G_CALLBACK (dialog_cancel_clicked), color_button);
      g_signal_connect (color_dialog, "destroy",
                        G_CALLBACK (dialog_destroy), color_button);
    }

  color_dialog = MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);

  mate_color_selection_set_has_opacity_control (MATE_COLOR_SELECTION (color_dialog->colorsel),
                                               color_button->priv->use_alpha);

  mate_color_selection_set_has_palette (MATE_COLOR_SELECTION (color_dialog->colorsel), TRUE);
  
  mate_color_selection_set_previous_color (MATE_COLOR_SELECTION (color_dialog->colorsel), 
					  &color_button->priv->color);
  mate_color_selection_set_previous_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), 
					  color_button->priv->alpha);

  mate_color_selection_set_current_color (MATE_COLOR_SELECTION (color_dialog->colorsel), 
					 &color_button->priv->color);
  mate_color_selection_set_current_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel), 
					 color_button->priv->alpha);

  gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog));
}
Ejemplo n.º 14
0
static void
rejilla_status_dialog_joliet_rename_cb (RejillaTrackData *track,
					RejillaStatusDialog *dialog)
{
	GtkResponseType answer;
	GtkWindow *transient_win;
	GtkWidget *message;
	gchar *secondary;

	g_signal_emit (dialog,
	               rejilla_status_dialog_signals [USER_INTERACTION],
	               0);

	gtk_widget_hide (GTK_WIDGET (dialog));

	transient_win = gtk_window_get_transient_for (GTK_WINDOW (dialog));
	message = gtk_message_dialog_new (transient_win,
					  GTK_DIALOG_DESTROY_WITH_PARENT|
					  GTK_DIALOG_MODAL,
					  GTK_MESSAGE_WARNING,
					  GTK_BUTTONS_NONE,
					  "%s",
					  _("Should files be renamed to be fully Windows-compatible?"));

	if (gtk_window_get_icon_name (GTK_WINDOW (dialog)))
		gtk_window_set_icon_name (GTK_WINDOW (message),
					  gtk_window_get_icon_name (GTK_WINDOW (dialog)));
	else if (transient_win)
		gtk_window_set_icon_name (GTK_WINDOW (message),
					  gtk_window_get_icon_name (transient_win));

	secondary = g_strdup_printf ("%s\n%s",
				     _("Some files don't have a suitable name for a fully Windows-compatible CD."),
				     _("Those names should be changed and truncated to 64 characters."));
	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), "%s", secondary);
	g_free (secondary);

	gtk_dialog_add_button (GTK_DIALOG (message),
			       _("_Disable Full Windows Compatibility"),
			       GTK_RESPONSE_CANCEL);
	gtk_dialog_add_button (GTK_DIALOG (message),
			       _("_Rename for Full Windows Compatibility"),
			       GTK_RESPONSE_YES);

	answer = gtk_dialog_run (GTK_DIALOG (message));
	gtk_widget_destroy (message);

	if (answer != GTK_RESPONSE_YES)
		rejilla_track_data_rm_fs (track, REJILLA_IMAGE_FS_JOLIET);
	else
		rejilla_track_data_add_fs (track, REJILLA_IMAGE_FS_JOLIET);

	gtk_widget_show (GTK_WIDGET (dialog));
}
Ejemplo n.º 15
0
void
sp_dialog_defocus (GtkWindow *win)
{
    GtkWindow *w;
    //find out the document window we're transient for
    w = gtk_window_get_transient_for(GTK_WINDOW(win));
    //switch to it

    if (w) {
        gtk_window_present (w);
    }
}
Ejemplo n.º 16
0
static void
remove_catalog_response_cb (GtkDialog *dialog,
			    int        response_id,
			    gpointer   user_data)
{
	GthFileData *file_data = user_data;

	if (response_id == GTK_RESPONSE_YES)
		remove_catalog (gtk_window_get_transient_for (GTK_WINDOW (dialog)), file_data);

	gtk_widget_destroy (GTK_WIDGET (dialog));
	g_object_unref (file_data);
}
Ejemplo n.º 17
0
static gint
gsm_color_button_clicked (GtkWidget * widget, GdkEventButton * event)
{
  GSMColorButton *color_button = GSM_COLOR_BUTTON (widget);
  GtkColorSelectionDialog *color_dialog;

  /* if dialog already exists, make sure it's shown and raised */
  if (!color_button->priv->cs_dialog)
    {
      /* Create the dialog and connects its buttons */
      GtkWidget *parent;

      parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button));

      color_button->priv->cs_dialog =
	gtk_color_selection_dialog_new (color_button->priv->title);

      color_dialog =
	GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);

      if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
	{
	  if (GTK_WINDOW (parent) !=
	      gtk_window_get_transient_for (GTK_WINDOW (color_dialog)))
	    gtk_window_set_transient_for (GTK_WINDOW (color_dialog),
					  GTK_WINDOW (parent));

	  gtk_window_set_modal (GTK_WINDOW (color_dialog),
				gtk_window_get_modal (GTK_WINDOW (parent)));
	}

      g_signal_connect (color_dialog, "response",
                        G_CALLBACK (dialog_response), color_button);

      g_signal_connect (color_dialog, "destroy",
			G_CALLBACK (dialog_destroy), color_button);
    }

  color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);

  gtk_color_selection_set_previous_color (GTK_COLOR_SELECTION
                                          (gtk_color_selection_dialog_get_color_selection (color_dialog)),
					  &color_button->priv->color);

  gtk_color_selection_set_current_color (GTK_COLOR_SELECTION
                                         (gtk_color_selection_dialog_get_color_selection (color_dialog)),
					 &color_button->priv->color);

  gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog));
  return 0;
}
Ejemplo n.º 18
0
static void
dialog_response (GtkDialog *dialog, int response, gpointer user_data)
{
  if (response == DESTROY_PARENT)
    {
      GtkWidget *window = GTK_WIDGET (gtk_window_get_transient_for (GTK_WINDOW (dialog)));

      if (window == window1)
	{
	  gtk_dialog_set_response_sensitive (dialog, ATTACH_1, FALSE);
	  window1 = NULL;
	}
      else
	{
	  gtk_dialog_set_response_sensitive (dialog, ATTACH_2, FALSE);
	  window2 = NULL;
	}

      gtk_dialog_set_response_sensitive (dialog, DESTROY_PARENT, FALSE);
      gtk_dialog_set_response_sensitive (dialog, DETACH, FALSE);
      gtk_widget_destroy (window);
    }
  else if (response == DETACH)
    {
      gtk_window_set_transient_for (GTK_WINDOW (dialog), NULL);
      gtk_dialog_set_response_sensitive (dialog, DESTROY_PARENT, FALSE);
      gtk_dialog_set_response_sensitive (dialog, DETACH, FALSE);
      gtk_dialog_set_response_sensitive (dialog, ATTACH_1, window1 != NULL);
      gtk_dialog_set_response_sensitive (dialog, ATTACH_2, window2 != NULL);
    }
  else if (response == ATTACH_1)
    {
      gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window1));
      gtk_dialog_set_response_sensitive (dialog, DESTROY_PARENT, TRUE);
      gtk_dialog_set_response_sensitive (dialog, DETACH, TRUE);
      gtk_dialog_set_response_sensitive (dialog, ATTACH_1, FALSE);
      gtk_dialog_set_response_sensitive (dialog, ATTACH_2, window2 != NULL);
    }
  else if (response == ATTACH_2)
    {
      gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window2));
      gtk_dialog_set_response_sensitive (dialog, DESTROY_PARENT, TRUE);
      gtk_dialog_set_response_sensitive (dialog, DETACH, TRUE);
      gtk_dialog_set_response_sensitive (dialog, ATTACH_1, window1 != NULL);
      gtk_dialog_set_response_sensitive (dialog, ATTACH_2, FALSE);
    }
  else if (response == GTK_RESPONSE_CLOSE)
    gtk_main_quit ();
}
Ejemplo n.º 19
0
static void
cb_dialog_response (XfburnCopyDvdDialog * dialog, gint response_id, XfburnCopyDvdDialogPrivate * priv)
{
  if (response_id == GTK_RESPONSE_OK) {
    gchar *command;
    XfburnDevice *device_burn;
    XfburnDevice *device_read;
    GtkWidget *dialog_progress = NULL;
  
    device_read = xfburn_device_box_get_selected_device (XFBURN_DEVICE_BOX (priv->device_box_src));
        
    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_only_iso))) {
      command = g_strconcat ("readcd dev=", device_read->node_path, " f=", 
                             gtk_entry_get_text (GTK_ENTRY (priv->entry_path_iso)), NULL);
      
      //      dialog_progress = xfburn_create_iso_progress_dialog_new ();
    } else {
      gint speed;
      gchar *source_device = NULL;
      
      device_burn = xfburn_device_box_get_selected_device (XFBURN_DEVICE_BOX (priv->device_box_dest));
      speed = xfburn_device_box_get_speed (XFBURN_DEVICE_BOX (priv->device_box_dest));
      
      if (device_burn != device_read)
        source_device = g_strconcat (" --source-device ", device_read->node_path, NULL);
      else
        source_device = g_strdup ("");
      
      command = g_strconcat ("cdrdao copy -n -v 2", source_device, 
                             " --device ", device_burn->node_path, " --speed ", speed, 
                             gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_eject)) ? " --eject" : "",
                             gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_dummy)) ? " --simulate" : "",
                             device_burn != device_read && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_onthefly)) ? " --on-the-fly" : "",
                             " --datafile /tmp/xfburn.bin", NULL);
      g_free (source_device);
      
      //      dialog_progress = xfburn_copy_cd_progress_dialog_new ();
    }
  
    gtk_window_set_transient_for (GTK_WINDOW (dialog_progress), gtk_window_get_transient_for (GTK_WINDOW (dialog)));
    gtk_widget_hide (GTK_WIDGET (dialog));
        
    g_object_set_data (G_OBJECT (dialog_progress), "command", command);
    gtk_dialog_run (GTK_DIALOG (dialog_progress));

    g_free (command);
  }
}
void
cc_language_chooser_set_is_small_screen (GtkWidget *chooser,
                                         gboolean   is_small_screen)
{
        CcLanguageChooserPrivate *priv = GET_PRIVATE (chooser);

        if (is_small_screen) {
                gint width, height;

                gtk_window_get_size (gtk_window_get_transient_for (GTK_WINDOW (chooser)), &width, &height);
                gtk_widget_set_size_request (GTK_WIDGET (chooser), width, height);

                gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolledwindow),
                                                GTK_POLICY_AUTOMATIC,
                                                GTK_POLICY_AUTOMATIC);
        }
}
Ejemplo n.º 21
0
static void
gpa_receive_key_dialog_get_property (GObject *object, guint prop_id,
				     GValue *value, GParamSpec *pspec)
{
  GpaReceiveKeyDialog *dialog = GPA_RECEIVE_KEY_DIALOG (object);

  switch (prop_id)
    {
    case PROP_WINDOW:
      g_value_set_object (value,
			  gtk_window_get_transient_for (GTK_WINDOW (dialog)));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
Ejemplo n.º 22
0
static void
_gcr_pkcs11_import_interaction_get_property (GObject *obj,
                                             guint prop_id,
                                             GValue *value,
                                             GParamSpec *pspec)
{
	GcrPkcs11ImportInteraction *self = GCR_PKCS11_IMPORT_INTERACTION (obj);

	switch (prop_id) {
	case PROP_PARENT_WINDOW:
		g_value_set_object (value, gtk_window_get_transient_for (GTK_WINDOW (self->dialog)));
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
		break;
	}
}
Ejemplo n.º 23
0
AthenaUndoManager *
athena_undo_get_undo_manager (GObject *start_object)
{
	AthenaUndoManager *manager;
	GtkWidget *parent;
	GtkWindow *transient_parent;

	if (start_object == NULL) {
		return NULL;
	}

	g_return_val_if_fail (G_IS_OBJECT (start_object), NULL);

	/* Check for an undo manager right here. */
	manager = g_object_get_data (start_object, ATHENA_UNDO_MANAGER_DATA);
	if (manager != NULL) {
		return manager;
	}

	/* Check for undo manager up the parent chain. */
	if (GTK_IS_WIDGET (start_object)) {
		parent = gtk_widget_get_parent (GTK_WIDGET (start_object));
		if (parent != NULL) {
			manager = athena_undo_get_undo_manager (G_OBJECT (parent));
			if (manager != NULL) {
				return manager;
			}
		}

		/* Check for undo manager in our window's parent. */
		if (GTK_IS_WINDOW (start_object)) {
			transient_parent = gtk_window_get_transient_for (GTK_WINDOW (start_object));
			if (transient_parent != NULL) {
				manager = athena_undo_get_undo_manager (G_OBJECT (transient_parent));
				if (manager != NULL) {
					return manager;
				}
			}
		}
	}
	
	/* Found nothing. I can live with that. */
	return NULL;
}
Ejemplo n.º 24
0
static void
gtk_font_button_clicked (GtkButton *button)
{
  GtkFontSelectionDialog *font_dialog;
  GtkFontButton    *font_button = GTK_FONT_BUTTON (button);
  
  if (!font_button->priv->font_dialog) 
    {
      GtkWidget *parent;
      
      parent = gtk_widget_get_toplevel (GTK_WIDGET (font_button));
      
      font_button->priv->font_dialog = gtk_font_selection_dialog_new (font_button->priv->title);
      
      font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
      
      if (GTK_WIDGET_TOPLEVEL (parent) && GTK_IS_WINDOW (parent))
        {
          if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (font_dialog)))
 	    gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (parent));
	       
	  gtk_window_set_modal (GTK_WINDOW (font_dialog),
				gtk_window_get_modal (GTK_WINDOW (parent)));
	}

      g_signal_connect (font_dialog->ok_button, "clicked",
                        G_CALLBACK (dialog_ok_clicked), font_button);
      g_signal_connect (font_dialog->cancel_button, "clicked",
			G_CALLBACK (dialog_cancel_clicked), font_button);
      g_signal_connect (font_dialog, "destroy",
                        G_CALLBACK (dialog_destroy), font_button);
    }
  
  if (!GTK_WIDGET_VISIBLE (font_button->priv->font_dialog)) 
    {
      font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
      
      gtk_font_selection_dialog_set_font_name (font_dialog, font_button->priv->fontname);
      
    } 

  gtk_window_present (GTK_WINDOW (font_button->priv->font_dialog));
}
Ejemplo n.º 25
0
static void on_filter_dialog_response (GtkDialog* dialog, gint response_id, UgSelector* selector)
{
	UgSelectorPage*	page;
	GtkWindow*		parent;

	if (response_id == GTK_RESPONSE_OK) {
		// update selection of page
		page = ug_selector_get_page (selector, -1);
		if (page)
			ug_selector_page_mark_by_filter_all (page);
	}
	// enable parent window
	parent = gtk_window_get_transient_for ((GtkWindow*) dialog);
	if (parent)
		gtk_widget_set_sensitive ((GtkWidget*) parent, TRUE);
	// hide filter dialog
	gtk_widget_hide ((GtkWidget*) dialog);
	// count and notify
	ug_selector_count_marked (selector);
}
Ejemplo n.º 26
0
static void	ug_selector_filter_show (struct UgSelectorFilter* filter, UgSelectorPage* page)
{
	GtkWindow* parent;

	gtk_tree_view_set_model (filter->host_view,
			GTK_TREE_MODEL (page->filter.host));
	gtk_tree_view_set_model (filter->ext_view,
			GTK_TREE_MODEL (page->filter.ext));

	// disable sensitive of parent window
	// enable sensitive in function on_filter_dialog_response()
	parent = gtk_window_get_transient_for ((GtkWindow*) filter->dialog);
	if (parent)
		gtk_widget_set_sensitive ((GtkWidget*) parent, FALSE);
	// create filter dialog
	if (gtk_window_get_modal (parent))
		gtk_dialog_run (filter->dialog);
	else
		gtk_widget_show ((GtkWidget*) filter->dialog);
}
Ejemplo n.º 27
0
void
dh_preferences_show_dialog (GtkWindow *parent)
{
        g_return_if_fail (GTK_IS_WINDOW (parent));

        if (prefs_dialog == NULL) {
                prefs_dialog = GTK_WIDGET (g_object_new (DH_TYPE_PREFERENCES, NULL));
                g_signal_connect (prefs_dialog,
                                  "destroy",
                                  G_CALLBACK (gtk_widget_destroyed),
                                  &prefs_dialog);
        }

        if (parent != gtk_window_get_transient_for (GTK_WINDOW (prefs_dialog))) {
                gtk_window_set_transient_for (GTK_WINDOW (prefs_dialog),
                                              parent);
        }

        gtk_window_present (GTK_WINDOW (prefs_dialog));
}
Ejemplo n.º 28
0
//!
//! @brief The function that does the grunt work of setting up a search using the window
//!
//! The function will get the data from the buttons to set up the query and the dictionary
//! with that to set up the searchitem. 
//!
//! @param widget Currently unused GtkWidget pointer
//! @param data Currently unused gpointer
//!
G_MODULE_EXPORT void 
gw_radicalswindow_search_cb (GtkWidget *widget, gpointer data)
{
    //Declarations
    GwApplication *application;
    GwRadicalsWindow *window;
    GwSearchWindow *searchwindow;
    LwDictInfoList *dictinfolist;
    LwDictInfo *di;
    char *text_query;
    char *text_radicals;
    char *text_strokes;

    //Initializations
    window = GW_RADICALSWINDOW (gtk_widget_get_ancestor (GTK_WIDGET (data), GW_TYPE_RADICALSWINDOW));
    if (window == NULL) return;
    searchwindow = GW_SEARCHWINDOW (gtk_window_get_transient_for (GTK_WINDOW (window)));
    g_assert (searchwindow != NULL);
    application = gw_window_get_application (GW_WINDOW (window));
    dictinfolist = LW_DICTINFOLIST (gw_application_get_dictinfolist (application));
    di = lw_dictinfolist_get_dictinfo (dictinfolist, LW_DICTTYPE_KANJI, "Kanji");
    if (di == NULL) return;

    text_radicals = gw_radicalswindow_strdup_all_selected (window);
    text_strokes = gw_radicalswindow_strdup_prefered_stroke_count (window);
    text_query = g_strdup_printf ("%s%s", text_radicals, text_strokes);

    //Sanity checks
    if (text_query != NULL && strlen(text_query) > 0)
    {
      gw_searchwindow_entry_set_text (searchwindow, text_query);
      gw_searchwindow_set_dictionary (searchwindow, di->load_position);

      gw_searchwindow_search_cb (GTK_WIDGET (searchwindow), searchwindow);
    }

    //Cleanup
    if (text_query != NULL) g_free (text_query);
    if (text_strokes != NULL) g_free (text_strokes);
    if (text_radicals != NULL) g_free (text_radicals);
}
Ejemplo n.º 29
0
static gboolean
realize_hook(GSignalInvocationHint*, unsigned, const GValue* param_values, void*)
{
    void* p = g_value_peek_pointer(param_values);
    if (GTK_IS_SCROLLBAR(p))
    {
        GtkWindow* toplevel = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(p)));
        GtkWindow* transient_parent = gtk_window_get_transient_for(toplevel);
        if (transient_parent && gtk_window_has_group(toplevel))
        {
            GtkWindowGroup* group = gtk_window_get_group(toplevel);
            GtkWindowGroup* group_parent = gtk_window_get_group(transient_parent);
            if (group != group_parent)
            {
                gtk_window_group_add_window(group_parent, toplevel);
                gtk_grab_add(GTK_WIDGET(toplevel));
            }
        }
    }
    return true;
}
Ejemplo n.º 30
0
static void 
warning_dialog_destroyed_cb (GtkWidget *w,
			     G_GNUC_UNUSED gint i,
			     gpointer data)
{
  GList *children = NULL;
  
  children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (w)->vbox));

  g_return_if_fail (data != NULL);

  while (children) {
    
    if (GTK_IS_TOGGLE_BUTTON (children->data)) 
      g_object_set_data (G_OBJECT (gtk_window_get_transient_for (GTK_WINDOW (w))), (const char *) data, GINT_TO_POINTER ((int) (GTK_TOGGLE_BUTTON (children->data)->active)));
  
    children = g_list_next (children);
  }

  gtk_widget_destroy (GTK_WIDGET (w));
}