Skip to content

Instantly share code, notes, and snippets.

View carlos-jenkins's full-sized avatar

Carlos Jenkins carlos-jenkins

View GitHub Profile
@carlos-jenkins
carlos-jenkins / loading.glade
Last active April 5, 2020 15:38
Simple example to use Gtk.ProgressBar with Python 2.7 and PyGObject.
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="wait">
<property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="type">popup</property>
<property name="title" translatable="yes">Please wait...</property>
<property name="modal">True</property>
<property name="window_position">center-always</property>
@carlos-jenkins
carlos-jenkins / gui.glade
Last active June 29, 2021 08:33
My PyGObject template files for simple applications.
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<property name="border_width">10</property>
<property name="title" translatable="yes">Ejemplo PyGtk</property>
<property name="window_position">center-always</property>
<property name="default_width">400</property>
<property name="default_height">300</property>
@carlos-jenkins
carlos-jenkins / gui.glade
Created May 10, 2013 15:45
Conditional CellRenderer visibility to display different models in a TreeView.
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkTreeStore" id="treestore">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
<!-- column-name catalog_num -->
<column type="gchararray"/>
<!-- column-name comment -->
@carlos-jenkins
carlos-jenkins / app.py
Created February 6, 2014 20:31
How to programatically add new menu items to menu item in PyGObject.
"""
Hierarchy is:
- GtkMenuBar
- GtkMenuItem
- GtkMenu
- GtkMenuItem
- GtkImageMenuItem
- GtkCheckMenuItem
- GtkRadioMenuItem
- GtkSeparatorMenuItem
@carlos-jenkins
carlos-jenkins / vg.c
Created February 7, 2014 23:17
Valgrind test program to demostrate memory access violation, memory leak or double free problems in a C program.
#include <stdlib.h>
#include <stdio.h>
// Compile with:
// gcc -std=c99 -g -Wall -O0 -o vg vg.c
// Run with:
// valgrind --leak-check=full ./vg [1|2|3]
int read_and_write(int* buff, int size, int seed)
{
@carlos-jenkins
carlos-jenkins / app.py
Created February 10, 2014 20:03
Example to set to a Gtk application a custom theme.
# -*- coding:utf-8 -*-
#
# Copyright (C) 2013 Carlos Jenkins <carlos@jenkins.co.cr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@carlos-jenkins
carlos-jenkins / app.py
Created February 10, 2014 22:42
Gtk+ 3.0 application theming using GResource. Compile using `glib-compile-resources gtktheme.gresource.xml`
# -*- coding:utf-8 -*-
#
# Copyright (C) 2013 Carlos Jenkins <carlos@jenkins.co.cr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@carlos-jenkins
carlos-jenkins / app.py
Created February 11, 2014 21:41
Simple Gtk+ web browser using WebKit introspected bindings.
# -*- coding:utf-8 -*-
#
# Copyright (C) 2013 Carlos Jenkins <carlos@jenkins.co.cr>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@carlos-jenkins
carlos-jenkins / dialog.glade
Created August 23, 2014 01:33
PyGObject Dialog Example
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="dialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Entry Dialog</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<child internal-child="vbox">
@carlos-jenkins
carlos-jenkins / app.py
Created October 2, 2014 00:38
Example of using Font Awesome in a PyGObject application.
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Carlos Jenkins <carlos@jenkins.co.cr>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#