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;
}
示例#2
0
文件: views.c 项目: BYC/geany-plugins
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;
}
示例#3
0
static gboolean
icon_sources_query_tooltip (GtkWidget * widget,
                            gint x,
                            gint y,
                            gboolean keyboard_mode,
                            GtkTooltip * tooltip,
                            GladeEPropIconSources * eprop_sources)
{
  GtkTreePath *path = NULL;
  GtkTreeIter iter;
  GtkTreeViewColumn *column = NULL;
  gint bin_x = x, bin_y = y, col;
  gchar *icon_name = NULL;
  gboolean show_now = FALSE;

  if (keyboard_mode)
    return FALSE;

  gtk_tree_view_convert_widget_to_bin_window_coords (eprop_sources->view,
                                                     x, y, &bin_x, &bin_y);

  if (gtk_tree_view_get_path_at_pos (eprop_sources->view,
                                     bin_x, bin_y, &path, &column, NULL, NULL))
    {
      if (gtk_tree_model_get_iter
          (GTK_TREE_MODEL (eprop_sources->store), &iter, path))
        {
          col =
              GPOINTER_TO_INT (g_object_get_data
                               (G_OBJECT (column), "column-id"));

          gtk_tree_model_get (GTK_TREE_MODEL (eprop_sources->store), &iter,
                              COLUMN_ICON_NAME, &icon_name, -1);

          /* no tooltips on the parent rows */
          if (icon_name)
            {
              gchar *tooltip_text = NULL;
              show_now = TRUE;

              switch (col)
                {
                  case COLUMN_TEXT:
                    tooltip_text =
                        g_strdup_printf (_
                                         ("Enter a filename or a relative or full path for this "
                                          "source of '%s' (Glade will only ever load them in "
                                          "the runtime from your project directory)."),
                                         icon_name);
                    break;
                  case COLUMN_DIRECTION_ACTIVE:
                    tooltip_text =
                        g_strdup_printf (_
                                         ("Set whether you want to specify a text direction "
                                          "for this source of '%s'"),
                                         icon_name);
                    break;
                  case COLUMN_DIRECTION:
                    tooltip_text =
                        g_strdup_printf (_
                                         ("Set the text direction for this source of '%s'"),
                                         icon_name);
                    break;
                  case COLUMN_SIZE_ACTIVE:
                    tooltip_text =
                        g_strdup_printf (_
                                         ("Set whether you want to specify an icon size "
                                          "for this source of '%s'"),
                                         icon_name);
                    break;
                  case COLUMN_SIZE:
                    tooltip_text =
                        g_strdup_printf (_
                                         ("Set the icon size for this source of '%s'"),
                                         icon_name);
                    break;
                  case COLUMN_STATE_ACTIVE:
                    tooltip_text =
                        g_strdup_printf (_
                                         ("Set whether you want to specify a state "
                                          "for this source of '%s'"),
                                         icon_name);
                    break;
                  case COLUMN_STATE:
                    tooltip_text =
                        g_strdup_printf (_
                                         ("Set the state for this source of '%s'"),
                                         icon_name);
                  default:
                    break;

                }

              gtk_tooltip_set_text (tooltip, tooltip_text);
              g_free (tooltip_text);
              g_free (icon_name);


              gtk_tree_view_set_tooltip_cell (eprop_sources->view,
                                              tooltip, path, column, NULL);

            }
        }
      gtk_tree_path_free (path);
    }
  return show_now;
}