Beispiel #1
0
static void
marlin_text_renderer_editing_done (GtkCellEditable    *editable,
                                   MarlinTextRenderer *text_renderer)
{
    const gchar *path;
    const gchar *text;
    gboolean canceled;

    //renametest
    //printf ("%s\n", G_STRFUNC);
    /* disconnect our signals from the cell editable */
    g_signal_handlers_disconnect_by_func (G_OBJECT (editable), marlin_text_renderer_focus_out_event, text_renderer);
    g_signal_handlers_disconnect_by_func (G_OBJECT (editable), marlin_text_renderer_editing_done, text_renderer);
    g_signal_handlers_disconnect_by_func (G_OBJECT (editable), marlin_text_renderer_populate_popup, text_renderer);

    g_object_get (editable, "editing-canceled", &canceled, NULL);

    /* let the GtkCellRenderer class do it's part of the job */
    gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (text_renderer), canceled);

    /* inform whoever is interested that we have new text (if not cancelled) */
    if (G_LIKELY (!canceled))
    {
        //text = gtk_entry_get_text (GTK_ENTRY (editable));
        text = eel_editable_label_get_text (EEL_EDITABLE_LABEL (editable));
        path = g_object_get_data (G_OBJECT (editable), "marlin-text-renderer-path");
        g_signal_emit (G_OBJECT (text_renderer), text_renderer_signals[EDITED], 0, path, text);
    }
}
static void
thunar_text_renderer_editing_done (GtkCellEditable    *editable,
                                   ThunarTextRenderer *text_renderer)
{
  const gchar *path;
  const gchar *text;

  /* disconnect our signals from the cell editable */
  g_signal_handlers_disconnect_by_func (G_OBJECT (editable), thunar_text_renderer_editing_done, text_renderer);
  g_signal_handlers_disconnect_by_func (G_OBJECT (editable), thunar_text_renderer_focus_out_event, text_renderer);
  g_signal_handlers_disconnect_by_func (G_OBJECT (editable), thunar_text_renderer_populate_popup, text_renderer);

  /* let the GtkCellRenderer class do it's part of the job */
  gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (text_renderer), GTK_ENTRY (editable)->editing_canceled);

  /* inform whoever is interested that we have new text (if not cancelled) */
  if (G_LIKELY (!GTK_ENTRY (editable)->editing_canceled))
    {
      text = gtk_entry_get_text (GTK_ENTRY (editable));
      path = g_object_get_data (G_OBJECT (editable), "thunar-text-renderer-path");
      g_signal_emit (G_OBJECT (text_renderer), text_renderer_signals[EDITED], 0, path, text);
    }
}
static void
parasite_property_cell_renderer_stop_editing(GtkCellEditable *editable,
        GtkCellRenderer *renderer)
{
    GObject *object;
    const char *name;
    GValue gvalue = {0};
    GParamSpec *prop;

    object = g_object_get_data(G_OBJECT(editable), "_prop_object");
    name   = g_object_get_data(G_OBJECT(editable), "_prop_name");

    prop = g_object_class_find_property(G_OBJECT_GET_CLASS(object), name);
    g_value_init(&gvalue, prop->value_type);

    if (GTK_IS_ENTRY(editable))
    {
        gboolean canceled = GTK_ENTRY(editable)->editing_canceled;
        gtk_cell_renderer_stop_editing(renderer, canceled);

        if (canceled)
            return;

        if (GTK_IS_SPIN_BUTTON(editable))
        {
            double value =
                g_ascii_strtod(gtk_entry_get_text(GTK_ENTRY(editable)), NULL);

            if (G_IS_PARAM_SPEC_INT(prop))
                g_value_set_int(&gvalue, (gint)value);
            else if G_IS_PARAM_SPEC_UINT(prop)
                g_value_set_uint(&gvalue, (guint)value);
            else if G_IS_PARAM_SPEC_INT64(prop)
                g_value_set_int64(&gvalue, (gint64)value);
            else if G_IS_PARAM_SPEC_UINT64(prop)
                g_value_set_uint64(&gvalue, (guint64)value);
            else if G_IS_PARAM_SPEC_LONG(prop)
Beispiel #4
0
static VALUE
rg_stop_editing(VALUE self, VALUE canceled)
{
    gtk_cell_renderer_stop_editing(_SELF(self), RVAL2CBOOL(canceled));
    return self;
}
static void ddb_cell_renderer_text_multiline_gtk_cell_renderer_text_editing_done (DdbCellEditableTextView* entry, DdbCellRendererTextMultiline* _self_) {
	DdbCellEditableTextView* _tmp0_;
	DdbCellRendererTextMultiline* _tmp1_;
	gulong _tmp2_;
	DdbCellRendererTextMultiline* _tmp3_;
	DdbCellEditableTextView* _tmp4_;
	gboolean _tmp5_;
	DdbCellEditableTextView* _tmp6_;
	GtkTextBuffer* _tmp7_ = NULL;
	GtkTextBuffer* _tmp8_;
	GtkTextBuffer* buf;
	GtkTextIter begin = {0};
	GtkTextIter end = {0};
	GtkTextIter _tmp9_ = {0};
	GtkTextIter _tmp10_ = {0};
	GtkTextIter _tmp11_;
	GtkTextIter _tmp12_;
	gchar* _tmp13_ = NULL;
	gchar* new_text;
	DdbCellRendererTextMultiline* _tmp14_;
	DdbCellEditableTextView* _tmp15_;
	const gchar* _tmp16_;
	g_return_if_fail (entry != NULL);
	g_return_if_fail (_self_ != NULL);
	_tmp0_ = entry;
	_tmp1_ = _self_;
	_tmp2_ = _tmp1_->priv->focus_out_id;
	g_signal_handler_disconnect ((GObject*) _tmp0_, _tmp2_);

    if (_tmp1_->priv->populate_popup_id > 0)
    {
        g_signal_handler_disconnect (entry, _tmp1_->priv->populate_popup_id);
        _tmp1_->priv->populate_popup_id = 0;
    }

    if (_tmp1_->priv->entry_menu_popdown_timeout)
    {
        g_source_remove (_tmp1_->priv->entry_menu_popdown_timeout);
        _tmp1_->priv->entry_menu_popdown_timeout = 0;
    }



	_tmp3_ = _self_;
	_tmp4_ = entry;
	_tmp5_ = _tmp4_->priv->editing_canceled;
	gtk_cell_renderer_stop_editing ((GtkCellRenderer*) _tmp3_, _tmp5_);
	_tmp6_ = entry;
	_tmp7_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp6_);
	_tmp8_ = _g_object_ref0 (_tmp7_);
	buf = _tmp8_;
	gtk_text_buffer_get_iter_at_offset (buf, &_tmp9_, 0);
	begin = _tmp9_;
	gtk_text_buffer_get_iter_at_offset (buf, &_tmp10_, -1);
	end = _tmp10_;
	_tmp11_ = begin;
	_tmp12_ = end;
	_tmp13_ = gtk_text_buffer_get_text (buf, &_tmp11_, &_tmp12_, TRUE);
	new_text = _tmp13_;
	_tmp14_ = _self_;
	_tmp15_ = entry;
	_tmp16_ = _tmp15_->tree_path;
	g_signal_emit_by_name ((GtkCellRendererText*) _tmp14_, "edited", _tmp16_, new_text);
	_g_free0 (new_text);
	_g_object_unref0 (buf);
	_g_free0 (new_text);
}
Beispiel #6
0
static void
cg_cell_renderer_flags_editing_done (GtkCellEditable *editable,
                                     G_GNUC_UNUSED gpointer data)
{
	CgCellRendererFlags *cell_flags;
	CgCellRendererFlagsPrivate *priv;

	const gchar *path;
	GString *str;
	gchar *abbr;
	GtkTreeIter iter;
	gboolean result;
	gboolean canceled;

	cell_flags = CG_CELL_RENDERER_FLAGS (data);
	priv = CG_CELL_RENDERER_FLAGS_PRIVATE (cell_flags);
	
	g_assert (priv->edit_status != NULL);

	if (priv->focus_out_id > 0)
	{
		g_signal_handler_disconnect (G_OBJECT (editable), priv->focus_out_id);
		priv->focus_out_id = 0;
	}

	canceled = cg_combo_flags_editing_canceled (CG_COMBO_FLAGS (editable));
	gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER(cell_flags), canceled);

	if (canceled == FALSE)
	{
		str = g_string_sized_new (128);

		/* We do not just call g_hash_table_foreach to get the flags
		 * in the correct order. */
		for (result = gtk_tree_model_get_iter_first (priv->model, &iter);
		     result != FALSE;
		     result = gtk_tree_model_iter_next (priv->model, &iter))
		{
			gtk_tree_model_get (priv->model, &iter,
			                    priv->abbr_column, &abbr, -1);

			if (g_hash_table_lookup (priv->edit_status, abbr) != NULL)
			{
				if (str->len > 0) g_string_append_c (str, '|');
				g_string_append (str, abbr);
			}
			
			g_free (abbr);
		}

		path = g_object_get_data (G_OBJECT (editable),
		                          CG_CELL_RENDERER_FLAGS_PATH);

		g_signal_emit_by_name (G_OBJECT (cell_flags), "edited",
		                       path, str->str);

		g_string_free (str, TRUE);
	}
	
	g_hash_table_destroy (priv->edit_status);
	priv->edit_status = NULL;
}