Script para trocar o papel de parede do fluxbox em GTK
Publicado por eu 23/04/2008
[ Hits: 6.047 ]
Script para trocar o papel de parede do fluxbox em GTK.
É aconselhável que você tenha instalado um wallpapersettler como esetroot e para compilar é preciso ter o pacote libgtk2.0-dev instalado (para ubuntu use: sudo apt-get install libgtk2.0-dev).
#include <gtk/gtk.h> #include <stdlib.h> GtkWidget *entry; GtkWidget *combo; void conc (char *meu_buf, char *string) { int i,j; for (i=0;meu_buf[i]!=0;i++); for (j=0;string[j]!=0;j++) meu_buf[i+j]=string[j]; meu_buf[i+j]=0; } char opc (char *meu_buf) { char c; if (meu_buf[0]=='F') c='f'; if (meu_buf[0]=='C') c='c'; if (meu_buf[0]=='A') c='t'; if (meu_buf[0]=='M') c='a'; return c; } static void callback( GtkWidget *widget, gpointer data ) { g_print ("Hello again - %s was pressed\n", (gchar *) data); } static void callback2( GtkWidget *widget, gpointer data ) { char meu_buf[80]="fbsetbg -", op[3]={'{FONTE}',' ','{FONTE}'}; op[0]=opc(gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (combo)->entry))); conc(meu_buf,op); conc(meu_buf,gtk_entry_get_text (GTK_ENTRY (entry))); system (meu_buf); } static gboolean delete_event( GtkWidget *widget, GdkEvent *event, gpointer data ) { gtk_main_quit (); return FALSE; } static void file_ok_sel( GtkWidget *w, GtkFileSelection *fs ) { gtk_entry_set_text (GTK_ENTRY (entry), gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs))); } static void file( GtkWidget *widget, gpointer data ) { GtkWidget *filew; filew = gtk_file_selection_new ("File selection"); g_signal_connect_swapped (G_OBJECT (filew), "destroy", G_CALLBACK (gtk_widget_destroy), G_OBJECT (filew)); g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), "clicked", G_CALLBACK (file_ok_sel), (gpointer) filew); g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), "clicked", G_CALLBACK (gtk_widget_destroy), G_OBJECT (filew)); g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button), "clicked", G_CALLBACK (gtk_widget_destroy), G_OBJECT (filew)); gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew), "penguin.png"); gtk_widget_show (filew); } int main( int argc, char *argv[] ) { GtkWidget *window; GtkWidget *label; GtkWidget *image; GtkWidget *rmenu; GtkWidget *button; GtkWidget *vbox1, *hbox1; GList *glist = NULL; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "FluxPaper 0.1"); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (delete_event), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); vbox1 = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox1); gtk_widget_show (vbox1); hbox1 = gtk_hbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (vbox1), hbox1); label = gtk_label_new ("Arquivo: "); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_box_pack_start (GTK_BOX(hbox1), label, FALSE, TRUE, 0); gtk_widget_show (label); entry = gtk_entry_new(); gtk_box_pack_start (GTK_BOX(hbox1), entry, TRUE, TRUE, 0); gtk_widget_show (entry); button = gtk_button_new_from_stock (GTK_STOCK_OPEN); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (file), (gpointer) "button 2"); gtk_box_pack_start(GTK_BOX (hbox1), button, TRUE, TRUE, 0); gtk_widget_show (button); gtk_widget_show (hbox1); hbox1 = gtk_hbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (vbox1), hbox1); label = gtk_label_new ("Estilo: "); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_box_pack_start (GTK_BOX(hbox1), label, FALSE, TRUE, 0); gtk_widget_show (label); combo = gtk_combo_new(); glist = g_list_append (glist, "Fullscreen"); glist = g_list_append (glist, "Centralizado"); glist = g_list_append (glist, "Ajustado"); glist = g_list_append (glist, "Maximizado"); gtk_combo_set_popdown_strings (GTK_COMBO (combo), glist); gtk_combo_set_use_arrows (GTK_COMBO (combo), TRUE); gtk_box_pack_start (GTK_BOX(hbox1), combo, FALSE, TRUE, 0); gtk_widget_show (combo); gtk_widget_show (hbox1); hbox1 = gtk_hbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (vbox1), hbox1); button = gtk_button_new_from_stock (GTK_STOCK_OK); g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(callback2), (gpointer) "button 3"); g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (delete_event), G_OBJECT (window)); gtk_box_pack_end (GTK_BOX(hbox1), button, FALSE, FALSE, 2); gtk_widget_show (button); button = gtk_button_new_from_stock (GTK_STOCK_APPLY); g_signal_connect (G_OBJECT(button), "clicked", G_CALLBACK(callback2), (gpointer) "button 3"); gtk_box_pack_end (GTK_BOX(hbox1), button, FALSE, FALSE, 2); gtk_widget_show (button); button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (delete_event), G_OBJECT (window)); gtk_box_pack_end (GTK_BOX(hbox1), button, FALSE, FALSE, 2); gtk_widget_show (button); gtk_widget_show (hbox1); gtk_widget_show (window); gtk_main (); return 0; }
Imprimindo uma arvore graficamente
Jogo Final Fight - Haggar (com gráficos)
Fibbonacci com Memoization - O(n)
Enviar mensagem ao usuário trabalhando com as opções do php.ini
Meu Fork do Plugin de Integração do CVS para o KDevelop
Compartilhando a tela do Computador no Celular via Deskreen
Como Configurar um Túnel SSH Reverso para Acessar Sua Máquina Local a Partir de uma Máquina Remota
Configuração para desligamento automatizado de Computadores em um Ambiente Comercial
Compartilhamento de Rede com samba em modo Público/Anônimo de forma simples, rápido e fácil
Cups: Mapear/listar todas as impressoras de outro Servidor CUPS de forma rápida e fácil
Criando uma VPC na AWS via CLI
Tem como instalar o gerenciador AMD Adrenalin no Ubuntu 24.04? (9)