示例#1
0
static void
update_sensitivity (DialogData *data)
{
	gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog),
					   GTK_RESPONSE_OK,
					   (IS_ACTIVE (GET_WIDGET ("change_last_modified_checkbutton"))
					    || IS_ACTIVE (GET_WIDGET ("change_comment_checkbutton"))));
	gtk_widget_set_sensitive (data->date_selector, IS_ACTIVE (GET_WIDGET ("to_following_date_radiobutton")));
	gtk_widget_set_sensitive (GET_WIDGET ("time_box"), IS_ACTIVE (GET_WIDGET ("adjust_time_radiobutton")));

	if (IS_ACTIVE (GET_WIDGET ("change_last_modified_checkbutton"))) {
		gtk_widget_set_sensitive (GET_WIDGET ("to_last_modified_date_radiobutton"), FALSE);
		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_last_modified_date_radiobutton"))))
			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_following_date_radiobutton")), TRUE);
	}
	else
		gtk_widget_set_sensitive (GET_WIDGET ("to_last_modified_date_radiobutton"), TRUE);
}
示例#2
0
static void
gimp_progress_dialog_progress_end (GimpProgress *progress)
{
  GimpProgressDialog *dialog = GIMP_PROGRESS_DIALOG (progress);

  if (! dialog->box)
    return;

  if (GIMP_PROGRESS_BOX (dialog->box)->active)
    {
      gimp_progress_end (GIMP_PROGRESS (dialog->box));

      gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
                                         GTK_RESPONSE_CANCEL, FALSE);

      gtk_widget_hide (GTK_WIDGET (dialog));
    }
}
示例#3
0
static void
check_custom_message (Dialog *dialog)
{
    char *str;
    GtkTextBuffer *text_buffer;
    GtkTextIter text_iter_start, text_iter_end;
    gboolean sens;

    text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->dalarm_description));
    gtk_text_buffer_get_start_iter (text_buffer, &text_iter_start);
    gtk_text_buffer_get_end_iter   (text_buffer, &text_iter_end);
    str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE);

    sens = e_dialog_toggle_get (dialog->dalarm_message) ? str && *str : TRUE;
    gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, sens);

    g_free (str);
}
示例#4
0
static void clist_selection_changed(GtkTreeSelection * sel,
				   					gpointer user_data)
{ 
    GtkTreeModel *model;
    GtkTreeIter iter;

    if (gtk_tree_selection_get_selected (sel, &model, &iter))
    {
        if (chosen_file != NULL)
		{
	        g_free(chosen_file);
			chosen_file = NULL;
		}

        gtk_tree_model_get (model, &iter, 0, &chosen_file, -1);
		gtk_dialog_set_response_sensitive(GTK_DIALOG(dbox), GTK_RESPONSE_OK, TRUE);
    }
}
static void update_sum(XmiMsimGuiLayerDialog *dialog) {
  int n_elements, *Z;
  double *weight;

  xmi_msim_gui_layer_dialog_get_composition(dialog, &n_elements, &Z, &weight);
  gchar *buffer = g_strdup_printf("<span weight=\"bold\">%lg</span>", xmi_sum_double(weight, n_elements) * 100.0);
  gtk_label_set_markup(GTK_LABEL(dialog->sumLabel), buffer);
  if (n_elements == 0) {
    gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT, FALSE);
    gtk_widget_set_sensitive(dialog->addToCatalogButton, FALSE);
  }
  g_free(buffer);
  if (n_elements > 0) {
    g_free(Z);
    g_free(weight);
  }
  return;
}
示例#6
0
static void
prof_selection_changed(ProfControls *controls,
                       gint hint)
{
    gint i, n;

    n = gwy_selection_get_data(controls->selection, NULL);
    if (hint < 0) {
        gwy_graph_model_remove_all_curves(controls->gmodel);
        for (i = 0; i < n; i++)
            prof_update_curve(controls, i);
    }
    else {
        prof_update_curve(controls, hint);
    }

    gtk_dialog_set_response_sensitive(GTK_DIALOG(controls->dialog),
                                      GTK_RESPONSE_OK, n > 0);
}
static void
dialog_validate (UmAccountDialog *self)
{
        gboolean valid = FALSE;

        switch (self->mode) {
        case UM_LOCAL:
                valid = local_validate (self);
                break;
        case UM_ENTERPRISE:
                valid = enterprise_validate (self);
                break;
        default:
                valid = FALSE;
                break;
        }

        gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, valid);
}
示例#8
0
static void
pw_dialog_anonymous_toggled (GtkWidget         *widget,
                             GtkMountOperation *operation)
{
    GtkMountOperationPrivate *priv = operation->priv;
    gboolean is_valid;

    priv->anonymous = widget == priv->anonymous_toggle;

    if (priv->anonymous)
        is_valid = TRUE;
    else
        is_valid = pw_dialog_input_is_valid (operation);

    gtk_widget_set_sensitive (priv->entry_container, priv->anonymous == FALSE);
    gtk_dialog_set_response_sensitive (GTK_DIALOG (priv->dialog),
                                       GTK_RESPONSE_OK,
                                       is_valid);
}
示例#9
0
static void
reset(TipBlindControls *controls, TipBlindArgs *args)
{
    GwyGraphModel *gmodel;

    gwy_data_field_clear(controls->tip);
    if (args->stripetips) {
        guint i;
        for (i = 0; i < controls->oldnstripes; i++)
            gwy_data_field_clear(args->stripetips[i]);
    }
    controls->good_tip = FALSE;
    gmodel = gwy_graph_model_new();
    gwy_graph_set_model(GWY_GRAPH(controls->graph), gmodel);
    g_object_unref(gmodel);
    gtk_dialog_set_response_sensitive(GTK_DIALOG(controls->dialog),
                                      GTK_RESPONSE_OK, controls->good_tip);
    tip_update(controls);
}
static void
xkb_layout_chooser_enable_disable_buttons (GtkBuilder * chooser_dialog)
{
	GtkWidget *cbv =
	    CWID (gtk_notebook_get_current_page
		  (GTK_NOTEBOOK (CWID ("choosers_nb"))) ?
		  "xkb_language_variants_available" :
		  "xkb_country_variants_available");
	GtkTreeIter viter;
	gboolean enable_ok =
	    gtk_combo_box_get_active_iter (GTK_COMBO_BOX (cbv),
					   &viter);

	gtk_dialog_set_response_sensitive (GTK_DIALOG
					   (CWID
					    ("xkb_layout_chooser")),
					   GTK_RESPONSE_OK, enable_ok);
	gtk_widget_set_sensitive (CWID ("btnPrint"), enable_ok);
}
示例#11
0
static void
update_album_list (DialogData *data)
{
	GtkTreeIter  iter;
	GList       *scan;
	char        *free_space;

	free_space = g_format_size (picasa_web_service_get_free_space (PICASA_WEB_SERVICE (data->service)));
	gtk_label_set_text (GTK_LABEL (GET_WIDGET ("free_space_label")), free_space);
	g_free (free_space);

	gtk_list_store_clear (GTK_LIST_STORE (GET_WIDGET ("album_liststore")));
	for (scan = data->albums; scan; scan = scan->next) {
		PicasaWebAlbum *album = scan->data;
		char           *n_photos_remaining;
		char           *used_bytes;

		n_photos_remaining = g_strdup_printf ("%d", album->n_photos_remaining);
		used_bytes = g_format_size (album->used_bytes);

		gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter);
		gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter,
				    ALBUM_DATA_COLUMN, album,
				    ALBUM_ICON_COLUMN, "file-catalog",
				    ALBUM_NAME_COLUMN, album->title,
				    ALBUM_REMAINING_IMAGES_COLUMN, n_photos_remaining,
				    ALBUM_USED_BYTES_COLUMN, used_bytes,
				    -1);

		if (album->access == PICASA_WEB_ACCESS_PRIVATE)
			gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter,
					    ALBUM_EMBLEM_COLUMN, "emblem-readonly",
					    -1);

		g_free (used_bytes);
		g_free (n_photos_remaining);
	}

	gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog),
					   GTK_RESPONSE_OK,
					   FALSE);
}
示例#12
0
static void
dialog_response(GtkDialog *gd, int button, struct _send_data *data)
{
	switch(button) {
	case GTK_RESPONSE_CANCEL:
		d(printf("cancelled whole thing\n"));
		if (!data->cancelled) {
			data->cancelled = TRUE;
			g_hash_table_foreach(data->active, (GHFunc)cancel_send_info, NULL);
		}
		gtk_dialog_set_response_sensitive(gd, GTK_RESPONSE_CANCEL, FALSE);
		break;
	default:
		d(printf("hiding dialog\n"));
		g_hash_table_foreach(data->active, (GHFunc)hide_send_info, NULL);
		data->gd = NULL;
		/*gtk_widget_destroy((GtkWidget *)gd);*/
		break;
	}
}
示例#13
0
static void
update_ui_real (CeditWindow  *window,
                WindowData   *data)
{
    CeditView *view;

    cedit_debug (DEBUG_PLUGINS);

    view = cedit_window_get_active_view (window);

    gtk_action_group_set_sensitive (data->ui_action_group,
                                    (view != NULL));

    if (data->dialog != NULL)
    {
        gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog->dialog),
                                           GTK_RESPONSE_OK,
                                           (view != NULL));
    }
}
示例#14
0
static void
list_photos_ready_cb (GObject      *source_object,
		      GAsyncResult *result,
		      gpointer      user_data)
{
	DialogData *data = user_data;
	GError     *error = NULL;
	GList      *list;
	GList      *scan;

	gth_task_dialog (GTH_TASK (data->service), TRUE, NULL);

	_g_object_list_unref (data->photos);
	data->photos = facebook_service_list_photos_finish (data->service, result, &error);
	if (error != NULL) {
		if (data->service != NULL)
			gth_task_dialog (GTH_TASK (data->service), TRUE, NULL);
		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the photo list"), error);
		g_clear_error (&error);
		gtk_widget_destroy (data->dialog);
		return;
	}

	list = NULL;
	for (scan = data->photos; scan; scan = scan->next) {
		FacebookPhoto *photo = scan->data;
		GthFileData   *file_data;

		file_data = gth_file_data_new_for_uri (facebook_photo_get_original_url (photo), "image/jpeg");
		g_file_info_set_file_type (file_data->info, G_FILE_TYPE_REGULAR);
		g_file_info_set_size (file_data->info, FAKE_SIZE); /* set a fake size to make the progress dialog work correctly */
		g_file_info_set_attribute_object (file_data->info, "facebook::object", G_OBJECT (photo));

		list = g_list_prepend (list, file_data);
	}
	gth_file_list_set_files (GTH_FILE_LIST (data->file_list), list);
	update_selection_status (data);
	gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, list != NULL);

	_g_object_list_unref (list);
}
static void
update (ChangePassphraseData *data)
{
  gboolean can_proceed = FALSE;
  const gchar *existing_passphrase;
  const gchar *passphrase;
  const gchar *confirm_passphrase;

  existing_passphrase = gtk_entry_get_text (GTK_ENTRY (data->existing_passphrase_entry));
  passphrase = gtk_entry_get_text (GTK_ENTRY (data->passphrase_entry));
  confirm_passphrase = gtk_entry_get_text (GTK_ENTRY (data->confirm_passphrase_entry));

  gdu_password_strength_widget_set_password (GDU_PASSWORD_STRENGTH_WIDGET (data->passphrase_strengh_widget),
                                             passphrase);

  if (strlen (existing_passphrase) > 0 && strlen (passphrase) > 0 &&
      g_strcmp0 (passphrase, confirm_passphrase) == 0 &&
      g_strcmp0 (passphrase, existing_passphrase) != 0)
    can_proceed = TRUE;
  gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, can_proceed);
}
示例#16
0
static void
check_custom_sound (Dialog *dialog)
{
	gchar *str, *dir;
	gboolean sens;

	str = gtk_file_chooser_get_filename (
		GTK_FILE_CHOOSER (dialog->aalarm_file_chooser));

	if (str && *str) {
		dir = g_path_get_dirname (str);
		if (dir && *dir) {
			calendar_config_set_dir_path (dir);
		}
	}

	sens = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->aalarm_sound)) ? str && *str : TRUE;
	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, sens);

	g_free (str);
}
示例#17
0
static void
update_sync_settings_dialog (RBMediaPlayerSource *source)
{
	RBMediaPlayerSourcePrivate *priv = MEDIA_PLAYER_SOURCE_GET_PRIVATE (source);
	gboolean can_continue;

	if (sync_has_items_enabled (source) == FALSE) {
		can_continue = FALSE;
		gtk_label_set_text (GTK_LABEL (priv->sync_dialog_label),
				    _("You have not selected any music, playlists, or podcasts to transfer to this device."));
	} else if (sync_has_enough_space (source) == FALSE) {
		can_continue = FALSE;
		gtk_label_set_text (GTK_LABEL (priv->sync_dialog_label),
				    _("There is not enough space on the device to transfer the selected music, playlists and podcasts."));
	} else {
		can_continue = TRUE;
	}

	gtk_widget_set_visible (priv->sync_dialog_error_box, !can_continue);
	gtk_dialog_set_response_sensitive (GTK_DIALOG (priv->sync_dialog), GTK_RESPONSE_YES, can_continue);
}
示例#18
0
文件: gpaprogressdlg.c 项目: gpg/gpa
static void
gpa_progress_dialog_init (GpaProgressDialog *dialog)
{
  gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
				  5);
  /* Elements.  */
  dialog->label = gtk_label_new (NULL);
  gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox),
			       dialog->label);
  dialog->pbar = GPA_PROGRESS_BAR (gpa_progress_bar_new ());
  gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox),
			       GTK_WIDGET (dialog->pbar));
  /* Set up the dialog.  */
  gtk_dialog_add_button (GTK_DIALOG (dialog),
			 _("_Cancel"),
			 GTK_RESPONSE_CANCEL);

  /* FIXME: Cancelling is not supported yet by GPGME.  */
  gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL,
				     FALSE);
}
示例#19
0
static void
list_photos_ready_cb (GObject      *source_object,
		      GAsyncResult *result,
		      gpointer      user_data)
{
	DialogData       *data = user_data;
	PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object);
	GError           *error = NULL;
	GList            *list;
	GList            *scan;

	gth_task_dialog (GTH_TASK (data->service), TRUE, NULL);
	_g_object_list_unref (data->photos);
	data->photos = picasa_web_service_list_albums_finish (picasaweb, result, &error);
	if (error != NULL) {
		gth_task_dialog (GTH_TASK (data->service), TRUE, NULL);
		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the photo list"), error);
		g_clear_error (&error);
		gtk_widget_destroy (data->dialog);
		return;
	}

	list = NULL;
	for (scan = data->photos; scan; scan = scan->next) {
		PicasaWebPhoto *photo = scan->data;
		GthFileData    *file_data;

		file_data = gth_file_data_new_for_uri (photo->uri, photo->mime_type);
		g_file_info_set_file_type (file_data->info, G_FILE_TYPE_REGULAR);
		g_file_info_set_size (file_data->info, photo->size);
		g_file_info_set_attribute_object (file_data->info, "gphoto::object", G_OBJECT (photo));

		list = g_list_prepend (list, file_data);
	}
	gth_file_list_set_files (GTH_FILE_LIST (data->file_list), list);
	update_selection_status (data);
	gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, TRUE);

	_g_object_list_unref (list);
}
static void
bluetooth_chooser_button_clicked (GtkButton *widget)
{
	BluetoothChooserButton *button = BLUETOOTH_CHOOSER_BUTTON (widget);
	GtkWidget *parent;

	if (button->dialog != NULL) {
		gtk_window_present (GTK_WINDOW (button->dialog));
		return;
	}

	parent = gtk_widget_get_toplevel (GTK_WIDGET (button));
	//FIXME title
	button->dialog = gtk_dialog_new_with_buttons("", GTK_WINDOW (parent),
						     GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
						     GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
						     GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
	g_signal_connect (button->dialog, "response",
			  G_CALLBACK (dialog_response_cb), button);
	gtk_dialog_set_response_sensitive (GTK_DIALOG(button->dialog),
					   GTK_RESPONSE_ACCEPT, FALSE);
	gtk_window_set_default_size (GTK_WINDOW(button->dialog), 480, 400);

	gtk_container_set_border_width (GTK_CONTAINER (button->dialog), 5);
	gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (button->dialog))), 2);

	/* Create the button->chooser */
	button->chooser = bluetooth_chooser_new (NULL);
	g_signal_connect(button->chooser, "selected-device-changed",
			 G_CALLBACK(select_device_changed), button);
	g_signal_emit (G_OBJECT (button),
		       signals[CHOOSER_CREATED],
		       0, button->chooser);
	g_object_set (G_OBJECT (button->chooser), "device-selected", button->bdaddr, NULL);
	gtk_container_set_border_width (GTK_CONTAINER(button->chooser), 5);
	gtk_widget_show (button->chooser);
	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (button->dialog))), button->chooser);

	gtk_widget_show (button->dialog);
}
示例#21
0
/** \brief Check current selection.
 *
 * This function is used to check the currently selected row. This is to avoid
 * selection of region and countries. The function is called as a callback function
 * every time a row is selected.
 * The decision is based on the integer value stored in the invisible column
 * TREE_COL_SELECT. A value of 0 means row may not be selected, while a value of 1
 * means that the row can be selected.
 */
static gboolean
loc_tree_check_selection_cb       (GtkTreeSelection *selection,
                                           GtkTreeModel     *model,
                                           GtkTreePath      *path,
                                           gboolean          sel_path,
                                           gpointer          dialog)
{

     GtkTreeIter iter;
     
     (void) selection; /* avoid unused parameter compiler warning */
     (void) sel_path; /* avoid unused parameter compiler warning */
     
     if (gtk_tree_model_get_iter(model, &iter, path)) {

          guint value;

          gtk_tree_model_get (model, &iter, TREE_COL_SELECT, &value, -1);

          if (value) {
               gtk_dialog_set_response_sensitive (GTK_DIALOG (GTK_WIDGET (dialog)),
                                                          GTK_RESPONSE_ACCEPT,
                                                          TRUE);
               return TRUE;
          }

          /* no need for the else, because the last selected city will remain selected when the
             user clicks on a region or country */
          /*           else { */
          /*                gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), */
          /*                                       GTK_RESPONSE_ACCEPT, */
          /*                                       FALSE); */
          /*                return FALSE; */
          /*           } */

     }


     return FALSE;
}
static void
onResponse( GtkDialog * dialog, int response, gpointer unused UNUSED )
{
    if( response == GTK_RESPONSE_APPLY )
    {
        GtkWidget * w;
        GObject * d = G_OBJECT( dialog );
        struct relocate_dialog_data * data = g_object_get_data( d, DATA_KEY );
        GtkFileChooser * chooser = g_object_get_data( d, "chooser" );
        GtkToggleButton * move_tb = g_object_get_data( d, "move_rb" );
        char * location = gtk_file_chooser_get_filename( chooser );

        data->do_move = gtk_toggle_button_get_active( move_tb );

        /* pop up a dialog saying that the work is in progress */
        w = gtk_message_dialog_new( GTK_WINDOW( dialog ),
                                    GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
                                    GTK_MESSAGE_INFO,
                                    GTK_BUTTONS_CLOSE,
                                    NULL );
        gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG( w ), _( "This may take a moment..." ) );
        gtk_dialog_set_response_sensitive( GTK_DIALOG( w ), GTK_RESPONSE_CLOSE, FALSE );
        gtk_widget_show( w );

        /* remember this location so that it can be the default next time */
        g_free( previousLocation );
        previousLocation = location;

        /* start the move and periodically check its status */
        data->message_dialog = w;
        data->done = TR_LOC_DONE;
        onTimer( data );
        gdk_threads_add_timeout_seconds( 1, onTimer, data );
    }
    else
    {
        gtk_widget_destroy( GTK_WIDGET( dialog ) );
    }
}
示例#23
0
static GimpProgress *
gimp_progress_dialog_progress_start (GimpProgress *progress,
                                     const gchar  *message,
                                     gboolean      cancelable)
{
  GimpProgressDialog *dialog = GIMP_PROGRESS_DIALOG (progress);

  if (! dialog->box)
    return NULL;

  if (gimp_progress_start (GIMP_PROGRESS (dialog->box), message, cancelable))
    {
      gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
                                         GTK_RESPONSE_CANCEL, cancelable);

      gtk_window_present (GTK_WINDOW (dialog));

      return progress;
    }

  return NULL;
}
static void
remove_permission_cb (GtkButton *button, gpointer user_data)
{
	SunOnePermissionsDialog *dialog = SUNONE_PERMISSIONS_DIALOG (user_data);
	SunOnePermissionsDialogPrivate *priv = dialog->priv;
	int row;
	GList *l;
	GtkTreeSelection * selection;
	GtkTreeModel *model;
	GtkTreePath *path;
	GtkTreeIter iter;

	SunOneACE *ace;

	g_return_if_fail (IS_SUNONE_PERMISSIONS_DIALOG (dialog));

	selection = gtk_tree_view_get_selection (priv->perm_tree);
	if (!gtk_tree_selection_get_selected (selection, &model, &iter))
		return;

	path = gtk_tree_model_get_path (model, &iter);
	row = gtk_tree_path_get_indices (path)[0];
	gtk_tree_path_free (path);

	g_return_if_fail (row >= 0 && row < g_list_length (dialog->merged_acls));

	l = g_list_nth (dialog->merged_acls, row);
	if (!l)
		return;

	gtk_list_store_remove ((GtkListStore *) model, &iter);

	/* remove the ACE from our list */
	ace = SUNONE_ACE (l->data);
	dialog->merged_acls = g_list_remove_link (dialog->merged_acls, l);
	g_object_unref (G_OBJECT (ace));

	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
}
static void
edit_partition_update (EditPartitionData *data)
{
  gboolean differs = FALSE;
  gchar *type;
  gchar *name;
  guint64 flags;

  edit_partition_get (data, &type, &name, &flags);

  if (g_strcmp0 (udisks_partition_get_type_ (data->partition), type) != 0)
    differs = TRUE;
  if (g_strcmp0 (udisks_partition_get_name (data->partition), name) != 0)
    differs = TRUE;
  if (udisks_partition_get_flags (data->partition) != flags)
    differs = TRUE;

  gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, differs);

  g_free (type);
  g_free (name);
}
示例#26
0
static void
axis_quantity_changed(GrainCrossControls *controls)
{
    GtkTreeSelection *selection;
    GwyGraphModel *gmodel;
    GwyGrainValue *gvalue;
    GtkTreeModel *model;
    GtkTreeIter iter;
    gboolean ok;

    ok = TRUE;

    selection = gtk_tree_view_get_selection(controls->abscissa);
    if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
        gtk_tree_model_get(model, &iter,
                           GWY_GRAIN_VALUE_STORE_COLUMN_ITEM, &gvalue,
                           -1);
        controls->args->abscissa = gwy_resource_get_name(GWY_RESOURCE(gvalue));
    }
    else
        ok = FALSE;

    selection = gtk_tree_view_get_selection(controls->ordinate);
    if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
        gtk_tree_model_get(model, &iter,
                           GWY_GRAIN_VALUE_STORE_COLUMN_ITEM, &gvalue,
                           -1);
        controls->args->ordinate = gwy_resource_get_name(GWY_RESOURCE(gvalue));
    }
    else
        ok = FALSE;

    gmodel = create_corr_graph(controls->args, controls->dfield);
    gwy_graph_set_model(GWY_GRAPH(controls->graph), gmodel);
    g_object_unref(gmodel);

    gtk_dialog_set_response_sensitive(controls->dialog, GTK_RESPONSE_OK, ok);
    update_target_graphs(controls);
}
示例#27
0
static void
construct_appchooser_widget (GtkAppChooserDialog *self)
{
  GAppInfo *info;

  /* Need to build the appchooser widget after, because of the content-type construct-only property */
  self->priv->app_chooser_widget = gtk_app_chooser_widget_new (self->priv->content_type);
  gtk_widget_set_vexpand (self->priv->app_chooser_widget, TRUE);
  gtk_box_pack_start (GTK_BOX (self->priv->inner_box), self->priv->app_chooser_widget);


  g_signal_connect (self->priv->app_chooser_widget, "application-selected",
                    G_CALLBACK (widget_application_selected_cb), self);
  g_signal_connect (self->priv->app_chooser_widget, "application-activated",
                    G_CALLBACK (widget_application_activated_cb), self);
  g_signal_connect (self->priv->app_chooser_widget, "notify::show-other",
                    G_CALLBACK (widget_notify_for_button_cb), self);
  g_signal_connect (self->priv->app_chooser_widget, "populate-popup",
                    G_CALLBACK (widget_populate_popup_cb), self);

  /* Add the custom button to the new appchooser */
  gtk_box_pack_start (GTK_BOX (self->priv->inner_box),
                      self->priv->show_more_button);

  gtk_box_pack_start (GTK_BOX (self->priv->inner_box),
                      self->priv->software_button);

  info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
  gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, info != NULL);
  if (info)
    g_object_unref (info);

  _gtk_app_chooser_widget_set_search_entry (GTK_APP_CHOOSER_WIDGET (self->priv->app_chooser_widget),
                                            GTK_ENTRY (self->priv->search_entry));

  gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (self->priv->search_bar),
                                         GTK_WIDGET (self));
}
示例#28
0
/**
 * e_table_config_new:
 * @header: The title of the dialog for the ETableConfig.
 * @spec: The specification for the columns to allow.
 * @state: The current state of the configuration.
 *
 * Creates a new ETable config object.
 *
 * Returns: The config object.
 */
ETableConfig *
e_table_config_new (const char          *header,
		    ETableSpecification *spec,
		    ETableState         *state,
		    GtkWindow           *parent_window)
{
	ETableConfig *config = g_object_new (E_TABLE_CONFIG_TYPE, NULL);

	if (e_table_config_construct (config, header, spec, state, parent_window) == NULL){
		g_object_unref (config);
		return NULL;
	}

	gtk_widget_ensure_style (config->dialog_toplevel);
	gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_toplevel)->vbox), 0);
	gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (config->dialog_toplevel)->action_area), 12);

	gtk_dialog_set_response_sensitive (GTK_DIALOG (config->dialog_toplevel),
					   GTK_RESPONSE_APPLY, FALSE);
	gtk_widget_show (config->dialog_toplevel);

	return E_TABLE_CONFIG (config);
}
static void
remove_owner_cb (GtkButton *button, gpointer user_data)
{
	SunOnePermissionsDialog *dialog = SUNONE_PERMISSIONS_DIALOG (user_data);
	SunOnePermissionsDialogPrivate *priv = dialog->priv;
	int row;
	GList *l;
	char *user;
	GtkTreeSelection * selection;
	GtkTreeModel *model;
	GtkTreePath *path;
	GtkTreeIter iter;

	g_return_if_fail (IS_SUNONE_PERMISSIONS_DIALOG (dialog));

	selection = gtk_tree_view_get_selection (priv->owners_tree);
	if (!gtk_tree_selection_get_selected (selection, &model, &iter))
		return;

	path = gtk_tree_model_get_path (model, &iter);
	row = gtk_tree_path_get_indices (path)[0];
	gtk_tree_path_free (path);
	g_return_if_fail (row >= 0 && row < g_list_length (priv->calprops->owners));

	l = g_list_nth (priv->calprops->owners, row);
	if (!l)
		return;

	gtk_list_store_remove ((GtkListStore *) model, &iter);

	/* remove the user from the owners list */
	user = l->data;
	priv->calprops->owners = g_list_remove (priv->calprops->owners, user);
	g_free (user);

	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
}
GtkWidget *
sunone_permissions_dialog_new (SunOneConnection *cnc, const gchar *calid)
{
	SunOnePermissionsDialog *dialog;
	SunOnePermissionsDialogPrivate *priv;

	g_return_val_if_fail (IS_SUNONE_CONNECTION (cnc), NULL);
	g_return_val_if_fail (calid != NULL, NULL);

	dialog = g_object_new (SUNONE_PERMISSIONS_DIALOG_TYPE, NULL);
	priv = dialog->priv;
	priv->cnc = cnc;
	priv->calid = g_strdup (calid);
	gtk_window_set_title (GTK_WINDOW (dialog), _("Folder permissions"));
	gtk_widget_set_size_request(GTK_WIDGET (dialog), 500, 400);

	gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);

	gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);

	g_signal_connect (dialog, "response",
		G_CALLBACK (dialog_button_clicked_cb), NULL);

	/* get properties for this calendar */
	priv->calprops = sunone_connection_get_calprops (priv->cnc, priv->calid, FALSE);
	if (!priv->calprops) {
		gtk_widget_destroy (GTK_WIDGET (dialog));
		e_notice (NULL, GTK_MESSAGE_ERROR, _("Could not get properties for this folder."));
		return NULL;
	}

	merge_acls (dialog);
	init_dialog (dialog);

	return GTK_WIDGET (dialog);
}