Exemple #1
0
static AtkAttributeSet *
gtk_entry_accessible_get_attributes (AtkObject *accessible)
{
  GtkWidget *widget;
  AtkAttributeSet *attributes;
  AtkAttribute *placeholder_text;
  const gchar *text;

  attributes = ATK_OBJECT_CLASS (_gtk_entry_accessible_parent_class)->get_attributes (accessible);

  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
  if (widget == NULL)
    return attributes;

  text = gtk_entry_get_placeholder_text (GTK_ENTRY (widget));
  if (text == NULL)
    return attributes;

  placeholder_text = g_malloc (sizeof (AtkAttribute));
  placeholder_text->name = g_strdup ("placeholder-text");
  placeholder_text->value = g_strdup (text);

  attributes = g_slist_append (attributes, placeholder_text);

  return attributes;
}
Exemple #2
0
void runGlobalSearch(RuskWindow *rusk)
{
	char *uri = NULL;
	const char *site = gtk_entry_get_placeholder_text(rusk->globalSearch);

	if(strstr(site, "google"))
	{
		uri = "https://google.com/search?q=%s";
	}else if(strstr(site, "maps"))
	{
		uri = "https://google.com/maps?q=%s";
	}else if(strstr(site, "images"))
	{
		uri = "https://google.com/search?tbm=isch&q=%s";
	}

	if(uri)
	{
		char *realURI = g_strdup_printf(uri, gtk_entry_get_text(rusk->globalSearch));
		openURI(rusk, realURI);
		g_free(realURI);

		gtk_entry_set_text(rusk->globalSearch, "");
	}

	globalSearchToggle(rusk, "");
}
Exemple #3
0
wxString wxTextEntry::GetHint() const
{
#if GTK_CHECK_VERSION(3,2,0)
    GtkEntry *entry = GetEntry();
    if (entry && gtk_check_version(3,2,0) == NULL)
        return wxGTK_CONV_BACK(gtk_entry_get_placeholder_text(entry));
#endif
    return wxTextEntryBase::GetHint();
}
Exemple #4
0
static int placeholder_member(lua_State *L)
{
  lua_entry entry;
  luaA_to(L,lua_entry,&entry,1);
  if(lua_gettop(L) > 2) {
    const char * placeholder = luaL_checkstring(L,3);
    gtk_entry_set_placeholder_text(GTK_ENTRY(entry->widget),placeholder);
    return 0;
  }
  lua_pushstring(L,gtk_entry_get_placeholder_text(GTK_ENTRY(entry->widget)));
  return 1;
}