gboolean
custom_report_query_tooltip_cb (GtkTreeView  *view,
                                gint        x,
                                gint        y,
                                gboolean    keyboard_mode,
                                GtkTooltip *tooltip,
                                gpointer    data)
{
    CustomReportDialog *crd = data;
    GtkTreePath *path = NULL;
    GtkTreeViewColumn *column = NULL;
    gint cellx, celly;

    g_return_val_if_fail ( view != NULL, FALSE );

    if (gtk_tree_view_get_path_at_pos (view, x, y,
                                       &path, &column,
                                       &cellx, &celly))
    {
        if (column != crd->namecol)
        {
            gtk_tree_view_set_tooltip_cell (view, tooltip, path, column, NULL);
            if (column == crd->runcol)
                gtk_tooltip_set_text (tooltip, _("Load report configuration"));
            else if (column == crd->editcol)
                gtk_tooltip_set_text (tooltip, _("Edit report configuration name"));
            else if (column == crd->delcol)
                gtk_tooltip_set_text (tooltip, _("Delete report configuration"));
            return TRUE;
        }
        else
            gtk_tooltip_set_text (tooltip, NULL);
    }
    return FALSE;
}
Beispiel #2
0
static gboolean
on_query_tooltip (GtkWidget  *widget,
                  gint        x,
                  gint        y,
                  gboolean    keyboard_tip,
                  GtkTooltip *tooltip,
                  gpointer    user_data)
{
    GtkTreeView *treeview = GTK_TREE_VIEW (widget);
    GtkTreeModel *model = gtk_tree_view_get_model (treeview);
    GtkTreePath *path = NULL;
    GtkTreeIter iter;
    gchar *description;

    if (!gtk_tree_view_get_tooltip_context (treeview, &x, &y,
                                            keyboard_tip,
                                            &model, &path, &iter))
        return FALSE;

    gtk_tree_model_get (model, &iter, COLUMN_DESCRIPTION, &description, -1);
    gtk_tooltip_set_text (tooltip, description);
    gtk_tree_view_set_tooltip_row (treeview, tooltip, path);
    gtk_tree_path_free (path);
    g_free (description);
    return TRUE;
}
Beispiel #3
0
static gboolean on_query_tooltip(G_GNUC_UNUSED GtkWidget *widget, gint x, gint y,
	gboolean keyboard_mode, GtkTooltip *tooltip, GeanyEditor *editor)
{
	gint pos = keyboard_mode ? sci_get_current_position(editor->sci) :
		scintilla_send_message(editor->sci, SCI_POSITIONFROMPOINT, x, y);

	if (pos >= 0)
	{
		if (pos == last_pos)
		{
			gtk_tooltip_set_text(tooltip, output);
			return show;
		}
		else if (pos != peek_pos)
		{
			if (query_id)
				g_source_remove(query_id);
			else
				scid_gen++;

			peek_pos = pos;
			query_id = plugin_timeout_add(geany_plugin, pref_tooltips_send_delay * 10,
				tooltip_launch, editor);
		}
	}

	return FALSE;
}
Beispiel #4
0
gboolean on_view_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_tip,
	GtkTooltip *tooltip, GtkTreeViewColumn *base_name_column)
{
	GtkTreeView *tree = GTK_TREE_VIEW(widget);
	GtkTreeIter iter;

	if (gtk_tree_view_get_tooltip_context(tree, &x, &y, keyboard_tip, NULL, NULL, &iter))
	{
		const char *file;

		gtk_tree_view_set_tooltip_cell(tree, tooltip, NULL, base_name_column, NULL);
		scp_tree_store_get((ScpTreeStore *) gtk_tree_view_get_model(tree), &iter,
			COLUMN_FILE, &file, -1);

		if (file)
		{
			gchar *utf8 = utils_get_utf8_from_locale(file);

			gtk_tooltip_set_text(tooltip, utf8);
			g_free(utf8);
			return TRUE;
		}
	}

	return FALSE;
}
Beispiel #5
0
static gboolean remmina_ftp_client_task_list_on_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_tip,
		GtkTooltip *tooltip, RemminaFTPClient *client)
{
	RemminaFTPClientPriv *priv = (RemminaFTPClientPriv*) client->priv;
	GtkTreeIter iter;
	GtkTreePath *path = NULL;
	gchar *tmp;

	if (!gtk_tree_view_get_tooltip_context(GTK_TREE_VIEW(priv->task_list_view), &x, &y, keyboard_tip, NULL, &path, &iter))
	{
		return FALSE;
	}

	gtk_tree_model_get(priv->task_list_model, &iter, REMMINA_FTP_TASK_COLUMN_TOOLTIP, &tmp, -1);
	if (!tmp)
		return FALSE;

	gtk_tooltip_set_text(tooltip, tmp);

	gtk_tree_view_set_tooltip_row(GTK_TREE_VIEW(priv->task_list_view), tooltip, path);

	gtk_tree_path_free(path);
	g_free(tmp);

	return TRUE;
}
Beispiel #6
0
static gboolean
tab_panel_treeview_query_tooltip_cb (GtkWidget*  treeview,
                                     gint        x,
                                     gint        y,
                                     gboolean    keyboard_tip,
                                     GtkTooltip* tooltip,
                                     gpointer    user_data)
{
    GtkTreeIter iter;
    GtkTreePath* path;
    GtkTreeModel* model;
    MidoriView* view;

    if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (treeview),
        &x, &y, keyboard_tip, &model, &path, &iter))
        return FALSE;

    gtk_tree_model_get (model, &iter, 0, &view, -1);

    gtk_tooltip_set_text (tooltip, midori_view_get_display_title (view));
    gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (treeview), tooltip, path);

    gtk_tree_path_free (path);
    g_object_unref (view);

    return TRUE;
}
Beispiel #7
0
static gboolean
ct_name_set_tooltip (DonnaColumnType    *ct,
                     gpointer            data,
                     guint               index,
                     DonnaNode          *node,
                     GtkTooltip         *tooltip)
{
    gchar *s;
    DonnaNodeHasValue has;

    /* FIXME:
     * 1 (icon) : show full-name (using location as fallback only)
     * 2 (name) : show name if ellipsed, else no tooltip. Not sure how to find
     * out if the text was ellipsed or not... */

    if (index <= 1)
    {
        has = donna_node_get_full_name (node, FALSE, &s);
        if (has == DONNA_NODE_VALUE_NONE /*FIXME*/||has==DONNA_NODE_VALUE_NEED_REFRESH)
            s = donna_node_get_location (node);
        /* FIXME: if NEED_REFRESH do a task and whatnot? */
        else if (has != DONNA_NODE_VALUE_SET)
            return FALSE;
    }
    else
        s = donna_node_get_name (node);

    gtk_tooltip_set_text (tooltip, s);
    g_free (s);
    return TRUE;
}
Beispiel #8
0
static gboolean
file_view_query_tooltip (GtkWidget* widget, gint x, gint y, gboolean keyboard,
						 GtkTooltip* tooltip)
{
	AnjutaFileView* view = ANJUTA_FILE_VIEW (widget);
	AnjutaFileViewPrivate* priv = ANJUTA_FILE_VIEW_GET_PRIVATE (view);
	GtkTreeModel* model_sort;
	GtkTreeModel* file_model = GTK_TREE_MODEL (priv->model);
	GtkTreePath* path;
	GtkTreeIter iter;
	GtkTreeIter real_iter;
	gchar* filename;
	gboolean result = TRUE;
	GdkRectangle visible_rect, column_rect;
	GdkScreen *screen = gdk_screen_get_default ();
	PangoContext *context;
	PangoLayout *layout;
	gint width, height;
	
	if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (view),
											&x, &y, keyboard,
											&model_sort,
											&path,
											&iter))
		return FALSE;
	
	gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (model_sort),
											&real_iter, &iter);
	
	filename = file_model_get_filename (FILE_MODEL (file_model), &real_iter);

	context = gdk_pango_context_get_for_screen (screen);
	layout = pango_layout_new (context);

	pango_layout_set_text (layout, filename, -1);
	pango_layout_get_pixel_size (layout, &width, &height);

	gtk_tree_view_get_visible_rect (GTK_TREE_VIEW (view), &visible_rect);
	gtk_tree_view_get_cell_area (GTK_TREE_VIEW (view), path,
								 gtk_tree_view_get_column (GTK_TREE_VIEW (view), 0), &column_rect);

	if (column_rect.x + width > visible_rect.x + visible_rect.width ||
		column_rect.x < visible_rect.x)
	{
		gtk_tooltip_set_text (tooltip, filename);
		gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (view),
									   tooltip,
									   path);
	} else
	{
		result = FALSE;
	}

	g_free (filename);
	gtk_tree_path_free (path);
	g_object_unref (layout);
	g_object_unref (context);
	
	return result;
}
Beispiel #9
0
static gboolean
windows_menu_display_query_tooltip (GtkWidget  *widget,
                                    gint        x,
                                    gint        y,
                                    gboolean    keyboard_mode,
                                    GtkTooltip *tooltip,
                                    GimpAction *action)
{
  GimpImage *image = GIMP_IMAGE (action->viewable);
  gchar     *text;
  gdouble    xres;
  gdouble    yres;
  gint       width;
  gint       height;

  text = gtk_widget_get_tooltip_text (widget);
  gtk_tooltip_set_text (tooltip, text);
  g_free (text);

  gimp_image_get_resolution (image, &xres, &yres);

  gimp_viewable_calc_preview_size (gimp_image_get_width  (image),
                                   gimp_image_get_height (image),
                                   GIMP_VIEW_SIZE_HUGE, GIMP_VIEW_SIZE_HUGE,
                                   FALSE, xres, yres,
                                   &width, &height, NULL);

  gtk_tooltip_set_icon (tooltip,
                        gimp_viewable_get_pixbuf (action->viewable,
                                                  action->context,
                                                  width, height));

  return TRUE;
}
Beispiel #10
0
static gboolean
bidding_query_tooltip (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode,
		GtkTooltip *tooltip, window_board_t *bidding_store)
{
	if (keyboard_mode) {
		printf ("FIXME: keyboard usage\n");
		return FALSE;
	}
	GtkTreeIter iter;
	gboolean ret = gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (widget),
			&x, &y, keyboard_mode, NULL, NULL, &iter);
	if (!ret) {
		gtk_tooltip_set_text (tooltip, NULL);
		// TODO: don't show anything at all, or something interesting
		// y<0 -> headings
		return TRUE;
	}

	int i;
	int width = 0;
	for (i = 0; i < 4; i++) {
		width += gtk_tree_view_column_get_width (win->bidding_column[i]);
		// TODO: cache this, or use gtk_tree_view_get_path_at_pos
		if (x < width)
			break;
	}
	assert (i < 4);

	gchar *alert;
	gtk_tree_model_get (GTK_TREE_MODEL (win->bidding_store), &iter, 2 * i + 1, &alert, -1);
	gtk_tooltip_set_markup (tooltip, !alert || *alert ? alert : _("(no explanation)"));
	return TRUE;
}
Beispiel #11
0
static gboolean
preview_layout_query_tooltip (GtkWidget         *widget,
			      gint               x,
			      gint               y,
			      gboolean           keyboard_tip,
			      GtkTooltip        *tooltip,
			      SoliPrintPreview *preview)
{
	if (preview->has_tooltip)
	{
		gint page;
		gchar *tip;

		page = get_page_at_coords (preview, x, y);
		if (page < 0)
		{
			return FALSE;
		}

		tip = g_strdup_printf (_("Page %d of %d"),
				       page + 1,
				       get_n_pages (preview));

		gtk_tooltip_set_text (tooltip, tip);
		g_free (tip);

		return TRUE;
	}
	else
	{
		preview->has_tooltip = TRUE;
		return FALSE;
	}
}
/*
 * trw_layer_waypoint_tooltip_cb:
 *
 * Show a tooltip when the mouse is over a waypoint list entry.
 * The tooltip contains the description.
 */
static gboolean trw_layer_waypoint_tooltip_cb ( GtkWidget  *widget,
                                                gint        x,
                                                gint        y,
                                                gboolean    keyboard_tip,
                                                GtkTooltip *tooltip,
                                                gpointer    data )
{
	GtkTreeIter iter;
	GtkTreePath *path = NULL;
	GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
	GtkTreeModel *model = gtk_tree_view_get_model (tree_view);

	if ( !gtk_tree_view_get_tooltip_context ( tree_view, &x, &y,
	                                          keyboard_tip,
	                                          &model, &path, &iter ) )
		return FALSE;

	VikWaypoint *wpt;
	gtk_tree_model_get ( model, &iter, WPT_COL_NUM, &wpt, -1 );
	if ( !wpt ) return FALSE;

	gboolean tooltip_set = TRUE;
	if ( wpt->description )
		gtk_tooltip_set_text ( tooltip, wpt->description );
	else
		tooltip_set = FALSE;

	if ( tooltip_set )
		gtk_tree_view_set_tooltip_row ( tree_view, tooltip, path );

	gtk_tree_path_free ( path );

	return tooltip_set;
}
Beispiel #13
0
/* 
 * shows a tooltip for a file name
 */
static gboolean on_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data)
{
	gboolean show = FALSE;
	int bx, by;
	GtkTreePath *tpath = NULL;
	GtkTreeViewColumn *column = NULL;

	gtk_tree_view_convert_widget_to_bin_window_coords(GTK_TREE_VIEW(widget), x, y, &bx, &by);
	if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bx, by, &tpath, &column, NULL, NULL))
	{
		if (1 == gtk_tree_path_get_depth(tpath) && column == gtk_tree_view_get_column(GTK_TREE_VIEW(widget), FILEPATH))
		{
			GtkTreeIter iter;
			gchar *path = NULL;
			
			gtk_tree_model_get_iter(model, &iter, tpath);
			gtk_tree_model_get(model, &iter, FILEPATH, &path, -1);

			gtk_tooltip_set_text(tooltip, path);
			
			gtk_tree_view_set_tooltip_row(GTK_TREE_VIEW(widget), tooltip, tpath);

			show = TRUE;
		}
		gtk_tree_path_free(tpath);
	}
	
	return show;
}
Beispiel #14
0
static gboolean
which_tooltip_cb (GtkWidget  *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data)
{
    gchar *text = "";

    GncCombott *combott = GNC_COMBOTT (user_data);
    GncCombottPrivate *priv = GNC_COMBOTT_GET_PRIVATE (combott);

    if(priv->active != 0)
    {
        gtk_tree_model_get( priv->model, &priv->active_iter, priv->tip_col, &text, -1 );
        if(g_strcmp0(text, "") && (text != NULL))
        {
            gchar *label = "";
            gtk_tooltip_set_text (tooltip, text);
            g_free(text);
            return TRUE;
        }
        else
        {
            g_free(text);
            return FALSE;
        }
    }
    return FALSE;
}
Beispiel #15
0
static gboolean
pgd_selections_drawing_area_query_tooltip (GtkWidget         *area,
					   gint               x,
					   gint               y,
					   gboolean           keyboard_mode,
					   GtkTooltip        *tooltip,
					   PgdSelectionsDemo *demo)
{
	gboolean over_selection;

	if (!demo->selected_text)
		return FALSE;

	over_selection = cairo_region_contains_point (demo->selected_region,
                                                      x / demo->scale,
                                                      y / demo->scale);

	if (over_selection) {
		GdkRectangle selection_area;

		cairo_region_get_extents (demo->selected_region,
                                          (cairo_rectangle_int_t *)&selection_area);
		selection_area.x *= demo->scale;
		selection_area.y *= demo->scale;
		selection_area.width *= demo->scale;
		selection_area.height *= demo->scale;

		gtk_tooltip_set_text (tooltip, demo->selected_text);
		gtk_tooltip_set_tip_area (tooltip, &selection_area);

		return TRUE;
	}

	return FALSE;
}
Beispiel #16
0
// get tooltip text fromn widget and display if conf.tips is true
extern "C" G_MODULE_EXPORT gboolean on_tooltip (GtkWidget *widget, gint x, gint y, gboolean mode, GtkTooltip *tooltip, gpointer data) {
	gchar *tip;

	tip = gtk_widget_get_tooltip_text(widget);
	gtk_tooltip_set_text(tooltip, tip);
	g_free(tip);

	return conf.tips;
}
static gboolean on_query_tooltip(GtkWidget *widget,
                                 gint x, gint y,
                                 gboolean keyboard_tip,
                                 GtkTooltip *tooltip,
                                 gpointer data)
{
    gtk_tooltip_set_text(GTK_TOOLTIP(tooltip), data);

    return TRUE;
}
Beispiel #18
0
gboolean
playlist_tooltip_handler (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer unused)
{
    GtkWidget *pl = lookup_widget (mainwin, "playlist");
    DB_playItem_t *it = (DB_playItem_t *)ddb_listview_get_iter_from_coord (DDB_LISTVIEW (pl), 0, y);
    if (it) {
        gtk_tooltip_set_text (tooltip, deadbeef->pl_find_meta (it, ":URI"));
        return TRUE;
    }
    return FALSE;
}
static gboolean
individual_tooltip_cb (EmpathyRosterView *view,
    FolksIndividual *individual,
    gboolean keyboard_mode,
    GtkTooltip *tooltip,
    gpointer user_data)
{
  gtk_tooltip_set_text (tooltip,
      folks_alias_details_get_alias (FOLKS_ALIAS_DETAILS (individual)));

  return TRUE;
}
Beispiel #20
0
gboolean
playlist_tooltip_handler (GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer unused)
{
    DdbListview *pl = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner"));
    DB_playItem_t *it = (DB_playItem_t *)ddb_listview_get_iter_from_coord (pl, 0, y);
    if (it) {
        deadbeef->pl_lock ();
        gtk_tooltip_set_text (tooltip, deadbeef->pl_find_meta (it, ":URI"));
        deadbeef->pl_unlock ();
        deadbeef->pl_item_unref (it);
        return TRUE;
    }
    return FALSE;
}
Beispiel #21
0
static gboolean
panel_util_query_tooltip_cb (GtkWidget  *widget,
			     gint        x,
			     gint        y,
			     gboolean    keyboard_tip,
			     GtkTooltip *tooltip,
			     const char *text)
{
	if (!panel_global_config_get_tooltips_enabled ())
		return FALSE;

	gtk_tooltip_set_text (tooltip, text);
	return TRUE;
}
Beispiel #22
0
static gboolean
on_query_tooltip (GtkWidget *widget,
                  gint x, gint y, 
                  gboolean keyboard_mode, 
                  GtkTooltip *tooltip,
                  TaskItem *item)
{
  WnckWindow *window = item->priv->window;
  g_return_val_if_fail (WNCK_IS_WINDOW (window), FALSE);

  gtk_tooltip_set_text (tooltip, wnck_window_get_name(window));
  gtk_tooltip_set_icon (tooltip, wnck_window_get_icon (window));

  return TRUE;
}
Beispiel #23
0
static gboolean
textview_query_tooltip (GtkTextView *text_view,
                        gint x,
                        gint y,
                        gboolean keyboard_mode,
                        GtkTooltip *tooltip,
                        gpointer user_data)
{
	GtkTextBuffer *buffer;
	guint32 state;
	gboolean res = FALSE;

	if (keyboard_mode)
		return FALSE;

	buffer = gtk_text_view_get_buffer (text_view);
	g_return_val_if_fail (buffer != NULL, FALSE);

	state = get_state (buffer);

	if ((state & E_BUFFER_TAGGER_STATE_IS_HOVERING_TOOLTIP) != 0) {
		gchar *url;
		GtkTextIter iter;

		gtk_text_view_window_to_buffer_coords (
			text_view,
			GTK_TEXT_WINDOW_WIDGET,
			x, y, &x, &y);
		gtk_text_view_get_iter_at_location (text_view, &iter, x, y);

		url = get_url_at_iter (buffer, &iter);
		res = url && *url;

		if (res) {
			gchar *str;

			/* To Translators: The text is concatenated to a form: "Ctrl-click to open a link http://www.example.com" */
			str = g_strconcat (_("Ctrl-click to open a link"), " ", url, NULL);
			gtk_tooltip_set_text (tooltip, str);
			g_free (str);
		}

		g_free (url);
	}

	return res;
}
Beispiel #24
0
static gboolean
cb_query_tooltip (GtkWidget  *button,
                  gint        x,
                  gint        y,
                  gboolean    keyboard_mode,
                  GtkTooltip *tooltip,
                  gpointer    user_data)
{
    GtkScaleButton *scale_button = GTK_SCALE_BUTTON (button);
    GtkAdjustment *adjustment;
    gdouble val;
    char *str;
    AtkImage *image;

    image = ATK_IMAGE (gtk_widget_get_accessible (button));

    adjustment = gtk_scale_button_get_adjustment (scale_button);
    val = gtk_scale_button_get_value (scale_button);

    if (val < (gtk_adjustment_get_lower (adjustment) + EPSILON))
    {
        str = g_strdup (_("Muted"));
    }
    else if (val >= (gtk_adjustment_get_upper (adjustment) - EPSILON))
    {
        str = g_strdup (_("Full Volume"));
    }
    else
    {
        int percent;

        percent = (int) (100. * val / (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) + .5);

        /* Translators: this is the percentage of the current volume,
         * as used in the tooltip, eg. "49 %".
         * Translate the "%d" to "%Id" if you want to use localised digits,
         * or otherwise translate the "%d" to "%d".
         */
        str = g_strdup_printf (C_("volume percentage", "%d %%"), percent);
    }

    gtk_tooltip_set_text (tooltip, str);
    atk_image_set_image_description (image, str);
    g_free (str);

    return TRUE;
}
Beispiel #25
0
static gboolean 
undo_tooltip_callback (GtkStatusIcon *status_icon,
                       gint           x,
                       gint           y,
                       gboolean       keyboard_mode,
                       GtkTooltip    *tooltip,
                       gpointer       user_data)
{
  /* set the text for the tooltip */
  gtk_tooltip_set_text (tooltip, "Undo your last action");
   
  /* set an icon for the tooltip */
  gtk_tooltip_set_icon_from_stock(tooltip, "gtk-undo", GTK_ICON_SIZE_MENU);

  /* show the tooltip */
  return TRUE;
}
Beispiel #26
0
static gboolean profile_tooltip (GtkWidget *widget, gint x, gint y,
			gboolean keyboard_mode, GtkTooltip *tooltip, gpointer user_data)
{
	int i;
	cairo_rectangle_int_t *drawing_area = user_data;
	gint tx = x - drawing_area->x; /* get transformed coordinates */
	gint ty = y - drawing_area->y;

	/* are we over an event marker ? */
	for (i = 0; i < tooltips; i++) {
		if (INSIDE_RECT(tooltip_rects[i].rect, tx, ty)) {
			gtk_tooltip_set_text(tooltip,tooltip_rects[i].text);
			return TRUE; /* show tooltip */
		}
	}
	return FALSE; /* don't show tooltip */
}
Beispiel #27
0
gboolean
on_listview_query_tooltip (GtkWidget  *widget,
                           gint        x,
                           gint        y,
                           gboolean    keyboard_mode,
                           GtkTooltip *tooltip,
                           gpointer    user_data)
{
    FsearchApplication *app =FSEARCH_APPLICATION_DEFAULT;
    FsearchConfig *config = fsearch_application_get_config (app);
    if (!config->enable_list_tooltips) {
        return FALSE;
    }
    gboolean ret_val = FALSE;

    GtkTreeModel *model = NULL;
    GtkTreePath *path = NULL;
    GtkTreeIter iter = {0};

    if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (widget),
                                            &x,
                                            &y,
                                            keyboard_mode,
                                            &model,
                                            &path,
                                            &iter))
    {
        return ret_val;
    }

    DatabaseSearchEntry *entry = (DatabaseSearchEntry *)iter.user_data;
    if (entry) {
        BTreeNode *node = db_search_entry_get_node (entry);
        if (node) {
            char path_name[PATH_MAX] = "";
            btree_node_get_path_full (node, path_name, sizeof (path_name));
            gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (widget),
                                           tooltip,
                                           path);
            gtk_tooltip_set_text (tooltip, path_name);
            ret_val = TRUE;
        }
    }
    gtk_tree_path_free (path);
    return ret_val;
}
Beispiel #28
0
static gboolean
pgd_text_view_query_tooltip (GtkTextView   *textview,
                             gint           x,
                             gint           y,
                             gboolean       keyboard_tip,
                             GtkTooltip    *tooltip,
                             PgdTextDemo   *demo)
{
        GtkTreeModel     *model;
        GtkTreeIter       iter;
        GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (demo->treeview));

        if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
                PopplerPage *page;
                gchar *x1, *y1, *x2, *y2;
                PopplerRectangle rect;
                gchar *text;

                gtk_tree_model_get (model, &iter,
                                    TEXT_X1_COLUMN, &x1,
                                    TEXT_Y1_COLUMN, &y1,
                                    TEXT_X2_COLUMN, &x2,
                                    TEXT_Y2_COLUMN, &y2,
                                    -1);

                rect.x1 = g_strtod (x1, NULL);
                rect.y1 = g_strtod (y1, NULL);
                rect.x2 = g_strtod (x2, NULL);
                rect.y2 = g_strtod (y2, NULL);

                g_free (x1);
                g_free (y1);
                g_free (x2);
                g_free (y2);

                page = poppler_document_get_page (demo->doc, demo->page);
                text = poppler_page_get_selected_text (page, POPPLER_SELECTION_GLYPH, &rect);
                gtk_tooltip_set_text (tooltip, text);
                g_free (text);
                g_object_unref (page);
                return TRUE;
        } else {
                return FALSE;
        }
}
Beispiel #29
0
static gboolean
on_scale_button_query_tooltip (GtkWidget  *button,
                               gint        x,
                               gint        y,
                               gboolean    keyboard_mode,
                               GtkTooltip *tooltip,
                               gpointer    user_data)
{
  GtkScaleButton *scale_button = GTK_SCALE_BUTTON (button);
  GtkAdjustment *adjustment;
  gdouble val;
  gchar *str;
  AtkImage *image;

  image = ATK_IMAGE (gtk_widget_get_accessible (button));

  adjustment = gtk_scale_button_get_adjustment (scale_button);
  val = gtk_scale_button_get_value (scale_button);

  if (val < (gtk_adjustment_get_lower (adjustment) + EPSILON))
    {
      str = g_strdup (_("Muted"));
    }
  else if (val >= (gtk_adjustment_get_upper (adjustment) - EPSILON))
    {
      str = g_strdup (_("Full Volume"));
    }
  else
    {
      gint percent;

      percent = (gint) (100. * val / (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) + .5);

      str = g_strdup_printf (C_("volume percentage", "%d %%"), percent);
    }

  gtk_tooltip_set_text (tooltip, str);
  atk_image_set_image_description (image, str);
  g_free (str);

  return TRUE;
}
Beispiel #30
0
static gboolean
tree_view_set_tooltip_query_cb(GtkWidget  *widget,
			       gint        x,
			       gint        y,
			       gboolean    keyboard_tip,
			       GtkTooltip *tooltip,
			       gpointer    data)
{
  char *str;
  GtkTreeIter iter;
  GtkTreePath *path;
  GtkTreeModel *model;
  GtkTreeView *tree_view = GTK_TREE_VIEW(widget);
  int column;

  if (!gtk_tree_view_get_tooltip_context(GTK_TREE_VIEW(widget),
					 &x, &y,
					 keyboard_tip,
					 &model, &path, &iter)) {
    return FALSE;
  }

  column = GPOINTER_TO_INT(data);
  if (column < 0) {
    return FALSE;
  }

  str = NULL;
  gtk_tree_model_get(model, &iter, column, &str, -1);
  if (str == NULL) {
    return FALSE;
  }

  gtk_tooltip_set_text(tooltip, str);
  gtk_tree_view_set_tooltip_row(tree_view, tooltip, path);

  g_free(str);
  gtk_tree_path_free(path);

  return TRUE;
}